Returns to early
by Matthew Grint · in Torque Game Engine · 09/16/2005 (12:30 pm) · 2 replies
Hi,
This question probably has a very simple answer that my feeble programming cannot find, but I am really stuck on this. I have a function which attempts to find the model to use as the PlayerBody - but I cannot get it to return the correct data. The programming I have done is fairly shoddy, as i'm sure you will all see. What's happening is the function calls getPlayerBody and it returns 'null' before the second function (OnLine) has processed the data and given a reply, how can I get this to return the data ($Race) I want?
Thanks for any help, I really appreciate it!
Matthew Grint
[Update: Apologies for the typo in the Topic, and any others that may be in here]
This question probably has a very simple answer that my feeble programming cannot find, but I am really stuck on this. I have a function which attempts to find the model to use as the PlayerBody - but I cannot get it to return the correct data. The programming I have done is fairly shoddy, as i'm sure you will all see. What's happening is the function calls getPlayerBody and it returns 'null' before the second function (OnLine) has processed the data and given a reply, how can I get this to return the data ($Race) I want?
function getPlayerBody(%name){
%action = "getbody";
%client.authReturned = false;
%query = "user="@%name@"\t"@
"action="@%action@"\r";
%server = $AuthServer;
%path = $AuthServerPath;
%script = %path @ "game_login.php";
%upd = new HTTPObject(GetBody);
%client.sendObject = %upd; //store object details just in case
%upd.clientid = %client;
%upd.get(%server, %script, %query);
return($Race);
}
}
function GetBody::onLine( %this, %line )
{
if(StrStr(%line, "GlowyBody") != -1)
{
$Race = "GlowyBody";
}
if(StrStr(%line, "OrcBody") != -1)
{
$Race = "OrcBody";
return($Race);
}
else
{
$Race = "GlowyBody";
}
return($Race);
}Thanks for any help, I really appreciate it!
Matthew Grint
[Update: Apologies for the typo in the Topic, and any others that may be in here]
About the author
#2
Thanks for your help and great work on TGE!
09/18/2005 (1:54 am)
Ah thanks, I kinda bodged it into the login code to try and speed things up a bit and it seems to be working now.Thanks for your help and great work on TGE!
Associate Kyle Carter
It's kinda lame to do this, but it's a lot better then having your code hang forever because the webserver is feeling slow. ;)