Stats=list("Attack"=1,"Defense"=1)
What I'm trying to do is alter a players stats by pulling the value from the element. I've tried, but with no prevail.
if(prob(Prob_Hit)) for(var/S in Contents)
if(S["Attack"])
text+="ATTACK "
if(M.Atkloss==6) {P.Battle_Text("[copytext(uppertext(M.name),1,12)]'s ATTACK cannot be raised anymore!",1);return}
if(M.Atkloss==-6) {P.Battle_Text("[copytext(uppertext(M.name),1,12)]'s ATTACK cannot be lowered anymore!",1);return}
M.Atkloss=min(6,max(M.Atkloss+S["Attack"],-6))
if(abs(S["Attack"] / 2) == 1) text+="sharply "
if(S["Attack"] > 0) text+="rose!"
else text+="fell!"
The above outputs a bad index runtime error.
Anyways, the problem is that you have S["Attack"]
The reason that's the problem is that it's suppose to be Stats["Attack"] to get that value (I will show at the end of why this is...in one way)
I am not sure what you are doing with this "for(var/S in Contents)" but if the Stats list is in obj's or something, you can always do S.Stats["Attack"]
Here's the thing about list value recall:
Here's the simple recall command:
List_Variable["Sub_Var value to be recalled"]
so if the var was: S = list("A" = 12,"B")
than
S["A"] will return 12 and S["B"] returns null
I think I messed up something there so if ya do find it, please correct me :)
- GhostAnime