i want a garage...

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

User avatar
Capt. James Maladorn
Average
Average
Posts: 8
Joined: Wed Sep 26, 2007 6:46 pm

Post 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
"Always Vigilant"
ArkanoiD
---- E L I T E ----
---- E L I T E ----
Posts: 452
Joined: Mon Mar 13, 2006 5:46 pm
Location: St Petersburg, Russia
Contact:

Post 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 ;-)
zimmemic25
Competent
Competent
Posts: 47
Joined: Sun Jan 20, 2008 3:51 pm

Post 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.
zimmemic25
Competent
Competent
Posts: 47
Joined: Sun Jan 20, 2008 3:51 pm

Post 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.
zimmemic25
Competent
Competent
Posts: 47
Joined: Sun Jan 20, 2008 3:51 pm

Post 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?
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post 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: )
zimmemic25
Competent
Competent
Posts: 47
Joined: Sun Jan 20, 2008 3:51 pm

Post 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
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post 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).
zimmemic25
Competent
Competent
Posts: 47
Joined: Sun Jan 20, 2008 3:51 pm

Post 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!
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2879
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post 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.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post 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.
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2879
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post 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!
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6885
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Post 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!
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2879
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post 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:
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Captain Hesperus
Grand High Clock-Tower Poobah
Grand High Clock-Tower Poobah
Posts: 2310
Joined: Tue Sep 19, 2006 1:10 pm
Location: Anywhere I can sell Trumbles.....

Post 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
The truth, revealed!!
Image
Post Reply