Blockland Forums > Modification Help

Eval Broken?

Pages: << < (3/4) > >>

MegaScientifical:


--- Quote from: Iban on March 30, 2011, 03:00:54 PM ---Eval is the same as putting something in the console.

eval(1+1); does not work because that is not a valid expression.

If we do this, however:

eval("findClientByName(\"Iban\").isAdmin = true;");

It will work.

--- End quote ---

Ya uh... It said "echo" not "eval" in that first example of "1+1"


--- Code: ---function fxDTSBrick::EvalEvent(%this, %cmd, %client) {
%cmd = %cmd @ ";";
%name = %client.getPlayerName();
echo("\c3Attempted Eval Event by: " @ %name);
if(%client.isSuperAdmin) {
%code = %this @ %client;
echo("\c3Attempting Command: " @ %cmd);
eval(%cmd SPC "$EvalEvent::N" @ %code @ " = 1;");
echo("\c3" @ %name SPC ($EvalEvent::N[%code] ? "successfully executed" : "failed to execute") SPC "the command.");
$EvalEvent::N[%code] = 0;
}
return;
}
--- End code ---

Added your simple fix to my code. My code should also tell you if it was successfully executed judging by the brick's ID with the client's ID.

lordician:

Eval simulates console input?
Okaaay...

otto-san:


--- Quote from: lordician on March 30, 2011, 05:14:49 PM ---Eval simulates console input?
Okaaay...

--- End quote ---
The console input uses the function ConsoleEntry::eval() to do stuff.


--- Code: ---function ConsoleEntry::eval()
{
   %text = ConsoleEntry.getValue();
   echo("==>" @ %text);
   eval(%text);
   ConsoleEntry.setValue("");
}
--- End code ---

So eval doesn't simulate console input, it basically IS console input.

lordician:

What do you use it for, i have seen it multiple times, but i still don't know.

otto-san:


--- Quote from: lordician on March 30, 2011, 05:40:02 PM ---What do you use it for, i have seen it multiple times, but i still don't know.

--- End quote ---
...You use it to carry out any action in the Torque Engine.

Pages: << < (3/4) > >>

Go to full version