Game Development Community

Using commandToServer()

by Jim McLuckie · in Torque Game Engine · 02/16/2002 (1:22 pm) · 3 replies

Sorry for the bunch of newbie questions, but I'm a-learnin'...the commandToServer function is kind of confusing to me...I mean, I understand it's telling the server to do something for that specific client, but where does it specify what to do for a certain command? I'm looking through the Tribes 2 scripts, and I'll use 2 examples of 2 different types of calls...

commandToServer('throwPack');
commandToServer( 'cycleWeapon', "next" );

Where is the behavior defined for throwPack and cycleWeapon? I'm sure that "next" is the argument which tells it how to cycleWeapon. How would I go about defining my own command, such as commandToServer('dropAmmo'); or something?

#1
02/16/2002 (1:57 pm)
commandToServer('throwPack');
would call
function serverCmdthrowpack()


commandToServer( 'cycleWeapon', "next" );
would call
function serverCmdcycleWeapon()
with the parameter next

These are usually found in Command.cs

hope that helps
#2
02/16/2002 (2:36 pm)
Technically it would be like this:

function serverCmdthrowPack(%client)

function serverCmdcycleWeapon(%client, %data)

The client param is important if you want to do something for the client.

-Tim aka Spock
#3
02/16/2002 (3:15 pm)
Ah hah...that clears everything up. Thanks a lot guys :)