Game Development Community

Scope client from a gui

by mb · in Torque Game Engine Advanced · 07/19/2007 (11:39 pm) · 3 replies

This is probably a dumb question but I'm tired and need sleep so thanks in advance =) How can I scope the client in a gui? I have a GuiButtonCtrl and I'm sending a 'command = "myfunction(%myvar);";' and I wanna pass the %client as an arg like: 'command = "myfunction(%client, %myvar);";' .

Is there a built in scope for the client on the gui I'm not aware of? I tried %this, %player, %client .. they just send '1', and that isn't an object.

going to bed... :)


edit:

now that I'm awake I think I can just bring up the gui press the button then check who the client is on the server.

#1
07/20/2007 (9:29 am)
Are you wanting to access the client connection object from the Client side or Server side? If you're going to the server, just have your button use a CommandToServer, in which case the %client automatically gets passed as the first parameter. If you're on the client, I would first ask why you want the connection object, but if you really do need it then you can just reference it by name. In all the example scripts the object is called ServerConnection. So, unless you've renamed it, you can use that.
#2
07/20/2007 (11:02 am)
Thanks. I'll probably use the commandToServer as it passes the client automactically. I have a button to build an object and I need to check which team a player is on and then check a variable to see if that team can build or not. It should be easy, but I was falling asleep at my desk last night.
#3
07/20/2007 (2:25 pm)
Definitely sounds like a commandToServer situation to me, mb.