Ok so I have a debug system I am working on for a flash game, and I have a Switch(case) block in there here is what I have so far.
switch (fstring){
case "player.getname":
var pname = _global.heroVars.playerName;
target.feedback.text += (ct + pname + "\r\n");
target.inputt.text = "";
break;
case "player.getlevel":
var plevel = _global.heroVars.userLevel;
target.feedback.text += (ct + plevel + "\r\n");
target.inputt.text = "";
break;
default:
target.feedback.text += (ct + "\"" + inp + "\"" + " is not a valid function\r\n");
target.inputt.text = "";
}
My question is how can I make one so it’s a “Set” function. For instance
“player.setlevel NUMBERHERE” or “player.setname STRINGHERE” etc. And take the 2nd part of a the string and use said number or string to set a variable?
Found out how to do it.
With the example of this string “_player.addlevels 2” as the var inputFunc
Don’t know how I didn’t see it before but I ended up solving my own problem. So there’s the answer in case anyone is curious