Scripters cove

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Cholmondely
Archivist
Archivist
Posts: 5364
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Scripters cove

Post by Cholmondely »

Alnivel wrote: Sun Oct 23, 2022 8:21 am
Have you tried with a non-template ship too? I just checked it myself - entry with "wavefront" is displayed, with template - no.
If this still does not work, maybe something useful is in the logs?
Genius! You fixed it! Thank you...

Minor query: how would I have known that wavefront was the ship data key?
https://wiki.alioth.net/index.php/Shiplibrary.plist#ship wrote:
ship

The data key in shipdata.plist of this ship.

ship = "cobra3-trader";
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
Massively Locked
Dangerous
Dangerous
Posts: 84
Joined: Tue Nov 20, 2012 12:20 pm

Re: Scripters cove

Post by Massively Locked »

I vaguely remember reading somewhere about some function/method/Jedi-mind-trick that boldly declares that "YOU HAVE A DEV VER OF THIS ADD-ON INSTALLED" (or something to that effect) in the log file (I think it was the log file). If you know what I'm talking about, I'd appreciate if you could point me to it.
Alnivel
Dangerous
Dangerous
Posts: 100
Joined: Fri Jun 10, 2022 7:05 pm

Re: Scripters cove

Post by Alnivel »

Massively Locked wrote: Fri Nov 11, 2022 8:32 pm
I vaguely remember reading somewhere about some function/method/Jedi-mind-trick that boldly declares that "YOU HAVE A DEV VER OF THIS ADD-ON INSTALLED" (or something to that effect) in the log file (I think it was the log file). If you know what I'm talking about, I'd appreciate if you could point me to it.
Can it be OXPMessages.plist? Or are you looking for a way with JS?
User avatar
Massively Locked
Dangerous
Dangerous
Posts: 84
Joined: Tue Nov 20, 2012 12:20 pm

Re: Scripters cove

Post by Massively Locked »

Bingo- that was exactly it! Thank you!
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2685
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Scripters cove

Post by Redspear »

Hello. This is likely a simple question for somebody here...

I want to test if the player's scanner is empty or not. i.e. test whether anything else is within that range but WITHOUT using masslock as a check for the same.

player.ship.scannerRange with some sort of distance to nearest object test???
Alnivel
Dangerous
Dangerous
Posts: 100
Joined: Fri Jun 10, 2022 7:05 pm

Re: Scripters cove

Post by Alnivel »

Redspear wrote: Thu Dec 01, 2022 8:45 pm
Hello. This is likely a simple question for somebody here...

I want to test if the player's scanner is empty or not. i.e. test whether anything else is within that range but WITHOUT using masslock as a check for the same.

player.ship.scannerRange with some sort of distance to nearest object test???
How about system.filteredEntities?

Also, by player.ship.scannerRange, did you mean player.ship.checkScanner? If you need ships closer than the scanner range, the array of ships can be filtered using JS (filter method, or via loop and push ships that too far).
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2685
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Scripters cove

Post by Redspear »

Alnivel wrote: Thu Dec 01, 2022 9:47 pm
Also, by player.ship.scannerRange, did you mean player.ship.checkScanner?
Thanks. I'd missed that and so I was looking for a workaround...

Forgive me, I'm not really JavaScript literate, I just know a little slang...
How can I test if nothing is on the scanner?

In English rather than JavaScript, it would be:

Are there any lollipops on the player scanner right now?
If the answer is no then please do the following...


So I'm looking for a very simple true/false test rather than details.
I hope that makes sense.
User avatar
Massively Locked
Dangerous
Dangerous
Posts: 84
Joined: Tue Nov 20, 2012 12:20 pm

Re: Scripters cove

Post by Massively Locked »

Redspear wrote: Thu Dec 01, 2022 10:37 pm
Are there any lollipops on the player scanner right now?
If the answer is no then please do the following...


So I'm looking for a very simple true/false test rather than details.
Give this a shot:

Code: Select all

var shpsNear = player.ship.checkScanner ()
if (shpsNear.length === 0) {…}
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

Re: Scripters cove

Post by Reval »

ooh useful! - I believe I'll add that facility to ET. Seeing .length there, one assumes it's an array? So listing out shipsNear in a loop will presumably display all vessels and stations(?) within scanner range?
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2685
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Scripters cove

Post by Redspear »

Massively Locked wrote: Fri Dec 02, 2022 2:08 am
Give this a shot:

Code: Select all

var shpsNear = player.ship.checkScanner ()
if (shpsNear.length === 0) {…}
Will do. Thanks.
User avatar
Massively Locked
Dangerous
Dangerous
Posts: 84
Joined: Tue Nov 20, 2012 12:20 pm

Re: Scripters cove

Post by Massively Locked »

Reval wrote: Fri Dec 02, 2022 6:31 am
ooh useful! - I believe I'll add that facility to ET. Seeing .length there, one assumes it's an array? So listing out shipsNear in a loop will presumably display all vessels and stations(?) within scanner range?
Yep to both
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2685
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Scripters cove

Post by Redspear »

Massively Locked wrote: Fri Dec 02, 2022 2:08 am
Give this a shot:
It works - you're officially awesome :D
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

Re: Scripters cove

Post by Reval »

Question: is it possible to access a variable from another OXP's world-script?

If so, what is the syntax for doing this? (could someone perhaps give me an example?)
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2685
Joined: Thu Jun 20, 2013 10:22 pm
Location: On the moon Thought, orbiting the planet Ignorance.

Re: Scripters cove

Post by Redspear »

Reval wrote: Sat Dec 03, 2022 2:47 pm
Question: is it possible to access a variable from another OXP's world-script?

If so, what is the syntax for doing this? (could someone perhaps give me an example?)
If you haven't already, check out [EliteWiki] Variables in Oolite JavaScripts

Both global and (potentailly) mission variables could be of interest.
User avatar
Reval
---- E L I T E ----
---- E L I T E ----
Posts: 402
Joined: Thu Oct 29, 2020 3:14 am
Location: At home in the Xexedi Cluster, driving an FE Asp II, Laenina's Flux.

Re: Scripters cove

Post by Reval »

Oh many thanks Redspear - I hadn't even noticed that section!
Dor 'call me Grocer' Reval (a Xexedian Laver) was always considered a little backward.
Post Reply