Item Bound (All Items)

astralprojection

New member
Messages
334
Points
0
i plan to make all items in inventory account bound with this code, my
problem now is that, If 2 same items found (example: 2 gloves_) only 1
gloves_ is bounded, the other is not.  Can somebody help me with this
routine?  Thanks

Code:
//account bound all items.@boundtype = 1;getinventorylist();for(.@i = 0; .@i < @inventorylist_count; .@i++) {   delitem2 @inventorylist_id[.@j],@inventorylist_amount[.@j],@inventorylist_identify[.@j],@inventorylist_refine[.@j],@inventorylist_attribute[.@j],@inventorylist_card1[.@j],@inventorylist_card2[.@j],@inventorylist_card3[.@j],@inventorylist_card4[.@j];   getitembound2 @inventorylist_id[.@j],@inventorylist_amount[.@j],@inventorylist_identify[.@j],@inventorylist_refine[.@j],@inventorylist_attribute[.@j],@inventorylist_card1[.@j],@inventorylist_card2[.@j],@inventorylist_card3[.@j],@inventorylist_card4[.@j],.@boundtype;   .@j++;}
 
Well, for one your using ' .@i ' in your loop. But in the commands delitem2 and getitembound2 your using ' .@j '. I'm going to assume your only testing this with 2 items in your inventory. If this is the case then only 1 item is going to be bound, since .@j has a value of zero and never get's increased.

TL;DR: change all .@j  to .@i or vice-versa

 
If you'll look closer, he has .@j++ in the end of loop. That means both .@j and .@i bear the same value, and it goes through all items, even if I miss the reason for 2 variables in the first place. The thing is, I guess the problem lies within delitem2. When there are 2 of same item ( 1 and 2) it deletes 1, creates bound 1, but on next run it deletes the bound 1, and creates it bound again, thus not touching the 2 item at all. I'm a bit at loss on how you can delete a specific item. Maybe if first run all-delete, and then all add-in bound again? (Separate delete and getbound into 2 different loops). That'll take 2 loops, but without editing source of delitem I don't see a way to do it otherwise.

 
Last edited by a moderator:
@Garr - Didn't see the .@j++ at the end. But yes, in order to fix this, he would need to run 2 separate loops, 1 to delete all items and the second to give them back bound. At least this is the simplest way to do it.

 
Back
Top