Game Development Community

having trouble sending varibles from the server to the client

by Joseph Bosch · in Torque Game Builder · 07/13/2012 (11:25 am) · 1 replies

so basically hears my problem with a little test function I wrote

in servercommands.cs

function sendtest()
{
%y = 17
%x = newScriptobject()
{
%test = 8;
}
commandToClient(%client, 'test', %y);
commandToClient(%client, 'test', %1);
commandToClient(%client, 'test', %x);
}

and in my clientGame.cs file

function clientCmdTest(%test)
{
echo "%test = " @ %test;
echo "%test = " @ %test.test";
}

console.log out =

%test = 17
%test = o;

%test = 1
%test = o;

%test = o;
%test = o;

I suppose this is not that big of a deal but it sure would be simpler to send an entire class then what I am eventually planning to send
estimated variables I will eventually send (x, y, z, 5 different counter, 5 different integers and who knows what else)

just saying I would hate to have something like this
commandToClient(%client, 'test', %x, %y, %z, %test.1, %test.2, %test.3, %test.4, %test.5, %test.6, %test.7, %test.8, %test.9, %test.10

and I would use datablocks but all of this is fairly dynamic.

#1
07/15/2012 (12:59 pm)
and apparently sending that many variables crashes torque. i am looking have to send multiple server to client commands. and building a client variable list before actually running through the game.