Mail bot help

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
halfbanana
Posts: 5
Joined: Fri Nov 11, 2011 1:14 am

Mail bot help

#1 Post by halfbanana » Fri Nov 11, 2011 1:34 am

Hi, I'm trying to put together a bot that stands at the auction house and runs to the mailbox when it comes in. I'm having some trouble just getting the bot to recognize when the mail comes in (via event monitor checking). I am currently using the sleep() function and I think that is part of the problem - it seems to override just about everything. However I don't want to use a function like yrest() because I want him to just stand and wait for incoming mail. Can anyone point me in the right direction? Here's what I have written so far:



<onLoad>


function DetectMail()
repeat
local time, moreToCome, msg = EventMonitorCheck("SystemMsgLog", "1")
if msg ~= nil then
if string.find(msg,"New mail") then
DEFAULT_CHAT_FRAME:AddMessage("new mail detected");
end
end
until moreToCome == false
end


function startMailDetect()
unregisterTimer("mailinc");
printf("mailinc detection started\n");
EventMonitorStart("SystemMsgLog", "CHAT_MSG_SYSTEM");
registerTimer("mailinc", secondsToTimer(5), DetectMail);
end

startMailDetect()

</onLoad>


This is the waypoint file I load initially upon starting my bot:

<waypoints>

<!-- # 1 --><waypoint x="-427" z="-6002" y="21">
<!-- # 2 --><waypoint x="-1275" z="-5847" y="65">
player:sleep();
</waypoint>



ANY HELP WILL BE GREATLY APPRECIATED, THANKS!

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Mail bot help

#2 Post by rock5 » Fri Nov 11, 2011 2:20 am

If you want to stand at the action house and wait for mail, I would just create a loop at that waypoint checking for mail. I wouldn't create a timer unless you want it checking mail while doing something else.

I would start the event monitor in the onload

Code: Select all

<onLoad>
    EventMonitorStart("SystemMsgLog", "CHAT_MSG_SYSTEM");
</onLoad>
Then at the waypoints...

Code: Select all

<waypoint near auction house>
repeat
    local Found = false
    repeat
        local time, moreToCome, msg = EventMonitorCheck("SystemMsgLog", "1")
        if msg ~= nil then
            if string.find(msg,"New mail") then
                DEFAULT_CHAT_FRAME:AddMessage("new mail detected");
                Found = true
            end
        end
    until moreToCome == false
    yrest(5000) -- pause between checks
until Found == true
</waypoint>
This should wait until it recieves the "New Mail" message then continue to the next waypoint to collect mail.

Code: Select all

<waypoint near mailbox>
    UMM_TakeMail()
</waypoint>
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

halfbanana
Posts: 5
Joined: Fri Nov 11, 2011 1:14 am

Re: Mail bot help

#3 Post by halfbanana » Fri Nov 11, 2011 7:14 am

Thanks Rock5, I've been reading alot of your posts. If you could help out with the error i'm seeing, i'd appreciate it.

After running that script as you suggested in the waypoint file, I see this error:

call igf_events_Frame1's OnEvent, line: [string "?"]:25: attempt to index global 'os' (a nil value)


I'm checking my igf_events.lua file and nothing seems amiss. Do you have any idea?

halfbanana
Posts: 5
Joined: Fri Nov 11, 2011 1:14 am

Re: Mail bot help

#4 Post by halfbanana » Fri Nov 11, 2011 11:29 am

It's a little embarrassing to crawl back here again but I am at wit's end. I keep getting this interface execution error: call igf_events_Frame1's OnEvent, line: [string "?"]:25: attempt to index global 'os' (a nil value)


I have reduced my config to just the EventMonitorStart() function at a waypoint. As soon as it executes, any system message (not just mail messages) causes the error to pop up.

<!-- # 1 --><waypoint x="-1275" z="-5847" y="65">
EventMonitorStart("SystemMsgLog", "CHAT_MSG_SYSTEM");
yrest(30000);
</waypoint>

HELP!!

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Mail bot help

#5 Post by rock5 » Fri Nov 11, 2011 1:02 pm

Is that an in game error? The 'os' functions were removed from the game awhile back. You need to install an addon that enables them again. I use d303fix
http://rom.curseforge.com/addons/d303fix/
I believe there are still a few addons that require the 'os' time functions so it's a good idea to get it.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

halfbanana
Posts: 5
Joined: Fri Nov 11, 2011 1:14 am

Re: Mail bot help

#6 Post by halfbanana » Fri Nov 11, 2011 10:19 pm

That addon solved the issue. Yes the error was in-game. Much obliged!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 5 guests