Scripting requests
Moderators: winston, another_commander
- Cmd. Cheyd
- ---- E L I T E ----
- Posts: 934
- Joined: Tue Dec 16, 2008 2:52 pm
- Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...
you can set them withCmd. 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?
Code: Select all
system.info.corona_flare=1;
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.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Cmd. Cheyd
- ---- E L I T E ----
- Posts: 934
- Joined: Tue Dec 16, 2008 2:52 pm
- Location: Deep Horizon Industries Manufacturing & Research Site somewhere in G8...
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
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
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.
my test code
Code: Select all
if (player.ship.maxSpeed > 1.0)
{
player.commsMessage("Works");
}
The same would apply for jump drive if this is also not possible to detect.
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
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
{
//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
Bounty Scanner
Number 935
Number 935
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
For what i wanted it for it needed to be a event handler. At the moment i can only call the code via tickle.
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
-
- ---- E L I T E ----
- Posts: 332
- Joined: Mon Jul 06, 2009 11:12 pm
- Location: Uncharted backwaters of the unfashionable end of the western spiral arm
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?
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?
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?
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
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.
E-mail: [email protected]
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...
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
-
- Quite Grand Sub-Admiral
- Posts: 6682
- Joined: Wed Feb 28, 2007 7:54 am
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.
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
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. :-)
Last edited by JensAyton on Wed Oct 07, 2009 7:55 pm, edited 1 time in total.
E-mail: [email protected]
- 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:
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.
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.
- 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:
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.
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.
- 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: