Game Development Community

Passing variables through guis

by Justin Mosiman · in Torque Game Engine · 09/22/2007 (12:15 pm) · 2 replies

Hello,

Is it possible to pass a variable from gui to gui without making it global? On my main menu gui I have a button to join a lobby and another to create a game. But before the user gets to that screen I want them to login, so I have created a login dialog. What I want to do is to pass a variable to the login dialog that indicates where the user is going next, such as the lobby. I want to do this so I don't have to create two different login dialogs, one for each of the next destination after they click login.

Hopefully that makes sense.

Thank you,
Justin

#1
09/22/2007 (12:20 pm)
I couldn't understand why u dont want to make it a global variable ? plz explain more abt that !!
#2
09/22/2007 (12:27 pm)
Just assign the variable to the namespace of your LoginScreen.. eg:

function CreateGame::onMouseUp(%this)
{
    LoginGui.nextScreen = CreateGameGui;
.....
}

function JoinGame::onMouseUp(%this)
{
    LoginGui.nextScreen = JoinGameGui;
......
}

But the way most games do it is you login first, then you have the option to join or create a game.