Page 1 of 1

Gui events

Posted: Sun Nov 15, 2009 4:16 pm
by Rustybolts
Can i run some code if when docked with main station player opens shipyard gui or opens commodities gui e.t.c
T.Y for any help.

Posted: Sun Nov 15, 2009 4:25 pm
by another_commander
You can. The handler is

Code: Select all

this.guiScreenChanged = function(to, from)
{
    ... your code here ...
}
where to and from hold the string description of the screen we got to and the screen we came from, like GUI_SCREEN_SYSTEM_DATA, GUI_SCREEN_STATUS etc.

Posted: Sun Nov 15, 2009 4:31 pm
by Rustybolts
Ty I thought it was this command. Is there a list of each of these screens somewhere or are they all called the same as they are labled inside the game when playing?

Posted: Sun Nov 15, 2009 4:38 pm
by another_commander
Rustybolts wrote:
Ty I thought it was this command. Is there a list of each of these screens somewhere or are they all called the same as they are labled inside the game when playing?
It is the same as in the game. Here is the complete list of GUI_SCREENs:

Code: Select all

   GUI_SCREEN_MAIN,
	GUI_SCREEN_INTRO1,
	GUI_SCREEN_INTRO2,
	GUI_SCREEN_STATUS,
	GUI_SCREEN_MANIFEST,
	GUI_SCREEN_EQUIP_SHIP,
	GUI_SCREEN_SHIPYARD,
	GUI_SCREEN_LONG_RANGE_CHART,
	GUI_SCREEN_SHORT_RANGE_CHART,
	GUI_SCREEN_SYSTEM_DATA,
	GUI_SCREEN_MARKET,
	GUI_SCREEN_CONTRACTS,
	GUI_SCREEN_OPTIONS,
	GUI_SCREEN_GAMEOPTIONS,
	GUI_SCREEN_LOAD,
	GUI_SCREEN_SAVE,
	GUI_SCREEN_SAVE_OVERWRITE,
	GUI_SCREEN_STICKMAPPER,
	GUI_SCREEN_MISSION,
	GUI_SCREEN_REPORT

Posted: Sun Nov 15, 2009 4:46 pm
by Rustybolts
Much apreciated ty
:D

Posted: Sun Nov 15, 2009 7:21 pm
by Eric Walch
another_commander wrote:
You can. The handler is

Code: Select all

this.guiScreenChanged = function(to, from)
{
    ... your code here ...
}
where to and from hold the string description of the screen we got to and the screen we came from, like GUI_SCREEN_SYSTEM_DATA, GUI_SCREEN_STATUS etc.
One warning though; Your code still has to double check if the "to" screen is the current screen as another oxp could have used that same handler for switching screens. (e.g. there could have been a launch() instruction by an other oxp)

Posted: Sun Nov 15, 2009 11:06 pm
by Rustybolts
If i run a mission screen from one of these is it possible after the mission screen has completed to return directly to the gui screen i have overided?

Posted: Mon Nov 16, 2009 8:52 am
by Commander McLane
Rustybolts wrote:
If i run a mission screen from one of these is it possible after the mission screen has completed to return directly to the gui screen i have overided?
I don't think we have a general setGUIScreen method, so the answer would be no.

Posted: Mon Nov 16, 2009 4:49 pm
by Rustybolts
Not what i wanted to hear. Oh well that pisses on my fire.
T.y for help