So I have an issue, where I have a command that opens up two separate GUI windows, both modeless so that players can interact with both at the same time. One of them is the 'player inventory' GUI that shows all the player's current items, and another is a backpack window where (eventually) they'll be able to deposit their excess items into.
I have it set up so that the close commands on the backpack window call this function:
clientCmdOpen_BQSmallRuckSackGUI(%client,1);
Which is declared like this:
//wrapper function that first builds the player inventory GUI and then shows it
function renderPlayerInventory(%client) {
commandToServer('buildPlayerInventory',%client);
canvas.pushDialog(BQPlyrInvGUI);
}
//handles opening and closing of the inventory GUI.
function clientCmdOpen_BQSmallRuckSackGUI(%client,%toggle)
{
if(%toggle)
{
if(BQSmallRuckSackGUI.isAwake())
{
//closes GUIs
canvas.popDialog(BQSmallRuckSackGUI);
canvas.popDialog(BQPlyrInvGUI);
return true;
}
else
{
//opens GUIs
if(!BQPlyrInvGUI.isAwake())
{
renderPlayerInventory(%client);
}
canvas.pushDialog(BQSmallRuckSackGUI);
return true;
}
}
}
The only problem is that when I press the exit button (either the actual exit button on the GUI, or my accelerator key 'escape') after interacting with some of the buttons, my game crashes immediately. Trace(1); doesn't seem to have any helpful input either when I run it during the error.
Is calling close on a window not allowed if you do so through a function? Or is the problem just the fact that I'm doing so on two windows at once? Changing the closing command on my window from what's written above to 'canvas.popDialog(BQSmallRuckSackGUI);' seems to work fine and does not crash my game, so I'm certain that the Open_BQSmallRuckSackGUI() function is the problem.
Is this some kind of known issue, or have I just screwed something up and broken the game?