Page 3 of 4
Posted: Wed Jan 23, 2008 7:19 am
by zimmemic25
Eric Walch: i wanted to make a small script, just for saving and setting a new ship, i dont want to save the equipment. i also cant make any OXP from it, thats your job, i just make a script!
Posted: Fri Mar 07, 2008 2:31 pm
by zimmemic25
is there any chance to get ship access?
Posted: Mon Aug 04, 2008 11:19 am
by zimmemic25
sorry for answering to this old topic, but i have an idea:
if i could use a HTTP request (from my script) i could make a php-script which modifies the savegame.
javascript (dont know the method):
Http-request("127.0.0.1:80/modifysavegame.php?tag=player-ship&cdata=adder-player");
PHP (something like):
$f=file("~/oolite-saves/xy");
while ($i=next($f)){
$i=ereg_replace("<$_GET[tag]>*</$_GET[tag]>","<$_GET[tag]>$_GET["cdata"]</$_GET[tag]>",$i) };
(now we would write it.)
Posted: Mon Aug 04, 2008 3:39 pm
by JensAyton
General file I/O and networking from JavaScript is something that will absolutely not, ever, be supported in Oolite.
simplicity
Posted: Fri Oct 31, 2008 7:25 pm
by chomann
i believe the answer to this riddle is simplicity,.. I have a few questions
can we create a shipyard where whatever is sold there is sold for a flat rate...(ie; 100 credits)
Can we make dockable ships with ships for sale? ie; board a behemoth and find a buying screen with f-3 for ships?
Can we make this "behemoth" ship 90-100% the time always spawn at bouys or witchpoints?
can we create a ship that has a value of 100 credits, and all it does is transport, and can we make the ship show up at roughly 90-100% of the stations or selling places by setting a low tech level and high chance?
Now the hardest part can we have this ship that sells ships sell only ships from a certain list, like a custom shipyard?
and can this info somehow report to a plist file outside in the oolite folder for retrieval (ie the custom shipyard)...if not then "by hand" modification is atleast possible (just simply add the ship name to the list when out of game)
basically stop at oxp generated "market" sell ship for tiny amount 50-100 cr, buy transport for 100-50 cr then go to station to continue, record the lost ship in out of game file that controls what the "oxp generated market" sells...
I know it sounds kinda confusing but i hope this idea although simple could shed some more insight on the options...its an ongoing project...
Posted: Fri Oct 31, 2008 8:23 pm
by FSOneblin
There is already a ship that is 50-100 cr, It's called a strut. It is in the illicit unlock oxp.
FSOneblin
Posted: Fri Oct 31, 2008 11:00 pm
by nijineko
so basically, the idea is to have a special dockable ship. this ship will sell you an uber cheap transport ship in exchange for your ship. it will remember your ship, and also be able to sell it back to you for an uber-cheap "docking and storage fee". when you have the transport ship, you can fly to the station and buy another ship. the special ship will remember an (unlimited?) number of ships.
so it needs to be able to write to a special shipyard plist, have that special plist such that only the transport ship and any ships you sell to it are available to purchase, and have the prices strictly under control of the oxp. did i miss anything?
may i suggest, that since having multiple ships and storing some in drydock is likely only something the very wealthy would do, have the special storage ship only appear in tl 14 or 15, maybe 13 systems?
Posted: Sat Nov 01, 2008 12:00 am
by LittleBear
It would be relatively straight-forward to store as variables:- A) Ships the player owned, B) What equipment each ship had and C) Where they were in dry-dock. The ship the player has is stored in the save file as:-
Code: Select all
<key>ship_desc</key>
<string>icour-player</string>
You could store everything about a current ship the player has with variables like:- set: mission_shipyard_storedship [ship_desc], set mission_shipyard_storded_ship_has_ecm YES etc etc to store the type of ship stored and what it has. Returning to the garage could then give the options just with a mission screen of storing a new ship or taking out an already stored ship. Storing the information is do-able with current OXP scripting.
You can make dockable ship or stations with shipyards, but you can't specify which ships will be sold. Also I don't think Oolite rembers that you sold a ship there. I think all the shipyards are populated with the same code and a random selection of all the ships installed but only ships that qualify on tech_level being "dealt out" into the ships for sale.
The problem is there's no way to change the player's ship except by buying one. We'd need commands removeShip and awardShip: [mission_shipyard_storedship] (Like you can currently do with equipment). Which would mean pretty major changes to Oolite itself. ATM as far as Oolite is concerened, the player
is his ship. Could put in a scripting request for this, but without a new command although you
could store details of the player's current ship you can't take him out of his ship or put him into another one.
well
Posted: Sat Nov 01, 2008 12:18 am
by chomann
my thought was that by having to purchase the "transport" for 100-50 cr that would sidestep the "award ship" problem...you are really just selling and buying new ships...the only thing is that when you sell one to the "garage" (ie stationary ship)... it records its basic inf in a custom plist..
this was onyl my first thought and since shipd can look like anything ...the ship can look like a garage or floating box or whatever..seems like a simplistic way of doing it but much easier than trying to re-write parts of oolite...
Posted: Sat Nov 01, 2008 12:28 am
by LittleBear
Ahh got you!
Thats definatley more elegant, but I think you'd still have to rewrite the code for populating the shipyards as ATM Oolite won't remember the ship you sold. Come back later and it'll be gone - relistic normally as if you sell your Cobra at Lave somone else might have bought it by the time you return - but not what you want for a garage. Also, I don't think you can specify that a shipyard must have the transports in it without a rewrite. If you gave the transports a very low tech_level requirement, they'd probabley be one or more there (and in every other shipyard) but you be relying on chance.
Re: simplicity
Posted: Sat Nov 01, 2008 8:44 am
by Commander McLane
chomann wrote:i believe the answer to this riddle is simplicity,.. I have a few questions
And here are some answers:
chomann wrote:can we create a shipyard where whatever is sold there is sold for a flat rate...(ie; 100 credits)
No. Ship prices are independent of shipyards. They are defined in a plist-entry of each ship and valid globally in all shipyards.
chomann wrote:Can we make dockable ships with ships for sale? ie; board a behemoth and find a buying screen with f-3 for ships?
Yes, easily. Just set the
hasShipyard-key in the carrier's shipdata to
true.
chomann wrote:Can we make this "behemoth" ship 90-100% the time always spawn at bouys or witchpoints?
Yes, easily.
chomann wrote:can we create a ship that has a value of 100 credits, and all it does is transport, and can we make the ship show up at roughly 90-100% of the stations or selling places by setting a low tech level and high chance?
In principle, yes. Although there is no guarantee which ships will show up at any shipyard. Shipyards are populated by the engine through (pseudo-)random from the list of all ships which are available at the techlevel of the current system.
chomann wrote:Now the hardest part can we have this ship that sells ships sell only ships from a certain list, like a custom shipyard?
No.
chomann wrote:and can this info somehow report to a plist file outside in the oolite folder for retrieval (ie the custom shipyard)...if not then "by hand" modification is atleast possible (just simply add the ship name to the list when out of game)
No, and I am not sure Ahruman would be willing to implement something like that (see his post above yours).
chomann wrote:basically stop at oxp generated "market" sell ship for tiny amount 50-100 cr, buy transport for 100-50 cr then go to station to continue, record the lost ship in out of game file that controls what the "oxp generated market" sells...
No, because of the lack of the 'recording' part.
And the 'no' two quotes above means that we cannot influence in any way which ships are shown for sale on a shipyard. As LittleBear already said: Once you sell your ship, it is gone. It is very
very unlikely that you ever will see a similar equipped ship of the same type again. Ever. (Which is quite realistic: If you sell a beautiful, fully equipped mega-ship, the shipyard will easily find another buyer for it. There goes your ship...)
so were back to step 1
Posted: Sat Nov 01, 2008 6:45 pm
by chomann
the best thing is to still just back up the savefiles before buying a new ship and reloading a game for the ship..or modding the save file...although realistically most space "people" would live on their ship either docked or while moving...so there would never be a need for 2....
Posted: Sat Nov 01, 2008 9:55 pm
by nijineko
since oolite already reads and writes save files, any chance of scripting a way of catching this save data and/or using the already existing save data/restore data mechanism to pull off the garage trick?
let's see. for saving a ship... if the script can lift the shipdata only, and save it somehow, somewhere, either as a special plist of some kind, or by using the save-game mechanism to write a ship data-only version of the save file marked for use with the garage.
as far as loading a ship goes... all it really needs to do is overwrite the current ship as if it was purchased. after it saved the current ship.
questions:
oolite can read and write to plists? if so, could this be used?
oolite can read and write to save files... can this be harnessed by a script to read and write special save files for the purposes of the garage idea? (basically save files that only contain shipdata)
could a special "psuedo-shipyard" be run entirely from script?
Posted: Mon Nov 03, 2008 8:06 am
by Commander McLane
Again, please read Ahruman's post just above chomann's. For your convenience I quote it here:
Ahruman wrote:General file I/O and networking from JavaScript is something that will absolutely not, ever, be supported in Oolite.
Posted: Mon Nov 03, 2008 3:17 pm
by JensAyton
Non-general I/O is another matter, but I’m not going to pursue that at this time.