ID:306588
 
Keywords: list, problem, with
(See the best response by Kaiochao.)
Code:
mob/Stat()
statpanel("[usr]")
stat("-=:+:=-")
stat("Style:",usr.style)
stat("Rank:",usr.rank)
stat("Weapon:",usr.weaponchoice)
stat("Current Country:",usr.trainplace)
stat("Move Training:",usr.trainingmove)
stat("Attribute Training:",usr.attributemove)
stat("You Exceed In:","Defensively: [usr.selectedatt] | Offensively: [usr.selectedoffatt]")
stat("")
stat("-=:+:=-")
stat("Attributes")
var/percen1=usr.healthexp/usr.healthexpmax*100
var/percen2=usr.bodydefexp/usr.bodydefexpmax*100
var/percen3=usr.headdefexp/usr.headdefexpmax*100
var/percen4=usr.legdefexp/usr.legdefexpmax*100
var/percen5=usr.armstrengthexp/usr.armstrengthexpmax*100
var/percen6=usr.legstrengthexp/usr.legstrengthexpmax*100
var/percen7=usr.speedexp/usr.speedexpmax*100
stat("Health","[usr.health] | [percen1]%")
stat("Head Defense","Level [usr.headdeflvl] | [percen3]%")
stat("Body Defense","Level [usr.bodydeflvl] | [percen2]%")
stat("Leg Defense","Level [usr.legdeflvl] | [percen4]%")
stat("Arm Strength","Level [usr.armstrengthlvl] | [percen5]%")
stat("Leg Strength","Level [usr.legstrengthlvl] | [percen6]%")
stat("Speed","Level [usr.speedlvl] | [percen7]%")
stat("Wins",usr.wins)
stat("Losses",usr.losses)
if(usr.rank=="Black Belt"||usr.rank=="Black Trunks"||usr.rank=="Black Rope"||usr.rank=="Black Sash"||usr.rank=="Black Scarf")
stat("")
stat("-=:+:=-")
stat("Weapon Attributes")
stat("Weapon:",usr.weaponchoice)
stat("Weapon Attribute:",usr.wepattributemove)
stat("Weapon Move Attribute:",usr.trainingwepmove)
var/percen17=usr.wepskillexp/usr.wepskillexpmax*100
var/percen27=usr.weppowerexp/usr.weppowerexpmax*100
var/percen37=usr.wepspeedexp/usr.wepspeedexpmax*100
stat("Weapon Skill:","Level [usr.wepskilllvl] | [percen17]%")
stat("Weapon Power:","Level [usr.weppowerlvl] | [percen27]%")
stat("Weapon Speed:","Level [usr.wepspeedlvl] | [percen37]%")
statpanel("[usr.style] Moves")
var/nummoves = usr.moves.len
if(nummoves>=3)
var/percen = usr.moveset1exp/usr.moveset1expmax*100
stat("[usr.moves[1]]","Level [usr.moveset1lvl] | [percen]%")
var/percen21 = usr.moveset2exp/usr.moveset2expmax*100
stat("[usr.moves[2]]","Level [usr.moveset2lvl] | [percen21]%")
var/percen31 = usr.moveset3exp/usr.moveset3expmax*100
stat("[usr.moves[3]]","Level [usr.moveset3lvl] | [percen31]%")
if(nummoves>=4)
var/percen = usr.moveset4exp/usr.moveset4expmax*100
stat("[usr.moves[4]]","Level [usr.moveset4lvl] | [percen]%")
if(nummoves>=5)
var/percen = usr.moveset5exp/usr.moveset5expmax*100
stat("[usr.moves[5]]","Level [usr.moveset5lvl] | [percen]%")
if(nummoves>=6)
var/percen = usr.moveset6exp/usr.moveset6expmax*100
stat("[usr.moves[6]]","Level [usr.moveset6lvl] | [percen]%")
if(nummoves>=7)
var/percen = usr.moveset7exp/usr.moveset7expmax*100
stat("[usr.moves[7]]","Level [usr.moveset7lvl] | [percen]%")
if(nummoves>=8)
var/percen = usr.moveset8exp/usr.moveset8expmax*100
stat("[usr.moves[8]]","Level [usr.moveset8lvl] | [percen]%")
if(nummoves>=9)
var/percen = usr.moveset9exp/usr.moveset9expmax*100
stat("[usr.moves[9]]","Level [usr.moveset9lvl] | [percen]%")
if(nummoves>=10)
var/percen = usr.moveset10exp/usr.moveset10expmax*100
stat("[usr.moves[10]]","Level [usr.moveset10lvl] | [percen]%")
if(nummoves>=11)
var/percen = usr.moveset11exp/usr.moveset11expmax*100
stat("[usr.moves[11]]","Level [usr.moveset11lvl] | [percen]%")
if(nummoves>=12)
var/percen = usr.moveset12exp/usr.moveset12expmax*100
stat("[usr.moves[12]]","Level [usr.moveset12lvl] | [percen]%")
stat("-=:+:=-")
stat("Fight Moves")
stat("1:",usr.fightmove1)
stat("2:",usr.fightmove2)
stat("3:",usr.fightmove3)
if(usr.canfight4==1)
stat("4:",usr.fightmove4)
stat("")
stat("-=:+:=-")
stat("Weapon Moves")

if(usr.rank=="Black Belt"||usr.rank=="Black Trunks"||usr.rank=="Black Rope"||usr.rank=="Black Sash"||usr.rank=="Black Scarf")
var/percen11 = usr.wepmoveset1exp/usr.wepmoveset1expmax*100
var/percen21 = usr.wepmoveset2exp/usr.wepmoveset2expmax*100
var/percen31 = usr.wepmoveset3exp/usr.wepmoveset3expmax*100
var/percen41 = usr.wepmoveset4exp/usr.wepmoveset4expmax*100
var/percen51 = usr.wepmoveset5exp/usr.wepmoveset5expmax*100
stat("[usr.wepmoves[1]]","Level [usr.wepmoveset1lvl] | [percen11]")
stat("[usr.wepmoves[2]]","Level [usr.wepmoveset2lvl] | [percen21]")
stat("[usr.wepmoves[3]]","Level [usr.wepmoveset3lvl] | [percen31]")
stat("[usr.wepmoves[4]]","Level [usr.wepmoveset4lvl] | [percen41]")
stat("[usr.wepmoves[5]]","Level [usr.wepmoveset5lvl] | [percen51]")
else
stat("Must Be Black Belt")


Problem description:
runtime error: list index out of bounds
proc name: Stat (/mob/Stat)
usr: BenYankin (/mob)
src: BenYankin (/mob)
call stack:
BenYankin (/mob): Stat()

I'm assuming the problem is at var/nummoves = usr.moves.len?
Best response
It's when you try to access a position in the list greater than it's len. My guess is the problem is at the bottom. Use debugging mode and the runtime error will provide a line number.
In response to Kaiochao (#1)
Kaiochao wrote:
It's when you try to access a position in the list greater than it's len. My guess is the problem is at the bottom. Use debugging mode and the runtime error will provide a line number.

Ahhh, you are right. I seemed to have missed that somehow. Thanks!