Scripters cove
Moderators: winston, another_commander
- Capt. Murphy
- Commodore
- Posts: 1127
- Joined: Fri Feb 25, 2011 8:46 am
- Location: UK South Coast.
Re: Scripters cove
Thanks Svengali.
Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
Re: Scripters cove
Can flashers be turned on and off by script (the equivalent of the AI commands switchLightsOn and switchLightsOff)? I had a memory that it got introduced at one point, but I can't find it anywhere. Or have we still got to bounce off an AI to do it?
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Okti
- ---- E L I T E ----
- Posts: 700
- Joined: Sun Sep 26, 2010 1:51 pm
- Location: A GH shop, near witchpoint to Oresrati in Galaxy 8
Re: Scripters cove
I don't think so, we had to use an AI State triggered by JS at XephatlsSword to achieve that effect.Thargoid wrote:Can flashers be turned on and off by script (the equivalent of the AI commands switchLightsOn and switchLightsOff)? I had a memory that it got introduced at one point, but I can't find it anywhere. Or have we still got to bounce off an AI to do it?
- Capt. Murphy
- Commodore
- Posts: 1127
- Joined: Fri Feb 25, 2011 8:46 am
- Location: UK South Coast.
Re: Scripters cove
http://wiki.alioth.net/index.php/Oolite ... ghtsActive
is read/write - you don't need to go via the AI.
is read/write - you don't need to go via the AI.
this.ship.lightsActive = true
or this.ship.lightsActive = false
Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
- Okti
- ---- E L I T E ----
- Posts: 700
- Joined: Sun Sep 26, 2010 1:51 pm
- Location: A GH shop, near witchpoint to Oresrati in Galaxy 8
Re: Scripters cove
An update to XS is requiredCapt. Murphy wrote:http://wiki.alioth.net/index.php/Oolite ... ghtsActive
is read/write - you don't need to go via the AI.
this.ship.lightsActive = true
orthis.ship.lightsActive = false
Thanks for this information.
Re: Scripters cove
Thanks too - I thought I could recall such a command but couldn't find it for looking...Capt. Murphy wrote:http://wiki.alioth.net/index.php/Oolite ... ghtsActive
is read/write - you don't need to go via the AI.
this.ship.lightsActive = true
orthis.ship.lightsActive = false
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Gimbal Locke
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jan 08, 2012 11:32 pm
- Location: Brussels
- Contact:
Re: Scripters cove
Is it possible to have an item for sale at a specific planet?
I looked at http://wiki.alioth.net/index.php/Equipment.plist, where I found:
Is there a list somewhere on which variables (such as systemGovernment_number) I can test against (I suppose there is a variable such as systemName or systemID)?
I looked at http://wiki.alioth.net/index.php/Equipment.plist, where I found:
Code: Select all
conditions = (
"systemGovernment_number morethan 3"
- 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
Yes, and yes. You can test against all variables that were part of the legacy scripting system. They're listed on the [wiki]Methods[/wiki]-page (Querying states). The one you're looking for isGimbal Locke wrote:Is it possible to have an item for sale at a specific planet?
I looked at http://wiki.alioth.net/index.php/Equipment.plist, where I found:
Is there a list somewhere on which variables (such as systemGovernment_number) I can test against (I suppose there is a variable such as systemName or systemID)?Code: Select all
conditions = ( "systemGovernment_number morethan 3"
planet_number
, probably together with galaxy_number
.- Gimbal Locke
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jan 08, 2012 11:32 pm
- Location: Brussels
- Contact:
Re: Scripters cove
Thanks, Commander McLane!
Is there also a non-legacy way to achieve the same?Commander McLane wrote:You can test against all variables that were part of the legacy scripting system.
- 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
Nope, not within a plist. And the markets are not exposed to JS.Gimbal Locke wrote:Thanks, Commander McLane!
Is there also a non-legacy way to achieve the same?Commander McLane wrote:You can test against all variables that were part of the legacy scripting system.
And now imagine that in Oolite 1.65 the things on the Methods-page were everything we had for scripting! What couldn't be done with these pitifully few commands and variables, simply couldn't be done.
- Capt. Murphy
- Commodore
- Posts: 1127
- Joined: Fri Feb 25, 2011 8:46 am
- Location: UK South Coast.
Re: Scripters cove
I think you can do the same in JS...with a bit of trickery.Gimbal Locke wrote:Thanks, Commander McLane!
Is there also a non-legacy way to achieve the same?Commander McLane wrote:You can test against all variables that were part of the legacy scripting system.
You need the equipment item to
"requires_equipment" = "EQ_GIMBAL_DUMMY"
; or similar."EQ_GIMBAL_DUMMY" has a required tech lvl of 99 and is
"visible" = no;
in it's equipment info.In a worldScript you store the galaxyNumbers and system.ID's in an array, and on docking interrogate the array to see if the current station should have the equipment item and if so award the player "EQ_GIMBAL_DUMMY". On launching you remove from the player "EQ_GIMBAL_DUMMY".
This does have some advantages, not least that you could change the array in response to game events and store it as a missionVariable in JSON format. E.g. a new invention might initially only be available at one tech level 15 planet, but could spread to other systems.
Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
Re: Scripters cove
You can also do the same with a mission variable, which is probably a little simpler:Capt. Murphy wrote:I think you can do the same in JS...with a bit of trickery.
Code: Select all
"conditions" = ("mission_thisequipmentisavailable equal 1");
Re: Scripters cove
It's also possible to turn lights on/off via AI.plist scripts...which could also be triggered by .js scripts.Thargoid wrote:Thanks too - I thought I could recall such a command but couldn't find it for looking...Capt. Murphy wrote:http://wiki.alioth.net/index.php/Oolite ... ghtsActive
is read/write - you don't need to go via the AI.
this.ship.lightsActive = true
orthis.ship.lightsActive = false
With "clever use" of scripting, a piece of equipment could start off unavailable (TL99) and slowly become available down to some high-ish tech level, (like TL12) representing a fast spread of the technology.
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: Scripters cove
Sounds a bit complex to me. The easier variant would be to give the equipment itself a lvl of 99 and only set it to the current lvl on docking at a station where needed. Than set it back to 99 on launching.Capt. Murphy wrote:I think you can do the same in JS...with a bit of trickery.
You need the equipment item to"requires_equipment" = "EQ_GIMBAL_DUMMY"
; or similar.
"EQ_GIMBAL_DUMMY" has a required tech lvl of 99 and is"visible" = no;
in it's equipment info.
And when you only want it for a specific station, you can put it all in the ship-script of the station itself during the dock/undock handlers of the station:
Code: Select all
this.otherShipDocked = function (ship)
{
if (ship.isPlayer) missionVariables.EQ_MY_EQUIPMENT = 3;
}
this.stationLaunchedShip = function (ship)
{
if (ship.isPlayer) delete missionVariables.EQ_MY_EQUIPMENT;
}
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Gimbal Locke
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jan 08, 2012 11:32 pm
- Location: Brussels
- Contact:
Re: Scripters cove
Thanks folks, this is most helpful. I'll play around a bit with the different approaches proposed by Commander McLane, Capt. Murphy, cim & Eric.
The confusing thing for new OXP scripters (well, for me anyway) is to know what to do in plist and what to do in Javascript (both formats are new to me), but the above discussion has been clarifying a lot.
The confusing thing for new OXP scripters (well, for me anyway) is to know what to do in plist and what to do in Javascript (both formats are new to me), but the above discussion has been clarifying a lot.