Author Topic: commandToClient isn't working like I expect  (Read 529 times)

client.cs:
Code: [Select]
if(!isObject(BLE_UpperCenterPrint)) { exec("./gui/BLE_UpperCenterPrint.gui"); }

//%duration needs to be in msec, e.g. 1000 = 1 second
function BLE_SetUpperCenterPrint(%msg,%duration)
{

echo("received.");

BLE_UpperCenterPrint_Text.setText("<just:center>" @ %msg);

if(%duration)
{

schedule(%duration,0,BLE_SetUpperCenterPrint,"",0);

}

}

server.cs:
Code: [Select]
function BLE_UpperCenterPrint(%client,%msg,%duration)
{
if(isObject(%client))
{

commandToClient(%client,'BLE_SetUpperCenterPrint',%msg,%duration);
echo("should've worked.");


}

}

"should've worked" is echoed, however "received" isn't. I know the client-sided command works.

Is there some syntax issue I'm oblivious to, or what.

(using BLE_UpperCenterPrint(findclientbyName("theb"),"test",5000);)

Client commands work just like server commands.

You need to name your function like this:
Code: [Select]
clientCmdBLE_SetUpperCenterPrint

Client commands work just like server commands.

You need to name your function like this:
Code: [Select]
clientCmdBLE_SetUpperCenterPrint
Thank you that worked.