Page 119 of 119
Re: Scripters cove
Posted: Fri Jan 31, 2025 10:11 am
by Wildeblood
Phasted wrote: ↑Fri Jan 31, 2025 7:28 am
Phasted wrote: ↑Tue Jan 21, 2025 8:27 pm
I'd like to avoid tossing any garbage into the global space if it's at all possible...
I'm reluctant to do it, but here's what I'm thinking:
Code: Select all
// ...in the worldScript (outside of any function...)
if(!OXP){var OXP = {};} // creates an "OXP" object in the global space
OXP.JEM = {}; // A "JEM" object as a property of "OXP", claiming a chunk of the OXP object for myself (JEM -- my initials).
OXP.JEM.RLE = {}; // An "RLE" object to provide a home for everything "Real-life Economics"-related...
// ... then in the market script (or whatever other script to which I need a reference)
OXP.JEM.RLE.someCleverlyNamedProperty = this;
I can then refer to that script from any other script... as can anyone else from any script in any OXP...
Anybody else who wants a piece of the action can attach their own JEM-equivalent object to "OXP" and have at it!
One little object in the global space isn't really such a big deal, right?
But that depends on doing stuff from the market script; you asked if you could access market scripts from world scripts, not whether you could access world scripts from market scripts.
You don't need a global object for that, just use a normal world script:-
Code: Select all
worldScripts.marketDefs.RLE.CleverlyNamedProperty = this;
Re: Scripters cove
Posted: Fri Jan 31, 2025 7:04 pm
by Phasted
Wildeblood wrote: ↑Fri Jan 31, 2025 10:11 am
Phasted wrote: ↑Fri Jan 31, 2025 7:28 am
Phasted wrote: ↑Tue Jan 21, 2025 8:27 pm
I'd like to avoid tossing any garbage into the global space if it's at all possible...
You don't need a global object for that, just use a normal world script:-
Code: Select all
worldScripts.marketDefs.RLE.CleverlyNamedProperty = this;
I can put that line in the market script and then address that market script as:
Code: Select all
worldScripts.marketDefs.RLE.CleverlyNamedProperty
I didn't know worldScripts could be used that way... I thought the only properties of worldScripts were the this.name properties of the loaded world scripts...
Re: Scripters cove
Posted: Mon Mar 17, 2025 7:59 am
by phkb
Wildeblood wrote: ↑Wed Jan 29, 2025 7:05 pm
Phasted has asked if something can be done, and I've answered honestly that I believe not, but would be pleased if I were wrong.
You're correct.
Phasted wrote: ↑Tue Jan 21, 2025 8:27 pm
I'm wracking my brains and coming up empty...
In case you end up trying to re-invent the wheel:
Market Script Interface
Re: Scripters cove
Posted: Tue Mar 18, 2025 7:10 am
by Redspear
I'd like to mimic the energy bomb behaviour of the zx spectrum version of elite.
In that incarnation, the Thargoids were (almost) immune to the device whereas any Thargons (or other ships for that matter) would be destroyed.
So I'm looking to extend the same immunity that the player has (upon launching the device) to any Thargoids (but not their drones) within range.
Anyone know a simple method to achieve same?
I can't access the oxp right now to poke around but from memory it wasn't something I knew how to do.
Re: Scripters cove
Posted: Sat Apr 12, 2025 2:02 am
by Wildeblood
Wildeblood wrote: ↑Mon Aug 05, 2024 7:24 pm
I'm still having fun with screen backgrounds, and my next question is, can I switch off the rotating planet model on the F7 screen?
phkb wrote: ↑Mon Aug 19, 2024 12:06 am
Not easily. I experimented with forcing the system to be a nova system (just temporarily), which would then allow you to manipulate the "system_data_nova" screen backgrounds id, but that was a bust. The nova settings for a system are read-only...
Wildeblood wrote: ↑Mon Aug 19, 2024 7:58 am
Methinks, you do like to do things the hard way. If there's no "official" way to switch off the planet model, I would have tried experimenting with the planet's texture, attempting to make it transparent, or the planet's radius, trying to make it imperceptibly small, before I thought to mess about with the nova settings. Have you ever tried those approaches?
So, anyway... it turns out that setting
radius: null
completely suppresses the planet's image on F7, and doesn't leave any rude messages in Latest.log.
Re: Scripters cove
Posted: Sat Apr 12, 2025 2:05 am
by phkb
Hey, that's good to know. And easier than this method:

(which I can't reproduce anyway, but you know, something interesting I saw on the way to the station one time).
Re: Scripters cove
Posted: Mon Apr 14, 2025 10:18 pm
by Cholmondely
Wildeblood wrote: ↑Sat Apr 12, 2025 2:02 am
So, anyway... it turns out that setting radius: null
completely suppresses the planet's image on F7, and doesn't leave any rude messages in Latest.log.
Sorry, this is in the Planetinfo.plist?
Re: Scripters cove
Posted: Tue Apr 15, 2025 1:59 am
by Wildeblood
Cholmondely wrote: ↑Mon Apr 14, 2025 10:18 pm
Wildeblood wrote: ↑Sat Apr 12, 2025 2:02 am
So, anyway... it turns out that setting radius: null
completely suppresses the planet's image on F7, and doesn't leave any rude messages in Latest.log.
Sorry, this is in the Planetinfo.plist?
No, from javascript. When one wants to supress the planet model on F7, to show an image of Wildeblood manor instead. Definitely don't try doing it from planetinfo.plist.
The transparent effect pictured above is likely from a mis-named texture file, and would have left an irate message in Latest.log.
Re: Scripters cove
Posted: Tue Apr 15, 2025 2:26 am
by phkb
Actually there was nothing in the log file. When I launched from the station, the planet was visible. As I got closer, however, it just vanished.
I suspect Thargoids stole it.
Or possibly I was running out of memory.
Re: Scripters cove
Posted: Tue Apr 15, 2025 5:38 pm
by Wildeblood
Wildeblood wrote: ↑Sat Apr 12, 2025 2:02 am
So, anyway... it turns out that setting radius: null
completely suppresses the planet's image on F7, and doesn't leave any rude messages in Latest.log.
And... I cannot reproduce this today. I swear, I did it several times yesterday to confirm what I was seeing, before I posted that message. But today, nah-uh.
Addendum: I think I know what's happening. BRB.
Added addendum: It does work. I have an error elsewhere in my scripts, they are immediately undoing the setting again.
P.P.P.S. Turns out it only works from the console, or from a save-file, and was some kind of weirdness with the null evaluating to zero somewhere in the process. It does not work from a script.
P.P.P.P.S. Good news! My first instinct, that I intimated here months ago, was right! To suppress the planet image, just set its radius to zero. Then later use null to unset the zero and get back the normal image.

Re: Scripters cove
Posted: Wed Apr 16, 2025 3:13 am
by Wildeblood
Cholmondely wrote: ↑Mon Apr 14, 2025 10:18 pm
Sorry, this is in the Planetinfo.plist?
Here you go, working example:
https://wiki.alioth.net/index.php/File: ... _Manor.oxz
I look forward to seeing an illustration of Cousin Digby's pile on Digebiti.
Re: Scripters cove
Posted: Thu Apr 17, 2025 11:40 pm
by Wildeblood
I'm searching through previous discussions of planetinfo and I came across this query, so better late than never, I'll chip in another two cents.
Redspear wrote: ↑Mon Dec 05, 2022 3:54 pm
Code: Select all
if (System.infoForSystem(galaxyNumber, player.ship.targetSystem).ID < 86) {
...first code thing
}
else {
if (System.infoForSystem(galaxyNumber, player.ship.targetSystem).ID < 171) {
...second
}
else {
...third
}
}
Another cry for help...
Only the third of these options is ever firing.
Lave, for example, is ID #7 and so should trigger the first but it triggers the third instead

It works if I swap ID for economy for example (with different numbers of course).
That it triggers at all suggest that my use of '.ID' is ok but why no discrimination upon calling the value (of ID)?
Any advice please?
Alnivel gave this reply, which correctly explains the problem, but not the solution:
Alnivel wrote: ↑Mon Dec 05, 2022 4:38 pm
System.infoForSystem
returns a dictionary from planetinfo.plist
, not a System
object. The dictionary does not have an ID
property, so the result is undefined
. Is undefined
lesser than 86? JS thinks not. Is undefined
lesser than 171? Same, so the third branch is being executed.
He then gave the practical solution to the problem Redspear was having, which is this:
Alnivel wrote: ↑Mon Dec 05, 2022 4:38 pm
Why are you even trying to get an ID through the system information if you already have one? You can just use it like this:
Code: Select all
if (player.ship.targetSystem < 86) {
...first code thing
}
else {
if (player.ship.targetSystem < 171) {
...second
}
else {
...third
}
}
But he didn't actually answer Redspear's question, of why
System.infoForSystem(galaxyNumber, player.ship.targetSystem).ID
was undefined. The answer is, the property sought is actually found here:
System.infoForSystem(galaxyNumber, player.ship.targetSystem).systemID
Re: Scripters cove
Posted: Fri Apr 18, 2025 7:11 am
by Redspear
Wildeblood wrote: ↑Thu Apr 17, 2025 11:40 pm
the property sought is actually found here:
System.infoForSystem(galaxyNumber, player.ship.targetSystem).systemID
Thanks Wildeblood.
I might be updating that oxp soon, so definitely better late than never.