- Joined
- Oct 21, 2013
- RedCents
- 517¢
So I'm attempting to dabble a bit more into macro writing and thought I'd jump into Arrays. I have built an array that populates just fine, and I thought I'd add a bit more code and started running into issues. So first my "working" array code:
So as I said, this worked fine (other than the commented out section which is my problem). Basic jest of what I originally was doing with the array stuff. I wanted to populate an array with all my worn equipment, then turn around and spit out the data. This all worked as intended. Then I wanted to add some more function to the code and unequip each piece and then reequip the equipment. And this is where I ran into issues. The code doesn't throw any errors, but what keeps happening is that the first item in the array is identified, but isn't unequiped, but each and every other piece does get unequip'd as the GOTO statement continues. I basically stopped there and have been trying to do various other things to see if I can't get this working right (I just plain commented out the /exchange portion and didn't even try it yet)
So I rewrote the code using For Loops and got the same thing.... the first items is populated into the array, but is skipped for unequiping. So you guru's please let me know what I'm doing wrong, I'm sure it is something simple in regards to the way I'm writing this and attempting to do the /unequip command within the loop.
Rich (BB code):
Sub MainGotoArrayTest
/declare EquipID[33] int local
/declare loop1 int local 0
/declare array1 int local 1
:TakeOffGear
/delay .5s
/echo ${Me.Inventory[${loop1}]} ${Me.Inventory[${loop1}].ID}
|/unequip ${loop1}
/varset EquipID[${array1}] ${Me.Inventory[${loop1}].ID}
/varcalc loop1 ${loop1}+1
/varcalc array1 ${array1}+1
/delay 1s
/echo Unequiping ${Me.Inventory[${loop1}]} now!
| /unequip ${loop1}
/if (${loop1}<=20) /goto :TakeOffGear
/declare loop2 int local 0
/declare array2 int local 1
:PutOnGear
|/exchange EquipID[${array2}] ${loop2}
/echo Array2 item number: ${EquipID[${array2}]}, slot number: ${loop2}
/varcalc loop2 ${loop2}+1
/varcalc array2 ${array2}+1
/delay 1s
/if (${loop2}<=20) /goto :PutOnGear
/return
So as I said, this worked fine (other than the commented out section which is my problem). Basic jest of what I originally was doing with the array stuff. I wanted to populate an array with all my worn equipment, then turn around and spit out the data. This all worked as intended. Then I wanted to add some more function to the code and unequip each piece and then reequip the equipment. And this is where I ran into issues. The code doesn't throw any errors, but what keeps happening is that the first item in the array is identified, but isn't unequiped, but each and every other piece does get unequip'd as the GOTO statement continues. I basically stopped there and have been trying to do various other things to see if I can't get this working right (I just plain commented out the /exchange portion and didn't even try it yet)
So I rewrote the code using For Loops and got the same thing.... the first items is populated into the array, but is skipped for unequiping. So you guru's please let me know what I'm doing wrong, I'm sure it is something simple in regards to the way I'm writing this and attempting to do the /unequip command within the loop.

