Scripters cove
Moderators: winston, another_commander
- Rorschachhamster
- ---- E L I T E ----
- Posts: 274
- Joined: Sun Aug 05, 2012 11:46 pm
- Contact:
Re: Scripters cove
Thanks!
So, now my freighttrain has a 1 in 10 Chance to fly to the main station...
So, now my freighttrain has a 1 in 10 Chance to fly to the main station...
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: Scripters cove
I corrected that for you.cim wrote:Only if there are no other non-carrier dockables inRorschachhamster wrote:Does "setTargetToRandomStation" choose the main station as well?the systemrange, which is generally rare.
Yes, the random station was to let ships select an other station than the mainStation. Originally introduced to let pirates dock at non-mainStations to sell their loot. The main station is now only an option if no other is found in range. When you want to include the main station with higher probability, you must indeed use the "rollD: xx" command.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
Re: Scripters cove
I have a question about concurrency in javascript. In station validator I have a public function that is meant to be called by station spawn scripts. In that function I do a for loop to search items from an array and possibly manipulate that array if that item is found. In result the arrays length changes. Is there a concurrency issue here? Is that function being run simultaneously by the spawn scripts?
Re: Scripters cove
The Oolite world simulation code is single-threaded, so no. Only one script will ever be running at any one time, and it will completely finish and return from whatever event handler set it going before any other event handlers run.spara wrote:Is that function being run simultaneously by the spawn scripts?
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Re: Scripters cove
If concurrency is ever added to Oolite scripting, it should be something similar to WebSockets Web Workers – no shared mutable state.
E-mail: [email protected]
Re: Scripters cove
Thanks, that simplifies things quite a lot. I've been lately programming NXT robots with my students and my head is spinning with concurrency issues .
Re: Scripters cove
Been pondering the station_validator oxp a bit. What would happen if I extend it to stop the native stations from spawning?
Scenarios:
1. Coriolis (current main station) is destroyed. What will happen, if the next time visiting the system, that station is removed from existence? What will break? Does some other station just be the "main station?" Is it possible to save at such a substitute station? Asteroid storm oxp seems to remove every station from the system, including the current main station. Is that to overcome some problem?
2. Hermit is destroyed. What will happen and what will break, if it is removed from the existence the next time it is spawned?
Scenarios:
1. Coriolis (current main station) is destroyed. What will happen, if the next time visiting the system, that station is removed from existence? What will break? Does some other station just be the "main station?" Is it possible to save at such a substitute station? Asteroid storm oxp seems to remove every station from the system, including the current main station. Is that to overcome some problem?
2. Hermit is destroyed. What will happen and what will break, if it is removed from the existence the next time it is spawned?
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Scripters cove
Not much.spara wrote:Coriolis (current main station) is destroyed. What will happen, if the next time visiting the system, that station is removed from existence? What will break?
Yes.spara wrote:Does some other station just be the "main station?"
Yes.spara wrote:Is it possible to save at such a substitute station?
It's also possible to specify any station role in the normal main station position, using e.g.:-
system.info.station = "SothisTC"
Hermits are spawned as "rock clusters" - the rock hermit along with some nearby asteroids and a mining ship. (Or several ships?) If you remove the hermit, you probably ought to remove everything in scanner range of it, too.spara wrote:Hermit is destroyed. What will happen and what will break, if it is removed from the existence the next time it is spawned?
Re: Scripters cove
Thanks Wildeblood. That clears up things.
- 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: Scripters cove
To specify a little:Wildeblood wrote:Yes.spara wrote:Does some other station just be the "main station?"Yes.spara wrote:Is it possible to save at such a substitute station?
Once the main station gets destroyed, Oolite instantly elevates the closest dockable entity it can find to main station status (this includes giving it save-load capability). In case there is no other dockable entity in the whole system (which is quite likely in the "vanilla" setting, where Rock Hermits are the only other dockables, and lots of systems don't have Rock Hermits; but becomes less likely, the more secondary-station-adding OXPs the player installs; however, the new main station could be at the other end of the system if there is no closer dockable), there will be no main station (and therefore no load-save/market/equipment/etc. facilities) in the system, which may not be expected by scripts. Therefore there is a possibility that something will break. (This possibility is the reason why main stations are deliberately indestructible by weapons during normal game play. The capability of destroying/removing a main station by script—which is the only way to destroy/remove one—is sort of a hack, and should be used with caution.)
Note that the closest dockable entity does not need to be a station. It can also be a carrier (Behemoth, Dredger, even Thargoid Carrier), if that just happens to be closer to the removed main station than any other dockable. This may not be a wanted effect, but cannot be prevented, except by removing the carrier as well, which will elevate the dockable entity closest to its last position to main station status. And so forth. (Note: this is for instance the reason why Thargoid Carriers never attack main stations, but only secondary stations.)
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: Scripters cove
All systems have at least one rock hermit now (I think).Commander McLane wrote:.. and lots of systems don't have Rock Hermits;
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
Re: Scripters cove
Yes, as of 1.77, unless it gets blown up.Cody wrote:All systems have at least one rock hermit now (I think).Commander McLane wrote:.. and lots of systems don't have Rock Hermits;
I think - I'd have to check - that as of 1.77 carriers cannot become the main station. There's quite a bit of stuff around "what is a main station" that I want to tidy up - the main station gets a bunch of separate properties all of which should not necessarily be unique to a single station (and many of which make no sense whatsoever when applied to an originally non-main station).Commander McLane wrote:Note that the closest dockable entity does not need to be a station. It can also be a carrier
Re: Scripters cove
As a regular asteroid miner, this greatly increases the profitability of a system to me...perhaps too much. Is there an easy way to adjust system populator not add a Rock Hermit to some systems?cim wrote:Yes, as of 1.77, unless it gets blown up.Cody wrote:All systems have at least one rock hermit now (I think).Commander McLane wrote:.. and lots of systems don't have Rock Hermits;
Re: Scripters cove
Not yet, but there will be. You can always remove it and its nearby asteroids after population has happened, of course.Switeck wrote:As a regular asteroid miner, this greatly increases the profitability of a system to me...perhaps too much. Is there an easy way to adjust system populator not add a Rock Hermit to some systems?cim wrote:Yes, as of 1.77, unless it gets blown up.Cody wrote:All systems have at least one rock hermit now (I think).
That said, for a system in 1.77 that would not have had a hermit in 1.76, the hermit is positioned some way outside the orbital plane, well away from the spacelanes. They're not easy to find (well, unless you have a rock hermit locator...) except by getting a pirate to show you where it is, or visually scanning space for a tiny grey dot. The odds of on-lane hermits are (more-or-less) unchanged.
Re: Scripters cove
Ok, so long as they're off the beaten path that's not so much a problem. By placing them sometimes well away from the main shipping lanes, systems are a little more realistic and interesting.
Rock Hermits were mainly valuable to me because they were often along my quick route to main station, so a quick stop at them meant I could stock up on a small amount of cheap precious metals...and sell off any Liquors/Wines I happened to be carrying.
Rock Hermits were mainly valuable to me because they were often along my quick route to main station, so a quick stop at them meant I could stock up on a small amount of cheap precious metals...and sell off any Liquors/Wines I happened to be carrying.