Help with Eval() vs Call() syntax.
by Flybynight Studios · in Torque Game Engine · 07/23/2008 (9:43 am) · 4 replies
//eval("clientcmdgetitem("$newitem"@%j@", $fakedescrip"@%j@", $fakerace"@%j@", $fakeclass"@%j@", $fakebonus"@%j@", $fakeslots"@%j@", $fakeico"@%j@"");");
call("clientcmdgetitem",$newitem""@%j@"",$fakedescrip""@%j@"",$fakerace""@%j@"",$fakeclass""@%j@"",$fakebonus""@%j@"",$fakeslots""@%j@"",$fakeico""@%j@"");neither of these lines compile and I cant figure out why. Any suggestions? I figure it's a syntax problem with my nested vars in the variables. Im at a loss :/
#2
IE: $newitem1 $newitem2 $newitem3 all being unique.. I setup a loop %j=1; while %j etc.. %j++;
So what I am in effect trying to do is evail("clientcmdgetitem("$newitem1","$fakedescrip1", etc etc and then on the next pass $newitem2,fakeitem2 etc etc
Sorry I wasnt more clear. hope that helps
07/23/2008 (10:24 am)
Yes I mean to call clientcmdfoo and the arguments are for variable variables :)IE: $newitem1 $newitem2 $newitem3 all being unique.. I setup a loop %j=1; while %j etc.. %j++;
So what I am in effect trying to do is evail("clientcmdgetitem("$newitem1","$fakedescrip1", etc etc and then on the next pass $newitem2,fakeitem2 etc etc
Sorry I wasnt more clear. hope that helps
#3
Thanks :)
EDIT: Ok I tested this.. it just passes the %j portion of the variable.. What I wanted was the contents of $newitem1 and what I am getting is simply '1'.
It did compile though strangely enough. Just doesnt funciton right. I am sure it's syntax. arg.
07/23/2008 (10:30 am)
Ack I bet I nevertried $newitem@%i not sure if thats right for compiling but I'll give er a go. Thanks :)
EDIT: Ok I tested this.. it just passes the %j portion of the variable.. What I wanted was the contents of $newitem1 and what I am getting is simply '1'.
It did compile though strangely enough. Just doesnt funciton right. I am sure it's syntax. arg.
#4
Works like a charm. Thanks for the help James. appreciate the extra set of eyes.
07/23/2008 (10:39 am)
Wow yea it was just syntax..eval("clientcmdgetitem($newitem"@%j@", $fakedescrip"@%j@", $fakerace"@%j@", $fakeclass"@%j@", $fakebonus"@%j@", $fakeslots"@%j@", $fakeico"@%j@");");Works like a charm. Thanks for the help James. appreciate the extra set of eyes.
Associate James Ford
Sickhead Games
What is this suppose to be? Do you want a space between $newitem and %i? Or shouldn't it just be..
$newitem @ %i
And the same goes for all the arguments.
Also, are you really meaning to call clientCmdFoo, or do you mean commandToClient( 'foo' )