What I am trying to do with this macro, is open my bank, and type in the filter on my bags, and click this macro. The macro will then go through my bags and deposit every item that is unfiltered.
I’ve spaced out the macro for readability, and used descriptive names for the variables:
/run local cont=false,item;
for bag=0,4 do
for slot=1,GetContainerNumSlots(bag) do
item={GetContainerItemInfo(bag,slot)};
if item[8]==true then
cont=true;
end;
end;
end;
if cont==true then
for bag=0,4 do
for slot=1,GetContainerNumSlots(bag) do
item={GetContainerItemInfo(bag,slot)};
if item[8]==false then
UseContainerItem(bag,slot);
end;
end;
end;
end;
How it works: item[8] is a boolean that says whether the item has been filtered out by the user typing into the backpack search field. So, I first figure out if anything is false (that is, a player has filtered backpack items) and then it attempts to use the unfiltered items (the macro doesn’t know the difference, so it will deposit them to the bank when using the bank interface, or it will sell them when using a vendor interface).
This macro works with just the second loop, but I want the first loop for safety: I want to make sure I’ve filtered at least one item from my inventory, otherwise the macro deposits (or sells) everything.
I know I can change the names of the variables to single letters, and delete the whitespace but that isn’t enough. I have a few more ideas, but so far lowest I can get is 262 characters, and I need to get it less than 255.