Convert String To Array Name
Posted: Sat Mar 19, 2016 12:59 pm
Hi Everyone
I've some trouble now , i try to do a Mob Generator and the array of stats and other stuff is base on the mob name, but when oi try to get the stuff with json.get it's not work...
It's possible to take the String From a dropdown list to an array name ?
my Macro :
thanks you for ur help
I've some trouble now , i try to do a Mob Generator and the array of stats and other stuff is base on the mob name, but when oi try to get the stuff with json.get it's not work...
It's possible to take the String From a dropdown list to an array name ?
my Macro :
Code: Select all
[h:mobList = "Eagle,Dragon,Dire Rat"]
[h:abort(input("mobIndex|"+mobList+"|Select Mob|LIST"))]
[h: mob = listGet(mobList, mobIndex)]
[h:Dummy=json.set("{}","str",10,"dex",10,"con",10,"int",10,"wis",10,"char",10,"Dc1",0,"Weapon1","","Dmg1",0,"Bon1",0,"Weapon2","Dc2",0,"Dmg2",0,"Bon2",0,"Weapon3","Dc3",0,"Dmg3",0,"Bon3",0,"Weapon4","Dc4",0,"Dmg4",0,"Bon4",0,"Weapon5","Dc5",0,"Dmg5",0,"Bon5",0)]
<!--Eagle-->
[h:Eagle=json.set("{}","str",12,"dex",8,"con",16,"int",14,"wis",8,"char",8,"Dc1",2,"Dmg1",12,"Bon1",10,"Dc2",0,"Dmg2",0,"Bon2",0,"Dc3",0,"Dmg3",0,"Bon3",0,"Dc4",0,"Dmg4",0,"Bon4",0,"Dc5",0,"Dmg5",0,"Bon5",0)]
[h:Strength = json.get([r:mob],"str")]
[h:Dexterity = json.get([r:mob],"dex")]
[h:Constitution=json.get([r:mob],"con")]
[h:Intelligence = json.get([r:mob],"int")]
[h:Wisdom = json.get([r:mob],"wis")]
[h:Charisma = json.get([r:mob],"char")]
[h:Weapon1 = json.get([r:mob],"Weapon1")]
[h:Dc1 = json.get([r:mob],"Dc1")]
[h:Dmg1 = json.get([r:mob],"Dmg1")]
[h:Bon1 = json.get([r:mob],"Bon1")]
[h:Weapon2 = json.get([r:mob],"Weapon2")]
[h:Dc2 = json.get([r:mob],"Dc2")]
[h:Dmg2 = json.get([r:mob],"Dmg2")]
[h:Bon2 = json.get([r:mob],"Bon2")]
[h:Weapon3 = json.get([r:mob]at,"Weapon3")]
[h:Dc3 = json.get([r:mob],"Dc3")]
[h:Dmg3 = json.get([r:mob],"Dmg3")]
[h:Bon3 = json.get([r:mob],"Bon3")]
[h:Weapon4 = json.get([r:mob],"Weapon4")]
[h:Dc4 = json.get([r:mob]at,"Dc4")]
[h:Dmg4 = json.get([r:mob],"Dmg4")]
[h:Bon4 = json.get([r:mob],"Bon4")]
[h:Weapon5 = json.get([r:mob],"Weapon5")]
[h:Dc5 = json.get([r:mob],"Dc5")]
[h:Dmg5 = json.get([r:mob],"Dmg5")]
[h:Bon5 = json.get([r:mob],"Bon5")]
[h: y = 3]
[h: updates = "{
name: '[r:mob]' ,
y: '[r: y = y + 2]',
}"
]
[h: copyToken("Dummy", 3, "", updates)]