Re: Scripters cove
Posted: Fri Jan 31, 2025 10:11 am
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.Phasted wrote: ↑Fri Jan 31, 2025 7:28 amI'm reluctant to do it, but here's what I'm thinking:
I can then refer to that script from any other script... as can anyone else from any script in any OXP...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;
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?
You don't need a global object for that, just use a normal world script:-
Code: Select all
worldScripts.marketDefs.RLE.CleverlyNamedProperty = this;