ServerCmds
by Fredulus Ripplinger · in Torque Game Engine · 06/16/2008 (12:06 pm) · 6 replies
I got my start in scripting in Blockland. The first things I scripted were ServerCmds, used by typing (for example) /kill Bob. I tried to script a serverCmd in starter.fps. I made sure it got exec'd and everything, but it wouldn't work, so I just deleted it. My question is, are serverCmds activated with a / in TGE, or was that something specific to Blockland?
About the author
#2
06/16/2008 (7:56 pm)
Nah, it's fine, I just wondered if they were /'s.
#3
On the server
To then call that function on the client run:
Of course there is nothing to stop you adding things to the engine so that issuing a "/" doesn't run this commandtoserver function.
06/17/2008 (8:55 am)
Fredulus - ServerCmds are called by running the function CommandToServer() passing in the function name as a tagged parameter.. For example:On the server
function serverCmdDoSomethingNeat(%client, %param1, %param2)
{
...blah blah
}To then call that function on the client run:
CommandToServer('DoSomethingNeat', %param1, %param2);Of course there is nothing to stop you adding things to the engine so that issuing a "/" doesn't run this commandtoserver function.
#4
Wait, DOESN'T run this commandtoserver function? I want it to; now you've confused me. Let's use that code you put up. If I typed /dosomethingneat, would it run the serverCmd or not?
06/18/2008 (2:32 pm)
"Of course there is nothing to stop you adding things to the engine so that issuing a "/" doesn't run this commandtoserver function."Wait, DOESN'T run this commandtoserver function? I want it to; now you've confused me. Let's use that code you put up. If I typed /dosomethingneat, would it run the serverCmd or not?
#5
CommandToServer is simply a TorqueScript function that, when executed, will send a network event from a client to the server.
If you want to have this code run when the user types in a command, you will need to write the TorqueScript code to interpret the typed command(s), and execute the appropriate TorqueScript commands.
06/18/2008 (3:55 pm)
No, it will not.CommandToServer is simply a TorqueScript function that, when executed, will send a network event from a client to the server.
If you want to have this code run when the user types in a command, you will need to write the TorqueScript code to interpret the typed command(s), and execute the appropriate TorqueScript commands.
#6
Of course there is nothing to stop you adding things to the engine so that issuing a "/" does run this commandtoserver function.
06/20/2008 (8:21 am)
Sorry Fredulus I meant to have said:Of course there is nothing to stop you adding things to the engine so that issuing a "/" does run this commandtoserver function.
Torque 3D Owner Mark Dynna