Could have probably named the thread better.
Quote:
|
Originally Posted by Yen
You all misunderstood.
I want to make it perform the actions that are in a string.
For example.
this.txt = "putexplosion(2,30,30)";
DoFunctions(this.txt);
This would put an explosion with a radius of 2 at 30,30.
|
I know the behaviour you're trying to achieve, but it can't be done unless you're working with a putnpc2.
The function you're looking for is called eval(), which would run whatever you passed to it:
NPC Code:
eval("putexplosion(2, 30, 30);");
... but for safety reasons, that function is disabled to prevent people being able to write incredibly malicious scripts and using them to cause hellfire and damnation on servers.
Side-note: This is why you can't type things into the Graal console on some Graal versions which support it!
If you're working with a putnpc2, however, then I suppose you could do:
NPC Code:
putnpc2(x, y, "putexplosion(2, 30, 30); destroy();");