What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

GetMailAttachments issue

x11r6

New Member
Joined
Jan 15, 2010
Messages
354
Reaction score
7
Hi, i'm trying do develop a plugin (which i'll probably publish once is ready), and i'm having an issue when getting the attachments to a mail;

this code works just sometimes, and when it does it's usally on the first attemp from the bot to get the mails. Once he has deposited the first batch into the guild vault, it always fails to get the next batch of items from the mailbox.

Any suggestion?

the code is very simple:

Code:
        public override void Pulse()
        {
            List<string> myList= new List<string>() {
            "Obsidium Ore"
        };

            goToNearestPointOfInterest("Mailbox");
            getMails();

            goToNearestPointOfInterest("Guild Vault");
            depositToGuildVault(myList);
        }
and the function getMails():
Code:
        public bool getMails()
        {
            ObjectManager.Update();
            int freeBagSlotsToPreserve = 16;
            int mailToGet = 1;
            bool atLeastAmailWasOpen = false;

            if (DEBUG_FLAG == true) Logging.Write("FreeBagSlots:" + ObjectManager.Me.FreeBagSlots + " Mail Count: " + Styx.Logic.Inventory.Frames.MailBox.MailFrame.Instance.MailCount);
            if (Styx.Logic.Inventory.Frames.MailBox.MailFrame.Instance.MailCount == 0) Logging.Write("There are no mails to get");
            else
            {
                if (ObjectManager.Me.FreeBagSlots <= freeBagSlotsToPreserve) Logging.Write("Bags are full - skipping mailbox withdrawal");
                else
                {
                    while (ObjectManager.Me.FreeBagSlots >= freeBagSlotsToPreserve && Styx.Logic.Inventory.Frames.MailBox.MailFrame.Instance.MailCount > 0)
                    {
                        ObjectManager.Update();
                        if (DEBUG_FLAG == true) Logging.Write("enought room into bags: opening mail");
                        Styx.Logic.Inventory.Frames.MailBox.MailFrame.Instance.GetMailAttachments(mailToGet);
                        atLeastAmailWasOpen = true;
                    }
                    if (DEBUG_FLAG == true) Logging.Write("not enought room into bags: Not opening mail");
                    Styx.Logic.Inventory.Frames.MailBox.MailFrame.Instance.Close();
                }
            }
            return atLeastAmailWasOpen;
        }

PS:
It works as intended if i use

</string></string>Lua.DoString("AutoLootMailItem(" + mailToGet.ToString() + ")");
<string><string>instead of
Styx.Logic.Inventory.Frames.MailBox.MailFrame.Instance.GetMailAttachments(mailToGet);
</string></string>
 
Last edited:
Back
Top