Page 1 of 1

Array of Strings, having hard time /varsetting

Posted: Sun Jun 13, 2004 8:00 pm
by ab2304

Code: Select all


|Buffs to be kept up on self 
/declare AB_NumberOfBuffs int outer 9
/declare AB_MyBuffs[${NumberOfBuffs}] string outer
/varset AB_MyBuffs[1] "Spiritual Dominion" 
/varset AB_MyBuffs[2] "Spirit of Wolf"
/varset AB_MyBuffs[3] "Infusion of Spirit"
/varset AB_MyBuffs[4] "Spiritual Vigor"
/varset AB_MyBuffs[5] "Frenzy"
/varset AB_MyBuffs[6] "Dexterity"
/varset AB_MyBuffs[7] "Furious Strength"
/varset AB_MyBuffs[8] "Regrowth"
/varset AB_MyBuffs[9] "Celerity"
I keep getting the error :
/varset'AB_MyBuffs[-1]'failed, out of bounds on array
bsthunter.mac@94 (Main): /varset AB_MyBuffs[1] "Spiritual Dominion"

Ive tried using a variable /declare i int 1
in the [${1}] of my array, that doesnt work either. Ive tried putting the spell name into a variable before trying to varset the array[1]. So what am I missing? This should be easy, but ive been looking at code for to long!

Re: Array of Strings, having hard time /varsetting

Posted: Sun Jun 13, 2004 9:07 pm
by SwiftyMUSE
ab2304 wrote:

Code: Select all


|Buffs to be kept up on self 
/declare AB_NumberOfBuffs int outer 9
/declare AB_MyBuffs[${NumberOfBuffs}] string outer
Did you try?

Code: Select all


|Buffs to be kept up on self 
/declare AB_NumberOfBuffs int outer 9
/declare AB_MyBuffs[[color=red]${AB_NumberOfBuffs}[/color]] string outer

Posted: Sun Jun 13, 2004 11:10 pm
by Drumstix42
Don't the number usually start at 0 and not 1 ?

Posted: Mon Jun 14, 2004 12:01 am
by ab2304
Thank-you. I knew it was something silly like that. Couldn't see it for the life at me. No more coding at 4 hour blocks at a time.

Whether the array starts at 0 or 1 depends on the language. Since I can add the 9th string at array[9], I believe it starts at 1 for MQ language.

Posted: Mon Jun 14, 2004 8:23 am
by blueninja
Yes MQ starts at 1.