Oolite Bulletins

For information and discussion about Oolite.
It is currently Thu Sep 21, 2017 1:59 pm

All times are UTC




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sat May 27, 2017 12:36 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1706
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
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

_________________
My OXP's


Last edited by phkb on Tue Aug 01, 2017 4:14 am, edited 3 times in total.

Top
   
PostPosted: Sat May 27, 2017 5:02 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Tue Mar 03, 2015 11:35 am
Posts: 482
Location: Paris
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:
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.


Top
   
PostPosted: Sun May 28, 2017 1:13 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1706
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
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.

_________________
My OXP's


Top
   
PostPosted: Sun May 28, 2017 9:06 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Tue Mar 03, 2015 11:35 am
Posts: 482
Location: Paris
Thank you, phkb.

I'll use it :D


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider] and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited