Author Topic: Fetching server response into a GUI  (Read 1640 times)

This has been driving me nuts, and I'm going in ever-more-complex circuits over this, so hopefully someone here can help me.

The idea is that the client can have a GUI, and receive a response from the server given a certain input. The problem is that this always seems to come back to some variation of
Code: [Select]
%variable = commandtoserver('getsomeinfo');Unfortunately, whenever this happens, I get the same error every time client-side: Call to commandToServer in [function name] uses result of void function call.

What's going on? Any way to work around it?

try %variable = serverCmdgetmesomeinfo();

commandtoserver is a way to execute the command or something, it's not the actual function name.

It's a way for the client to execute the command server-side. servercmdgetsomeinfo(); will fail because the function's not on the client's machine. Assuming I put it on the client's machine via the GUI, that still doesn't help me fetch anything from the server.

Quote
void  commandToServer (string func[, arg1,...])
Here's the problem, commandToServer doesn't return anything (aka, void), so if you have a server command like this:
Code: [Select]
function ServerCmdGetInfo(%client){
  return "abc";
}
and you call it like this (client side):
Code: [Select]
%str = commandToServer('GetInfo');%str won't be "abc".

A workaround:
Server side:
Code: [Select]
function ServerCmdGetInfo(%client){
  commandToClient(%client, 'GetInfo', "abc");
}
Client side:
Code: [Select]
function ClientCmdGetInfo(%str){
  $str = %str;
}

Thanks geek, you're my  :cookieMonster: