You mean if the player types in something like:
"$gameParty.gainGold(99999);" ?
And you want to evaluate it as Javascript.
In a script call, use:
Code:
eval($gameVariables.value(X));
Obviously, as I've demonstrated this allows a player to hack your game.
Well it's not so bad. I wish to make a terminal, which will be hard to find and even more to learn the commands, where players may write things to get hidden information and stuff that may not be so clear during gameplay.
By the way, I'm having some problems with it now. I've made a system where player could write JS in a variable using one command and then execute it using another(/write_JS and /read_JS). But for some weird reason, when I try to manipulate it on the read part, things go wrong.
Image:
https://i62.servimg.com/u/f62/15/27/47/75/112.png
https://i62.servimg.com/u/f62/15/27/47/75/213.png
So i'm saving whats written using a simple +=1 system. When player writes a JS, its saved on $gameVariable( value of variable 17+1), and it adds +1 to variable 17 which starts on 17, then when read, system will copy the value saved in that variable to variable 13 and execute. In other words, it saves each code from gamevariable 18 until infinite. BUT when i try to read that, since player thinks i'm saving it in an order that starts with 1, I must change the value given after "/read_JS" command to its value + 17. But no matter what I do(And i tried both simple way, using "Controll Variable" event command, and script way, adding +17 in front of the code), it adds 17 before or after the number, never sum.
Could you help?