Scripting requests

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim »

Pleb wrote:
I'm not sure whether it's me missing something or this particular function not working the way it's supposed to (but I'm guessing it's probably the first one), but I'm still able to dock. I can disallow docking clearance but I can still dock:
The shipSpawned method isn't called for subentities. Set the initial values through the subentity definition in shipdata.plist instead.
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Scripting requests

Post by Pleb »

Ah...did not see that... :oops: Thanks cim!
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim »

Pleb wrote:
Ah...did not see that...
Well, the bit in the documentation of shipSpawned that said that probably wasn't there the last time you looked. Docks are perhaps the first subentity there's a need to put scripts on, so it's not really come up before.
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Scripting requests

Post by Pleb »

Okay still having problems. I've set the allow_docking function to false and the disallowed_docking_collides function to true in the subentity definition in shipdata.plist but its still letting me dock. :(

Also if you have to define these in the subentity definition then dos that mean they can't be conditional?
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim »

Could you trim the shipdata.plist to the smallest length of code + attached scripts you'd expect to work but doesn't and post it - that should be working correctly.
Pleb wrote:
Also if you have to define these in the subentity definition then dos that mean they can't be conditional?
The initial values can't be, but the main entity's shipSpawned function can use whatever conditions it likes to immediately change them.
User avatar
mossfoot
---- E L I T E ----
---- E L I T E ----
Posts: 827
Joined: Fri May 30, 2014 4:07 pm
Contact:

Re: Scripting requests

Post by mossfoot »

I have a request, specifically for the Neolite Cobra MKII-X

http://wiki.alioth.net/index.php/Cobra_Mk.2_(Oolite)

This is the original version, and the size of it obviously doesn't match up with the fiction (which is described as more like a Cobra MK III with the hull problems fixed, though that still leaves some wiggle room. I reckon they also added in the side lasers and an extra energy bank between 2 and 3 ;) ). This ship, if I'm reading the stats correctly, is smaller than an Adder overall!

But Neolite did his own version for his Companion set

http://wiki.alioth.net/index.php/Neolite_Ships

I was wondering if someone could tell me if he altered the dimensions on his version of the ship, and if so what the dimensions now are in game. If it is about the same size as the original above, could someone possibly make a new model that keeps the design exactly the same, but scales it up so it's on par with the Cobra 1 and 3. If the Neolite version is already boosted in size... woot!

(See, I've got a story I want to write involving this. I'll be removing the ship as a random encounter and only player available.)

If anyone is willing to take this on, can I also trouble them for a custom paint job :D (just want to replace the snake on it with my logo ;) )
--
Image
Pilot: Mossfoot - Ship ID: Viaticus Rex (Cobra MKII)
Rank: Competent - Status: Clean

http://www.noahchinnbooks.com/
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6312
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Scripting requests

Post by Diziet Sma »

mossfoot wrote:
I have a request, specifically for the Neolite Cobra MKII-X
You appear to have misunderstood the nature of this thread.. :wink:

It's intended for OXP writers to ask for new functions to be added to core, so that their OXP can do something clever that the core code doesn't currently permit.

A new thread in the Expansion Packs section would be a better place to post your request. :wink:
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
mossfoot
---- E L I T E ----
---- E L I T E ----
Posts: 827
Joined: Fri May 30, 2014 4:07 pm
Contact:

Re: Scripting requests

Post by mossfoot »

:oops:

Erm... ooops
--
Image
Pilot: Mossfoot - Ship ID: Viaticus Rex (Cobra MKII)
Rank: Competent - Status: Clean

http://www.noahchinnbooks.com/
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2466
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: Scripting requests - chart titles

Post by Wildeblood »

I've a request: being able to over-ride the value of "short-range-chart-title" in descriptions.plist from SystemInfo for individual systems. So we could create a planetinfo.plist that e.g. titled the screen "The Pulsar Worlds" whenever the player was in the top right of chart 1, or "Beyond the Great Rift" in the bottom left of chart 7.

Also, with the zoomable chart (brilliant!) only "long-range-chart-title-d" is currently being used. Were you planning to re-instate "short-range-chart-title" when the chart is zoomed in, or is changing the screen title while it is being viewed an unwanted complication?
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: Scripting requests - chart titles

Post by Zireael »

Wildeblood wrote:
I've a request: being able to over-ride the value of "short-range-chart-title" in descriptions.plist from SystemInfo for individual systems. So we could create a planetinfo.plist that e.g. titled the screen "The Pulsar Worlds" whenever the player was in the top right of chart 1, or "Beyond the Great Rift" in the bottom left of chart 7.

Also, with the zoomable chart (brilliant!) only "long-range-chart-title-d" is currently being used. Were you planning to re-instate "short-range-chart-title" when the chart is zoomed in, or is changing the screen title while it is being viewed an unwanted complication?
Seconding those two!
User avatar
streb2001
Competent
Competent
Posts: 53
Joined: Sat Aug 16, 2014 12:06 pm

Re: Scripting requests

Post by streb2001 »

This is a repeat of my comment in the Expansion Pack topic: I cannot find any way of detecting when the game is paused. I want to silence my custom engine sound on pausing (usually means wife talking, doesn't go well with loud engine roar!)

Can I request the following please?

Game State handler addition, something such as:

this.playerWillPauseGame = function(){}

and

this.playerHasResumedGame = function(){}
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Scripting requests

Post by Norby »

I think the whole scripting engine is stopped during pause so your theoretical js code will not run.

But there is a manual solution: press F2 when you are in pause, then select Game Options, Sound Volume and hold down the left arrow until Mute.
User avatar
streb2001
Competent
Competent
Posts: 53
Joined: Sat Aug 16, 2014 12:06 pm

Re: Scripting requests

Post by streb2001 »

I thought the js event handlers are called by the Oolite core? If so surely Oolite can detect "p" pressed, call the pause event handler then pause the game after the handler returns.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim »

Norby wrote:
I think the whole scripting engine is stopped during pause so your theoretical js code will not run.
Frame callbacks are suspended (so you can't just detect pause by checking for delta=0 in one) and timers run on game time rather than real time so won't fire either, but the scripting engine does still operate. A few handlers in it might even still be called while paused - coordinatesForEscortPosition, perhaps - though I've not checked.

(All pausing the game does is set the "simulation step" to 0 - pretty much everything still runs, including screen updates, or you wouldn't be able to do anything while paused other than kill the game to your desktop)

It should be straightforward to add the requested handlers and I'll add it to the list for 1.82
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Scripting requests

Post by cim »

Added and will be in the nightly builds.

Incidentally, one other bit of JS functionality that can still be used while paused is the JS console - pause the game, run a series of commands to set up a situation, then resume. Much easier than trying to do it while the simulation is running and half way through your new NPC's default AI causes it to jump out of the system.
Post Reply