Page 110 of 118

Re: Scripters cove

Posted: Sun Oct 23, 2022 10:27 pm
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";

Re: Scripters cove

Posted: Fri Nov 11, 2022 8:32 pm
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.

Re: Scripters cove

Posted: Sat Nov 12, 2022 9:04 am
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?

Re: Scripters cove

Posted: Sat Nov 12, 2022 12:58 pm
by Massively Locked
Bingo- that was exactly it! Thank you!

Re: Scripters cove

Posted: Thu Dec 01, 2022 8:45 pm
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???

Re: Scripters cove

Posted: Thu Dec 01, 2022 9:47 pm
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).

Re: Scripters cove

Posted: Thu Dec 01, 2022 10:37 pm
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.

Re: Scripters cove

Posted: Fri Dec 02, 2022 2:08 am
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) {…}

Re: Scripters cove

Posted: Fri Dec 02, 2022 6:31 am
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?

Re: Scripters cove

Posted: Fri Dec 02, 2022 8:02 am
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.

Re: Scripters cove

Posted: Fri Dec 02, 2022 3:35 pm
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

Re: Scripters cove

Posted: Fri Dec 02, 2022 10:26 pm
by Redspear
Massively Locked wrote: Fri Dec 02, 2022 2:08 am
Give this a shot:
It works - you're officially awesome :D

Re: Scripters cove

Posted: Sat Dec 03, 2022 2:47 pm
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?)

Re: Scripters cove

Posted: Sat Dec 03, 2022 3:01 pm
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.

Re: Scripters cove

Posted: Sat Dec 03, 2022 3:22 pm
by Reval
Oh many thanks Redspear - I hadn't even noticed that section!