Get Client Who Used Input?
by Steve Acaster · in Torque 3D Professional · 07/24/2011 (3:12 pm) · 4 replies
Have managed to confuse myself ... again ...
I want to get the ClientID of who "pressed a button/caused an input" of a default.binds function.
I can't use localClientConnection because it's solely for Client Local To Server and thus not networked ... and I can't use client.player because It's not appropriate for what I'm doing. The controlObject is the Client's camera.
I was thinking of using the ClientGroup ... but surely that would just give me a for each Client, rather than the Client which activated the input.
... and then I baffled myself ...
I'm probably just missing something obvious (or equally likely forgot something).
I want to get the ClientID of who "pressed a button/caused an input" of a default.binds function.
I can't use localClientConnection because it's solely for Client Local To Server and thus not networked ... and I can't use client.player because It's not appropriate for what I'm doing. The controlObject is the Client's camera.
I was thinking of using the ClientGroup ... but surely that would just give me a for each Client, rather than the Client which activated the input.
... and then I baffled myself ...
function myInput(%val)
{
//get client who pressed here <---------
if(%val > 0)
{
//science goes here
}
else
{
//science goes here
}
}
moveMap.bind( mouse, zaxis, myInput );I'm probably just missing something obvious (or equally likely forgot something).
About the author
One Bloke ... In His Bedroom ... Making Indie Games ...
#2
I actually had a function to do this exact thing, but it's on my other HD at the moment. The rough approximation(from what I can remember) would be either ServerConnection.getControlObject(), or LocalClientConnection.getControlObject().
If I get a chance, I'll pull the backup HD out and snag that code and post it up for you.
07/24/2011 (4:07 pm)
Hey Steve,I actually had a function to do this exact thing, but it's on my other HD at the moment. The rough approximation(from what I can remember) would be either ServerConnection.getControlObject(), or LocalClientConnection.getControlObject().
If I get a chance, I'll pull the backup HD out and snag that code and post it up for you.
#3
07/24/2011 (4:13 pm)
moveMap.bind( mouse, zaxis, "commandToServer(\'myInput\');", "");
function ServerCmdmyInput(%client)
{
...
}
#4
I said "probably obvious" ... ffs ...
Thanks for the brain jolt, cheers.
07/24/2011 (6:17 pm)
This is dumb, I was already using a serverCmd inside the function ... could've just got the client from there couldn't I?I said "probably obvious" ... ffs ...
Thanks for the brain jolt, cheers.
Torque Owner Dennis Trevillyan
WatreGames