I usually have an initialization action for the window and a record object type for the window components I want to track. The code below isn't perfect, I think you can actually call a trigger to see if a dialog is showing or not so the bool showing probably not needed. Please let me know if this helps or not. Here's an example window of mine:
initScoreboardOptions:ActionReturnType:(None)ParametersplayerIndex<Integer>GrammarText:initScoreboard(playerIndex)HintText:(None)CustomScriptCodeLocalVariablesi=0<Integer>Actions-------CreateUI-maindialogDialog-CreateaModaldialogofsize(348,220)at(0,150)relativetoTopLeftofscreenVariable-Setg_userData[playerIndex].scoreBoard.dialog = (Last created dialog)
------- Create UI - scoreboard header
Dialog - Create a Label for dialog (Last created dialog)
Dialog - Set (Last created dialog item) text to (Text "Player" with color (100%, 100%, 100%)) for (All players)
Dialog - Set (Last created dialog item) size to (120, 20) for (All players)
Dialog - Move (Last created dialog item) to (SCOREBOARD_ENTRY_NAME_X_OFF, (scoreboardEntryYOffset(0))) relative to Top Left of dialog for (All players)
Dialog - Create a Label for dialog (Last created dialog)
Dialog - Set (Last created dialog item) text to (Text "Power Level" with color (100%, 100%, 100%)) for (All players)
Dialog - Set (Last created dialog item) size to (120, 20) for (All players)
Dialog - Move (Last created dialog item) to (SCOREBOARD_ENTRY_SCORE_X_OFF, (scoreboardEntryYOffset(0))) relative to Top Left of dialog for (All players)
------- Create UI - scoreboard entries
TOGGLE SCOREBOARD SHOWING / HIDING
toggleScoreboardOptions:ActionReturnType:(None)ParametersplayerIndex<Integer>GrammarText:toggleScoreboard(playerIndex)HintText:(None)CustomScriptCodeLocalVariablesplayer=(Playergroup(playerIndex))<PlayerGroup>ActionsGeneral-Switch(Actions)dependingong_userData[playerIndex].scoreBoard.showing
Cases
General - If (false)
Actions
Dialog - Show g_userData[playerIndex].scoreBoard.dialog for player
Dialog - Show g_userData[playerIndex].scoreBoard.collapseIcon for player
Dialog - Hide g_userData[playerIndex].scoreBoard.expandIcon for player
Dialog - Set g_userData[playerIndex].scoreBoard.toggleBtn tooltip to "Collapse Ranking" for (All players)
General - If (true)
Actions
Dialog - Hide g_userData[playerIndex].scoreBoard.dialog for player
Dialog - Hide g_userData[playerIndex].scoreBoard.collapseIcon for player
Dialog - Show g_userData[playerIndex].scoreBoard.expandIcon for player
Dialog - Set g_userData[playerIndex].scoreBoard.toggleBtn tooltip to "Expand Ranking" for (All players)
Default
Variable - Set g_userData[playerIndex].scoreBoard.showing = (Not (g_userData[playerIndex].scoreBoard.showing))
@Kitadol: Go
I usually have an initialization action for the window and a record object type for the window components I want to track. The code below isn't perfect, I think you can actually call a trigger to see if a dialog is showing or not so the bool showing probably not needed. Please let me know if this helps or not. Here's an example window of mine:
TRIGGER FOR HANDLING TOGGLE SHOW / HIDE BUTTON:
DIALOG RECORD
INIT SCOREBOARD RECORD
TOGGLE SCOREBOARD SHOWING / HIDING