Page 1 of 1

(Condition) getting current number of mails in mailbox

Posted: Fri Nov 14, 2014 10:45 am
by Froote
I use the curse's addon UltimateMailMod, but i can also switch to rock5's mail mod.
I am looking for a function that returns the number of mails i got in my mailbox ; or a function that returns true or false, if my mailbox is empty or not.
I saw in UMM files something like XXX.MailCount, but i don't know how to use it :s

Re: (Condition) getting current number of mails in mailbox

Posted: Fri Nov 14, 2014 12:44 pm
by rock5
I don't think UMM keeps the mail count. The only time it shows the count is when you open the mailbox. At other times all you see is an icon that says you have mail but not how many. Looking at the code I can't see it saving the count, but it is pretty complex for me to follow.

If you're happy with just knowing if you have mail then you should be able to check UMMConfig.NewMail["playername"]. If it's 1 then you have mail.

I see on my setup that my XBar addon shows the mail count. Maybe if you have an addon like that that shows the mail count then you could get it from there.

Just remember, which ever way you do it, you can only count mail if you receive it while online

Re: (Condition) getting current number of mails in mailbox

Posted: Sat Nov 15, 2014 11:08 am
by Froote
In this case i use this number or this boolean to take mails until i have no mails in my mailbox :

i am gonna write a code that targets the mail, checks if the mailbox is empty or not (variable mailCondtionEmpty), takes mails, and repeats if mailConditionEmpty is false.

I don't know which function delivers me an information about the mail count (when the mailbox is open), that's what i am looking for ^^

Re: (Condition) getting current number of mails in mailbox

Posted: Sat Nov 15, 2014 11:41 am
by rock5
Well if you are at the mailbox and the mailbox is open then you can use this to get the mail count

Code: Select all

RoMScript("UMMMailManager.MailCount")
This only works if the mailbox is open. So you could do something like

Code: Select all

repeat
   UMM_TakeMail()
   player:target_NPC("Mailbox") yrest(2000)
until RoMScript("UMMMailManager.MailCount") == 0

Re: (Condition) getting current number of mails in mailbox

Posted: Sat Nov 15, 2014 11:47 am
by Froote
Thanks a lot for the tip :)