Page 52 of 55

Re: Scripting requests

Posted: Sun Mar 16, 2014 12:28 pm
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.

Re: Scripting requests

Posted: Mon Mar 17, 2014 2:13 am
by Pleb
Ah...did not see that... :oops: Thanks cim!

Re: Scripting requests

Posted: Mon Mar 17, 2014 7:41 am
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.

Re: Scripting requests

Posted: Wed Mar 19, 2014 11:19 pm
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?

Re: Scripting requests

Posted: Thu Mar 20, 2014 7:54 am
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.

Re: Scripting requests

Posted: Fri Jul 25, 2014 3:57 am
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 ;) )

Re: Scripting requests

Posted: Fri Jul 25, 2014 5:20 am
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:

Re: Scripting requests

Posted: Fri Jul 25, 2014 5:24 am
by mossfoot
:oops:

Erm... ooops

Re: Scripting requests - chart titles

Posted: Thu Jul 31, 2014 3:07 am
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?

Re: Scripting requests - chart titles

Posted: Thu Jul 31, 2014 9:27 am
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!

Re: Scripting requests

Posted: Mon Sep 29, 2014 8:00 pm
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(){}

Re: Scripting requests

Posted: Mon Sep 29, 2014 10:30 pm
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.

Re: Scripting requests

Posted: Mon Sep 29, 2014 10:44 pm
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.

Re: Scripting requests

Posted: Tue Sep 30, 2014 6:19 am
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

Re: Scripting requests

Posted: Tue Sep 30, 2014 5:22 pm
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.