Scripting requests
Moderators: winston, another_commander
- Commander McLane
- ---- 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:
While it is true that you cannot script commodity prices or quantities in a main station (or any station that uses the "default" entry from commodities.plist), and especially you cannot change anything anymore in a station that is already spawned, you can via OXP replace the main station with another station which can have its custom commodities.plist entry. This is the basic technical idea behind specialevents.oxp.
Of course you are still bound by how commodities.plist works, but I am sure with a little work you will be able to understand it.
Of course you are still bound by how commodities.plist works, but I am sure with a little work you will be able to understand it.
Another way, change system stats, just before spawning a station... coriolis or dodec or whatever.
Code: Select all
This.originalGovernment = system.government
system.gorvenment = ourgovernment
This.originalEconomy = system.government
system.economy = ourEconomy
spawn("coriolis",1,x,y,z)
// restore system stats..
// you can do this to all system statistics... (i Use it in solarSystems oxp)
system.gorvernment = this.originalGovernment
system.economy = this.originalEconomy
Bounty Scanner
Number 935
Number 935
- Cmd. Cheyd
- ---- E L I T E ----
- Posts: 934
- Joined: Tue Dec 16, 2008 2:52 pm
- Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...
I don't think that would work. As soon as you remove the main station to replace it, another station in the system automagically becomes the main station. So when you spawn your replacement one, it will probably no longer be the main station.Commander McLane wrote:While it is true that you cannot script commodity prices or quantities in a main station (or any station that uses the "default" entry from commodities.plist), and especially you cannot change anything anymore in a station that is already spawned, you can via OXP replace the main station with another station which can have its custom commodities.plist entry. This is the basic technical idea behind specialevents.oxp.
Of course you are still bound by how commodities.plist works, but I am sure with a little work you will be able to understand it.
I recall a long while ago having a similar thought and giving it a quick try to see what happens when the main station was removed, and the system ended up as I recall with a main station rock hermit
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Cmd. Cheyd
- ---- E L I T E ----
- Posts: 934
- Joined: Tue Dec 16, 2008 2:52 pm
- Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...
@Cmd. Cheyd: nope, but it's a very nice idea for the wish list!
In the meantime:
Way back then when I javascriptified ( ) Little Bear's Asteroid Storm the windows version of Oolite wouldn't let me destroy the main station.
In order to destroy it anyway I moved the 'real' station to the opposite side of the sun a split second before the explosion, replaced it with a weaker copy in exactly the same place - facing exactly the same way - and blew the copy away.
You could do the same here.
For a start, you'll have to disable the docking computer ('temporary malfunction, commander, nothing to worry about') to avoid instant docking.
Then you can swap the main station with its clone once your ship is a few inches from the docking slot... For a couple of seconds before docking the aegis will disappear, but not many people would notice that...
There might even be a second way of doing this trick.
Instead of an actual replacement station, why not use the 'docking barrel' technique from planetfall? Outbound traffic is created just inside of the slot, but there might be just enough clearance in there for a tiny station right in the middle of the docking slot!
You'll still need a real main station, though, at least for load/save purposes...
In the meantime:
I have a solution for that!Thargoid wrote:I don't think that would work. As soon as you remove the main station to replace it, another station in the system automagically becomes the main station. So when you spawn your replacement one, it will probably no longer be the main station.
Way back then when I javascriptified ( ) Little Bear's Asteroid Storm the windows version of Oolite wouldn't let me destroy the main station.
In order to destroy it anyway I moved the 'real' station to the opposite side of the sun a split second before the explosion, replaced it with a weaker copy in exactly the same place - facing exactly the same way - and blew the copy away.
You could do the same here.
For a start, you'll have to disable the docking computer ('temporary malfunction, commander, nothing to worry about') to avoid instant docking.
Then you can swap the main station with its clone once your ship is a few inches from the docking slot... For a couple of seconds before docking the aegis will disappear, but not many people would notice that...
There might even be a second way of doing this trick.
Instead of an actual replacement station, why not use the 'docking barrel' technique from planetfall? Outbound traffic is created just inside of the slot, but there might be just enough clearance in there for a tiny station right in the middle of the docking slot!
You'll still need a real main station, though, at least for load/save purposes...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
It would then break any OXP which relies on system.mainStation or anything like that (e.g. PlanetFall Taxi and Traffic Control that I can think of offhand as they're mine).
Also as a question what would it do to things like the station aegis? Is that actually tied dynamically to the main station's position? Similarly the square indicator on the standard (non-Advanced) space compass when you get near the planet?
Also as a question what would it do to things like the station aegis? Is that actually tied dynamically to the main station's position? Similarly the square indicator on the standard (non-Advanced) space compass when you get near the planet?
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
All valid points! The switch will only happen 1-2 seconds before you actually dock, though.
The Aegis & indicator are tied to the actual main station position, and any script fnding the main station will start to go to the other side of the sun.
You still need to switch things back once you launch, and if you don't spend more than a few minutes inside, the main planet < - > main station traffic won't be disrupted too much...
The Aegis & indicator are tied to the actual main station position, and any script fnding the main station will start to go to the other side of the sun.
You still need to switch things back once you launch, and if you don't spend more than a few minutes inside, the main planet < - > main station traffic won't be disrupted too much...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Cmd. Cheyd
- ---- E L I T E ----
- Posts: 934
- Joined: Tue Dec 16, 2008 2:52 pm
- Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...
True! I'd personally wait & see if something like station.ismainstation = true is going to happen... I wouldn't hold my breath too much, though: there's a big pile of bugs down at berlios, and I'd say it's more or less a priority for now...
Cheers,
Kaks.
Cheers,
Kaks.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Commander McLane
- ---- 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:
I don't understand why you are thinking so incredibly complicated here.
The only thing you have to do to replace the main station with a custom one is to declare it in planetinfo.plist with the station property.
So this
in planetinfo.plist is all you need to replace Lave's main station with your custom station. I guess my_custom_station has to be the primary role. Then you create a commodities.plist entry for my_custom_station, which is the same as the default entry, except for a higher price for food. Voilà!
Note: any changes in planetinfo.plist will of course be permanent, which you probably do not want. Fortunately there is also infoForSystem (JS) or setSpecificPlanetInfo (legacy), which are reversible. Note also: These have to be set before the player jumps into the system in question, in order to replace the main station with your custom station.
The only thing you have to do to replace the main station with a custom one is to declare it in planetinfo.plist with the station property.
So this
Code: Select all
{
"0 7" = {
description = "Lave is most famous for its vast rain forests and the Laveian tree grub. Due to a population explosion among the tree grubs there is currently a shortage of food on Lave which has led to high food prices.";
station = "my_custom_station";
};
}
Note: any changes in planetinfo.plist will of course be permanent, which you probably do not want. Fortunately there is also infoForSystem (JS) or setSpecificPlanetInfo (legacy), which are reversible. Note also: These have to be set before the player jumps into the system in question, in order to replace the main station with your custom station.
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
....
Is it possible to set conditions in front of a planetary description? That way, a system's content could also be altered dynamically via the planetinfo.plist.Commander McLane wrote:any changes in planetinfo.plist will of course be permanent
- LittleBear
- ---- E L I T E ----
- Posts: 2882
- Joined: Tue Apr 04, 2006 7:02 pm
- Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.
Not sure, but you can do that in a script anyway by setting the conditions and then using the do (in legacy) or equivilent in JS. Assassins does this so the descriptions, tech levels and govenments change as events happen effecting systems. You could swap the main staition as well by having clones like-shiped with different commodoties attached.
eg:-
In this eg only the description is changed, but could change the station tech level or anything else you liked with the same code.
eg:-
Code: Select all
{
conditions = ("gui_screen_string oneof GUI_SCREEN_STATUS, GUI_SCREEN_EQUIP_SHIP, GUI_SCREEN_MARKET, GUI_SCREEN_SHORT_RANGE_CHART", "dockedAtMainStation_bool equal YES", "mission_assassins equal assassins_STAGE3", "mission_assassins_jumpcount greaterthan 4", "galaxy_number equal 6", "score_number greaterthan 823");
do = (
"setMissionMusic: none",
"setMissionImage: assassins.png",
setGuiToMissionScreen,
"addMissionText: hitbrief_3",
"set: mission_assassins assassins_STAGE3a",
"set: mission_assassins_jumpcount 0",
"setMissionDescription: assassins_header6",
"setSpecificPlanetInfo: 6=73=description=Orramaor is noted for its companion world Apollodorus. Formaly the corporate headquarters of Soin Classic Shipyards Ltd, the Planet Orramaor is now famous for a large crater on the southern continent."
);
},
Last edited by LittleBear on Fri Feb 20, 2009 10:40 am, edited 1 time in total.
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.
- Commander McLane
- ---- 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:
Re: ....
I am not sure. But I don't think so. Conditions in planetinfo.plist can only be used in script_actions, as far as I understand. And if you use setSpecificPlanetInfo in a script_actions in planetinfo.plist, what's the advantage over doing it directly in your script.plist?Lestradae wrote:Is it possible to set conditions in front of a planetary description? That way, a system's content could also be altered dynamically via the planetinfo.plist.Commander McLane wrote:any changes in planetinfo.plist will of course be permanent
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
Re: ....
Well, personally I would find that more clearly arranged (especially with my oxp having a bazillion of different XML and Java scripts simultanously running) but perhaps that's a matter of taste.Commander McLane wrote:And if you use setSpecificPlanetInfo in a script_actions in planetinfo.plist, what's the advantage over doing it directly in your script.plist?
That one's interesting. Is there a XML command for the planetinfo.plist that lets a piece of music or a sound file be played when the player enters a system? I could use something like that for my special systems.LittleBear wrote:do = (
"setMissionMusic: none"