System Data Config (for Oolite v1.85ff)

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

Moderators: winston, another_commander

Post Reply
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

System Data Config (for Oolite v1.85ff)

Post by phkb »

As part of a new feature in Oolite to allow OXP's to change the layout of the F7 screen, and even add their own information, I've created a small OXP that is designed to be a sort of traffic cop for OXP's, to help them determine what lines in the top section are free, and what lines are in use and by what OXP.

The OXP can be downloaded from here: SystemDataConfig.oxz (copy directly into your AddOns location) or SystemDataConfig.zip (extract the OXP folder to your AddOns location). Or you can download via the expansion pack manager.

There are a couple of functions OXP's can use:

worldScripts["oolite-system-data-config"].systemDataLineOwner(line_number) returns a string containing the current owner of a specific data line.

worldScripts["oolite-system-data-config"].systemDataLineText(line_number) returns the current content of a particular line.

worldScripts["oolite-system-data-config"].setSystemDataLine(line_number, text, owner) sets the owner and text of a particular data line.

worldScripts["oolite-system-data-config"].setSystemDataLine(line_number, text) just sets the text of a particular data line.

worldScripts["oolite-system-data-config"].resetSystemDataLine(line_number) resets the owner and text of a particular data line be blank.

Updating of information takes place as part of the guiScreenWillChange and infoSystemWillChange events. But it can be difficult to determine the order in which OXP's will fire. To streamline this, some callback functions have been added to allow OXP's to register their callbacks, so the SystemDataConfig can call each of them before it does an update.

worldScripts["oolite-system-data-config"].addChangeCallback(worldScriptName, callBackFunctionName) allows an OXP to register their callback function.

worldScripts["oolite-system-data-config"].removeChangeCallback(worldScriptName, callBackFunctionName) will remove a callback function from the list of callbacks.

When the callbacks are executed, they will be passed
  • The type of callback, either "guiSystemWillChange", or "infoSystemWillChange"
  • The "to" parameter from those events
  • The "from" parameter from those events
Let me know what you think, particularly if you think a different schema would be more appropriate.

For those who are interested, here is the code I used to create the screenshot in the Progress thread: CompressedF7Layout.oxz
Last edited by phkb on Tue Aug 01, 2017 4:14 am, edited 3 times in total.
User avatar
Day
---- E L I T E ----
---- E L I T E ----
Posts: 545
Joined: Tue Mar 03, 2015 11:35 am
Location: Paris

Re: System Data Config (for Oolite v1.85ff)

Post by Day »

Hi phkb,

very interesting indeed.

For my Diplomacy wip oxp, I have added some info on Taxation level and Treasury on the F7 screen:

Code: Select all

description += " Tax level: 10% Treasury: 10000 €";
Well, with the correct amounts, of course.

As the description is already long, it becomes longer, and not very beautiful to read.

It seems to me that the description is already long because some other oxps are already adding to it.

What would be the right way to do it?
I'm willing to do it the right way :)

Another point: this means that my oxp would always use one line in the F7 screen, if I understand well.
Is that acceptable? I mean, there are a lot of oxps, and not a lot of lines.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: System Data Config (for Oolite v1.85ff)

Post by phkb »

I don't know about a "right" way to do things - this OXP is just trying to make things fair and visible. But by having an "owner" of each line you can at least work out what positions are available for use. If there are none free you're left with the option of overriding another OXP's data (not recommended) or appending the info to the bottom part of the screen, as OXP's have been doing already.
User avatar
Day
---- E L I T E ----
---- E L I T E ----
Posts: 545
Joined: Tue Mar 03, 2015 11:35 am
Location: Paris

Re: System Data Config (for Oolite v1.85ff)

Post by Day »

Thank you, phkb.

I'll use it :D
User avatar
Milo
---- E L I T E ----
---- E L I T E ----
Posts: 462
Joined: Mon Sep 17, 2018 5:01 pm

Re: System Data Config (for Oolite v1.85ff)

Post by Milo »

After a misjump from a misjump, on accessing F6 screen and moving the cursor to an adjacent system. . .
gui screen will change from GUI_SCREEN_MAIN to GUI_SCREEN_SHORT_RANGE_CHART
gui screen changed from GUI_SCREEN_MAIN to GUI_SCREEN_SHORT_RANGE_CHART
info system will change from 37 to 250
Exception: TypeError: system.info.distanceToSystem(sys).tofixed is not a function
Active script: oolite-system-data-config 0.8
oolite-system-data-config.js, line 180:
data["distanceInfo"] = system.info.distanceToSystem(sys).tofixed(1) + " ly";
info system changed from 37 to 250
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: System Data Config (for Oolite v1.85ff)

Post by phkb »

Fixed in v0.9.
Post Reply