Page 19 of 56

Posted: Fri Aug 07, 2009 2:07 pm
by Cmd. Cheyd
If I'm overlooking it, or am ignorant of some restriction or method, please let me know... But could the planetinfo.plist properties of Corona Flare, Corona Hue, Corona Shimmer, Sun Color be exposed to Javascript?

Posted: Fri Aug 07, 2009 2:33 pm
by Kaks
Cmd. Cheyd wrote:
If I'm overlooking it, or am ignorant of some restriction or method, please let me know... But could the planetinfo.plist properties of Corona Flare, Corona Hue, Corona Shimmer, Sun Color be exposed to Javascript?
you can set them with

Code: Select all

system.info.corona_flare=1;
and

Code: Select all

System.infoForSystem(0, 55).sun_color='blueColor';

Changes to sun's properties are only applied after a system jump, but I'll look into applying them immediately to the current system.

I'm not entirely sure how to retrieve the system info in js, though.

Posted: Fri Aug 07, 2009 3:33 pm
by Cmd. Cheyd
If it's writable as your example shows, that's what I need. :) Will test it out.

Posted: Sat Aug 08, 2009 9:28 am
by Rustybolts
Im wanting to be able to find out if player ship is using witchdrive injector if so i want to run some code if condition is met.
my test code

Code: Select all

if (player.ship.maxSpeed > 1.0) 
{ 
    player.commsMessage("Works"); 
}
Doesn't work (i assume 1 is the maximum this indicator goes) so is there another way of doing this, if not consider this a suggestion.
The same would apply for jump drive if this is also not possible to detect.

Posted: Sat Aug 08, 2009 3:17 pm
by Frame
apparently this is being dscussed in another topic


{
//do whatever
}
[/code]

However, you cannot be sure of that the ship is using injectores, when exceeding the max speed it can use the torus drive too

So you need to calculate the ratio of the speed for all ships in question..

Injector speed has a max factor of 7.0. if it goes above that, and the ship is not using injector, but the torus drive..

now I'm not going to serve it all on a silver plate, it is after all, your script, I told you what you need to do, but not how to do it.. ;-)

Cheers Frame

Posted: Sat Aug 08, 2009 9:31 pm
by Rustybolts
For what i wanted it for it needed to be a event handler. At the moment i can only call the code via tickle.

Posted: Sat Aug 08, 2009 10:16 pm
by zevans
Well, I guess you could post a request here for the long term...
https://bb.oolite.space/viewtopic.php?t=3296

You want a way to be notified of engaging injectors or engaging jump drive - and depending on why you're doing it, you might also want to be notified if time acceleration is switched on? Do I have that right?

Posted: Wed Sep 09, 2009 5:58 am
by Thargoid
Minor request for 1.74, could the station parameter be added to this.shipLaunchedFromStation in the same way that it is present in this.shipWillLaunchFromStation? So we can have an entity reference of the station the ship launched from, without having to use shipWillLaunch and store it in a script variable?

Posted: Wed Sep 09, 2009 6:29 am
by JensAyton
At the time shipLaunchedFromStation() is called, the game no longer knows which station it was launched from. Although we could add (yet another) variable to the player to track that, it’s actually more efficient for scripts to do it themselves if they need it – scripts can delete their variables when they’re not needed any longer, native code can’t.

Posted: Wed Sep 09, 2009 7:27 am
by Thargoid
Fairy snuff, it just always seemed a fairly awkward way of doing it in scripting to have to have one event set a variable to pass-down to the other event. But if that's actually the most efficient way of doing it then so be it...

Posted: Wed Sep 09, 2009 7:52 am
by another_commander
Done on SVN2448. I used the nearestEntityMatchingPredicate method to name the station that is closest to a ship at the time of its launch. So far tested and looks OK. The theory behind this is that, when a ship is in STATUS_LAUNCHING (or is executing launching updates in the case of player ship), the nearest station to said ship has to be the one it launched from. Some further testing will be needed.

Posted: Wed Sep 09, 2009 5:49 pm
by JensAyton
Epic lateral thinking. I suspect you’ll find that a carrier finds itself, though. Fix: ANDPredicate(NOTPredicate(IsShipPredicate)), IsStationPredicate). Wow, gotta give myself a pat on the back for building that stuff. :-)

Posted: Wed Oct 07, 2009 10:29 am
by Commander McLane
Following my trials and tribulations up to here, I'd like to know: Is there a good reason that the shipWasScooped and shipScoopedOther handlers do not fire if the scooped entity is an escape pod?

If not, I request that escape pods be included to the list of scooped entities that cause the handler to fire, without setting their cargo_type to CARGO_SCRIPTED_ITEM. Because that effectively turns them into cargopods, not escape pods anymore.

Posted: Fri Oct 23, 2009 6:23 am
by Commander McLane
A way to clear a ship's target via JS. (Or tell me how it is done, I can't figure it out.)

this.ship.target = null doesn't do anything and is reported as an error, same for this.ship.target = "". I guess that is because it actually points to another ship, which can't be nullified.

Therefore another way to reset the target of an NPC (or even the player) is needed. Probably a method.

It should trigger the "TARGET_LOST" message in the AI.

Posted: Fri Oct 23, 2009 6:25 am
by Commander McLane
A new event handler shipFiredMissile(missile,target), sent to the firing ship, both player and NPC. Should return the missile entity and the target the missile was fired at.