I hope this makes sense. Is there a way to have a variable, which corresponds to a string of text, and the string of text is a piece of code? Something like this(its for a turn based RPG)
var A = 0;
var B = String;
function Start (){
Invoke"ATTACKPHASE1",3);;Invoke"ATTACKPHASE2",3);
}
function Update (){
if(A==1){B=HP-=10;MP+=5;}
if(A==2){B=DEF-=2;MP-=3;}
if(A==3){B=HP+=20;DEF+=5;}
}
function ATTACKPHASE1(){
//this is where the player chooses what attack they want to do by picking a value for A, this would be done through the GUI, lets say for this example, they set A equal to 3
}
function ATTACKPHASE2(){
//Enemy is the name of a script with public HP/MP/DEF variables in it
Enemy.A
//so that would be like Enemy. HP+=20;DEF+=5;
}
if the variable=string=function isnt possible, how would I make a string of text represent something in a function, so I could do Enemy."B"
Thanks