local planetinfo overrides
Moderators: winston, another_commander
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
local planetinfo overrides
Generally, how to amend information on the F7 screen, but prevent Oolite from storing the amendments in the local_planetinfo_overrides section of the player's saved game?
Specifically, for Explorers' Club, how to check the system displayed on the F7 screen against the array of visited systems, and append either "You have visited this system before." or "You have never visited this system." to the displayed systeminfo description, without that change being permanently added to local planetinfo overrides?
Any suggestions would be much appreciated.
Specifically, for Explorers' Club, how to check the system displayed on the F7 screen against the array of visited systems, and append either "You have visited this system before." or "You have never visited this system." to the displayed systeminfo description, without that change being permanently added to local planetinfo overrides?
Any suggestions would be much appreciated.
- Capt. Murphy
- Commodore
- Posts: 1127
- Joined: Fri Feb 25, 2011 8:46 am
- Location: UK South Coast.
Re: local planetinfo overrides
Wildeblood - I have an untested idea as to how this could be achieved. The check could be done as the player enters the f7 screen, the text added if appropriate, and then removed again as the player exits the screen.
Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
Re: local planetinfo overrides
If you use the same methods the native Oolite missions use you won't be too far wrong: mission.addMessageText() & mission.addMessageTextKey() were created specifically to add on-the-fly info to gui screens...
Have a look inside oolite-constrictor-hunt-mission.js, inside the .guiScreenChanged event handler to see the TextKey variant 'in action' on the system data screen!
Have a look inside oolite-constrictor-hunt-mission.js, inside the .guiScreenChanged event handler to see the TextKey variant 'in action' on the system data screen!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: local planetinfo overrides
I assumed they only worked on the manifest screen, that's where everyone seems to use them. But look here, it's a bit gawdy on the system data screen, it changes the text colour from green to yellow.Kaks wrote:If you use the same methods the native Oolite missions use you won't be too far wrong: mission.addMessageText() & mission.addMessageTextKey() were created specifically to add on-the-fly info to gui screens...
I think backing up the description to some obviously named variable like this.system_description_backup on entering the F7 screen, then restoring it as you leave that screen would be a bit swisher.
Now, back to the subject of local planetinfo overrides, where can I read the documentation? I seem to have broken it.
I have saved games with lots of stuff in there, but it doesn't show up in game. I assumed a misplaced pointy bracket, so when I loaded and re-saved one I expected to see the local_planetinfo_overrides section flushed. But no, it's all still in there. So I'm thinking there's a limit to how much can be stored in there, and I've gone over the limit so the game is just ignoring it all?
- Capt. Murphy
- Commodore
- Posts: 1127
- Joined: Fri Feb 25, 2011 8:46 am
- Location: UK South Coast.
Re: local planetinfo overrides
Just a note thatKaks wrote:If you use the same methods the native Oolite missions use you won't be too far wrong: mission.addMessageText() & mission.addMessageTextKey() were created specifically to add on-the-fly info to gui screens...
Have a look inside oolite-constrictor-hunt-mission.js, inside the .guiScreenChanged event handler to see the TextKey variant 'in action' on the system data screen!
mission.addMessageText()
needs to be documented on the wiki... Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: local planetinfo overrides
You probably meanCapt. Murphy wrote:Just a note thatmission.addMessageText()
needs to be documented on the wiki...
mission.addMessageTextKey()
from Kaks remark? But there he was mixing things up as that method does not exists. mission.addMessageText()
can be found on the Mission page.But, I now added a comment that it works on non-missionscreens as well.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
Re: local planetinfo overrides
Nope, mission.addMessageTextKey() does exist, and can be tested using the js console. However, it's defined inside oolite-global-prefix.js rather than next to .addMessageText() (not exactly sure why, but the big A might be able to tell us).
Maybe we should have an extra comment inside OOJSMission.m as a quick reminder...
Maybe we should have an extra comment inside OOJSMission.m as a quick reminder...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Re: local planetinfo overrides
Because native callbacks are fiddly, error-prone and hard to maintain, and there’s no significant disadvantage to implementing it in the prefix. This is the motivation for the various other convenience wrappers defined there, too.Kaks wrote:Nope, mission.addMessageTextKey() does exist, and can be tested using the js console. However, it's defined inside oolite-global-prefix.js rather than next to .addMessageText() (not exactly sure why, but the big A might be able to tell us).
(My basic position is/was that anything that can be implemented in JS without a significant performance hit should be. For example, I evaluated implementing all vector and quaternion operations in JS, but it turned out that building JS vector objects from C using slots for the fields was significantly more expensive than sticking a malloced struct in the private field, and doing maths in JS using the private-field approach was significantly more expensive than using slots. This could of course change with future versions of SpiderMonkey.)
E-mail: [email protected]
Re: local planetinfo overrides
Aha, I knew there was a reason!
Thanks, Ahruman!
Thanks, Ahruman!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
Re: local planetinfo overrides
Here!Wildeblood wrote:Now, back to the subject of local planetinfo overrides, where can I read the documentation? I seem to have broken it.
I have saved games with lots of stuff in there, but it doesn't show up in game. I assumed a misplaced pointy bracket, so when I loaded and re-saved one I expected to see the local_planetinfo_overrides section flushed. But no, it's all still in there. So I'm thinking there's a limit to how much can be stored in there, and I've gone over the limit so the game is just ignoring it all?
When loading a savegame, the overrides inside the savegame are superimposed to all the overrides in all planetinfo.plists.
When changing a system's value - via javascript or legacy scripting - the overrides are updated immediately.
When retrieving any system data Oolite does the following:
- it generates the pseudo-random data
- it looks for all possible overrides, and uses the overridden data if present.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)