local planetinfo overrides

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

local planetinfo overrides

Post by Wildeblood »

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.
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: local planetinfo overrides

Post by Capt. Murphy »

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.
[EliteWiki] 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
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: local planetinfo overrides

Post by Kaks »

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! :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Wildeblood
---- E L I T E ----
---- E L I T E ----
Posts: 2453
Joined: Sat Jun 11, 2011 6:07 am
Location: Western Australia
Contact:

Re: local planetinfo overrides

Post by Wildeblood »

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 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.

Image

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?
User avatar
Capt. Murphy
Commodore
Commodore
Posts: 1127
Joined: Fri Feb 25, 2011 8:46 am
Location: UK South Coast.

Re: local planetinfo overrides

Post by Capt. Murphy »

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...

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! :)
Just a note that mission.addMessageText() needs to be documented on the wiki... :wink:
[EliteWiki] 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
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: local planetinfo overrides

Post by Eric Walch »

Capt. Murphy wrote:
Just a note that mission.addMessageText() needs to be documented on the wiki... :wink:
You probably mean 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. :)
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: local planetinfo overrides

Post by Kaks »

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... ;)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: local planetinfo overrides

Post by JensAyton »

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).
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.

(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.)
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: local planetinfo overrides

Post by Kaks »

Aha, I knew there was a reason! :D

Thanks, Ahruman! :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Re: local planetinfo overrides

Post by Kaks »

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?
[EliteWiki] Here!

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.
There's no limit to the override data that can be stored inside either planetinfo.plist, or the savegame. If you want, you could PM me the savegame(s) in question, and I can try & figure out what's going on... :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
Post Reply