Page 2 of 2
Re: OXP to Debug Console communication
Posted: Tue Jan 25, 2022 6:30 am
by hiran
phkb wrote: ↑Tue Jan 25, 2022 5:09 am
hiran wrote: ↑Thu Dec 23, 2021 11:25 am
So how could I install an OXP automatically? How would OoliteCommunicator find the Addons folder at runtime to inject the OXP just before Oolite gets started? Or can I do such stunts via the debug console?
There is currently no JS interface to disable or enable an OXP, unless the OXP gives you one itself. I've done this in a couple of mine - having a $disabled flag or some such to quickly turn things on or off. So, if you're looking for a way to harmonise two player's game worlds, the facilities aren't currently available to do this programmatically. You might be stuck with some manual intervention, I'm afraid.
However, you can check to see if an OXP is installed using
worldScripts
or
worldScriptNames
.
This would at least allow at runtime to check if preconditions are met. My intention was to make it dead easy for users to run my addon.
Thank you for the response anyway.
Re: OXP to Debug Console communication
Posted: Tue Jan 25, 2022 7:28 am
by another_commander
You can get a list of installed OXPs using oolite.resourcePaths
. You can then parse this string to check if a particular OXP is included or not.
Re: OXP to Debug Console communication
Posted: Tue Jan 25, 2022 8:36 am
by montana05
phkb wrote: ↑Tue Jan 25, 2022 5:09 am
However, you can check to see if an OXP is installed using worldScripts
or worldScriptNames
.
I might be wrong, but as much as I remember, there are multiple OXP's without a worldScript.
Re: OXP to Debug Console communication
Posted: Tue Jan 25, 2022 9:31 am
by phkb
montana05 wrote: ↑Tue Jan 25, 2022 8:36 am
phkb wrote: ↑Tue Jan 25, 2022 5:09 am
However, you can check to see if an OXP is installed using worldScripts
or worldScriptNames
.
I might be wrong, but as much as I remember, there are multiple OXP's without a worldScript.
So a_c’s advice is probably better then - use
Oolite.resourcePaths
.
Re: OXP to Debug Console communication
Posted: Tue Jan 25, 2022 6:25 pm
by hiran
phkb wrote: ↑Tue Jan 25, 2022 9:31 am
montana05 wrote: ↑Tue Jan 25, 2022 8:36 am
phkb wrote: ↑Tue Jan 25, 2022 5:09 am
However, you can check to see if an OXP is installed using worldScripts
or worldScriptNames
.
I might be wrong, but as much as I remember, there are multiple OXP's without a worldScript.
So a_c’s advice is probably better then - use
Oolite.resourcePaths
.
Yes, I am aware of resource paths. However that at most tells me the directory to search in, and I'd still have to check what version that OXP is.
I was hoping for more but that does not exist.
montana05 wrote: ↑Tue Jan 25, 2022 8:36 am
phkb wrote: ↑Tue Jan 25, 2022 5:09 am
However, you can check to see if an OXP is installed using worldScripts
or worldScriptNames
.
I might be wrong, but as much as I remember, there are multiple OXP's without a worldScript.
You are dead right there. On the other hand it is not an issue as I would not be checking for any OXP but for the one I wrote - and that one has a world script. So if it is missing I would know and have to act by injecting it into one of the AddOns folders. If it exists I would know where it is and could check the version, upgrading it if necessary. All this 'I would' obviously carried out by the OoliteCommunicator - or the new name
Nexus.