Game Development Community

Return value from server side script function

by MK · in Torque Game Engine · 05/30/2002 (10:55 am) · 1 replies

Is it possible to get a return value from a server script function called via CommandToServer?

#1
05/30/2002 (3:21 pm)
Hi

I think the only way to do this is to split your function into three parts.

-- CLIENT --
function anyFunction(%value)
{
   commandToServer("anyFunction", %value);
}

-- SERVER --
function serverCmdAnyFunction(%client, %value)
{
   %returnValue= %value * %value;
   
   commandToClient(%client, "anyFunction", %returnValue);
}

-- CLIENT --
function clientCmdAnyFunction(%value)
{
}

greetings
Daniel