-
Member
[LUA] Postal Addon/Mailbox retrieve script help
Hello, I tried several addons for Mailbox management (like Postal), they are pretty much the same, they have this "Open all" button which opens every mail in the mailbox which contains golds/items/anything. The problem is these addons completely skip the trash mails, such as "Sale Pending" and similar, you need to cancel them manually one by one.
So I wrote a simple script with PQR and it seemed to work, its basically something like this (the commands are fake, just so you understand the working, but if someone needs the real code I can give it, no problem)
Code:
mails = numbers of mails that can be retrieved (max 50, then you need to reloadUI if you have more pending)
if mails > 0 then
for i=1, mails do
if email(slot1) has gold or email(slot1) has attachment then
RetrieveItemsFromEmail(slot1)
else
DeleteEmail(slot1)
end
mails = mails -1
end
end
And it worked perfectly with PQR. So I wrote that script into a LUA addon and put it on the Addons folder. I added a custom button "Open all" to fire the for cycle, and another one next to it that just ReloadUI().
The problem is once I press the button, it does process the script only for the first email, so I need to click it for every single mail I have, to empty my mailbox. Yes, it deletes worthless mails without attachment and retrieves gold/items from the important ones, but I need to spam it and I don't know why it doesn't move to the next mail.
I also put a debug "print(i)" when pressing the button, just to see the counter of the for cycle (I thought it was stucked after 1), and yes if I have let's say 12 emails, it prints correctly 1,2,3,4...until 12. But somehow instead of processing 12 emails, it processes the -script deletion- only for the first mail, and then stop it, and I need to press it again. As already said, the common addons work great, they loot one after one every email with just one click, but skipping the trash ones, and that's why I tried to write my personal script..
Now I don't know if this is some stuff blocked by the server (I checked the lua commands and they are not protected), I don't know why these big and popular addons like Postal have the incapability of deleting trash mail such as money pending from AH.
Concluding:
1) Why using PQR the -for cycle- empties the mailbox flawless but writing the same code on an addon, it stop after first step of the for cycle and I need to keep pressing it?
2) Why the addons are unable to auto delete trash mails? What's the deal?
Thanks for reading
-
Post Thanks / Like - 1 Thanks
ninjabot (1 members gave Thanks to dealerx for this useful post)