Page 2 of 4

Posted: Tue Oct 02, 2007 2:30 pm
by Capt. James Maladorn
Commander McLane wrote:
Capt. James Maladorn wrote:
Give them a rickshaw or something then?
We cannot "give" the player a ship. The player is his ship, the one that he has bought.
I meant offering a non-witchspace capable ship for 0 credits. This would allow a player to run around in the system to buy a new ship, if that was necessary

Posted: Wed Dec 05, 2007 12:44 pm
by ArkanoiD
Capt. James Maladorn wrote:
Commander McLane wrote:
Capt. James Maladorn wrote:
Give them a rickshaw or something then?
We cannot "give" the player a ship. The player is his ship, the one that he has bought.
I meant offering a non-witchspace capable ship for 0 credits. This would allow a player to run around in the system to buy a new ship, if that was necessary
Haha, this may allow script an inprisonment in a Communist system ;-)

Posted: Tue Jan 22, 2008 9:52 am
by zimmemic25
ArkanoiD wrote:
We cannot "give" the player a ship. The player is his ship, the one that he has bought.
wrong! the player is a XML-file named PLAYERNAME.oolite-save, and has an entry for PLAYERNAME! so you can modify the ship-tag whenever you want WITHOUT modifying anything else!

make a script for the station which
1) generates a mission_garage_[SYSTEM-NAME] variable with the players ship-desc
2) if there was an old ship:
2.1) sets the ship to the old garage entry
2.2) if not sets the ship to cobraMk3
3) shows the buy-ship-screen or the other-garages-screen where you see your other ships and where they live.

so you can have the one ship youre flying and one ship (per system) in the garage.

Posted: Tue Jan 22, 2008 10:00 am
by zimmemic25
i'll try to make a script, but i'm bad at moddeling or something similar, so i can just give you the script and wait til you got an OXP.

Posted: Tue Jan 22, 2008 10:49 am
by zimmemic25
i cant find a JavaScript function for setting the "player.shipDescription"
do you know how to set the player to another ship? like you buy a new one?

Posted: Tue Jan 22, 2008 11:57 am
by Commander McLane
zimmemic25 wrote:
ArkanoiD wrote:
We cannot "give" the player a ship. The player is his ship, the one that he has bought.
wrong! the player is a XML-file named PLAYERNAME.oolite-save, and has an entry for PLAYERNAME! so you can modify the ship-tag whenever you want WITHOUT modifying anything else!
Might be doable in JavaScript (still haven't learned it, so I can't know), but JavaScript is a pretty new addition to the Ooniverse. It's even not finished yet. And the old plist-scripting-system had no means whatsoever to directly manipulate the save-file. So, if you don't edit your save-file with a text editor (which I, as I explained, do not support), the player is exactly one ship. It's still right.

*****

By the way: Are you aware of the possibility to edit your last post by klicking on the "EDIT"-button in the upper right corner? This gives you the opportunity to add something you have forgotten in the first place. You really don't need to post three times in a row, in order to explain just one thought. (Unless you desperately want to get a lot of posts and reputation to your name, of course. :wink: )

Posted: Tue Jan 22, 2008 1:08 pm
by zimmemic25
i think you can use "set: ship_desc" in plist?

i have the following script:

Code: Select all

this.name           = "Garage"
this.author         = "Michael Zimmer"
this.copyright      = "(C) 2007 Me."
this.description    = "OXP for an one-ship-garage in every system";
this.version        = "1.0 alpha 1"


this.STATUS_DOCKED = function()
{
    var oldgarage="cobra3-player";
    oldgarage=missionVariables["garage_"+system.ID+"_"+system.description+"_ship"]; //here we save the OLD garage ship
    missionVariables["garage_"+system.ID+"_"+system.description+"_ship"]=player.shipDescription; // here we set the NEW garage ship (the player ship)
    player.shipDescription=oldgarage; // here we load the OLD garage ship (the NEW player ship). this will NOT work!!! player ship is readonly.

}

i dont understand the plist format, so could you translate this script?
then i could modify it for ship-setting

Posted: Tue Jan 22, 2008 2:01 pm
by Commander McLane
zimmemic25 wrote:
i think you can use "set: ship_desc" in plist?
No, you can't. The set:-method works only with mission_ or local_variables. Some of the internal variables can be set by special methods like setLegalStatus:, addFuel: or removeAllCargo, (see the Methods-document in the wiki for a complete list) but there is absolutely no way to address anything else.

JavaScript is much more powerful in this respect, but there is no way to translate something like player.shipDescription into plist-syntax. Simply doesn't exist.

And it seems that even with JS you have hit the ground pretty soon:
this will NOT work!!! player ship is readonly.
As far as I understand this means that for the time being there won't be a garage without manual manipulation of the save-file (see back-thread; which, for me, isn't a viable option for something that should be easily usable by any player).

Posted: Tue Jan 22, 2008 2:55 pm
by zimmemic25
but the script would modify the safe-file, if it worked.

why is the ship readonly??? i think we(the scripters) shell expand the ooniverse, but we cant mod something basic like the player ship or the safe-file variables!

Posted: Tue Jan 22, 2008 5:09 pm
by LittleBear
You can mod save-file variables, just not that one! :wink: . Quite a few OXPs have been proposed that would involve borrowing a ship, the Garage is one but an inflitration mission where you have to use a Captured Thargoid Warship to slip past waves of Bugs would be another (and rather fun). Its easy enough to store the variable:- set: mission_my_garage_shipname [ship_name] and set: mission_my_garage_ship_planetstore [planetnumber], set mission_my_garage_ship_galaxystore [galaxynumber] would all currently work to record the fact that the player has "A Cobra Mk III stored at Lave in Galaxy 1). But you'd need a new command : awardShip: [mission_my_garage_shipname] to give the player back his Cobra III when back at Lave and chosing to take it out of storage.

Posted: Tue Jan 22, 2008 9:40 pm
by Eric Walch
LittleBear wrote:
But you'd need a new command : awardShip: [mission_my_garage_shipname] to give the player back his Cobra III when back at Lave and chosing to take it out of storage.
You need a lot more. With shipname you only save the name of the ship. But you should also store all the equipment the ship had. (that can be added with awardEquipment) And to be complete, even the fact if he had or had not trumbles on board.

In JS it is maybe doable. JS gives some access to the code and it is probably possible to call the function that controls the buying of a new ship. (But don't ask me how, I don't know.)

Changing the save file makes no sense. When a script changes the save file, you don't see any changes and on the next change all the modifications are overwritten. Changing must happen in memory.

Posted: Tue Jan 22, 2008 10:24 pm
by LittleBear
True Eric, but you could handle the equipment with test for equipment EQ_ENERGY_BOMB, found = set: mission_my_garage_didhaveebomb TRUE etc etc and the a mission_my_garage_reaward = TRUE, mission_my_garage_didhaveebomb = TRUE, awardEquipment: EQ_ENERGY_BOMB to give the right equipment back on taking the ship out of mothballs. Its only the giving the ship itself back that needs a new command. An awardShip would be handy as there are a lot of missions ideas that could use this. As for trumbles, well if you have stored your ship for valeting, the least you can expect it that they cleaned out all the pests whilst you were away!

Posted: Wed Jan 23, 2008 12:19 am
by Disembodied
Would you have to test for all possible types of equipment, including ones from OXPs?

I like the Trumble valeting service idea -- but there'd have to be a steep additional charge!

Posted: Wed Jan 23, 2008 12:46 am
by LittleBear
Yep. But new items aren't made that often (Your missiles would transfer with you) and when a new item comes out its a 2 minute job to C&P another test in, so it wouldn't be too hard to keep the Garage.OXP updated. The garage would really have to terminate any trumble infestation in their own interests, otherwise there'd by no garage (or maybe even station) left when you returned in 6 months! :shock:

Posted: Wed Jan 23, 2008 12:48 am
by Captain Hesperus
LittleBear wrote:
As for trumbles, well if you have stored your ship for valeting, the least you can expect it that they cleaned out all the pests whilst you were away!
NNNNNOOOOOOooooooooooooooooooooo! And I thought you cared, LB! After the many times I have offered you rare Trumbles at cheaper than average rates, and THIS is how you repay me! <shakes head>
My faith in Small Furry Ursines is solidly shaken.

Captain Hesperus
.....despondent to say the least