Logging in a Bot

bumcheekcity

Active member
What's the best way to write a bot which will log in at or very soon after rollover and logout just before - checking pages approx. every 10 seconds until then?

I'm able to write a script that adventures and suchforth and checks pages every X seconds just by pausing for however long, but I'll be using a headless mafia for this and want to be able to sort rollover out.
 

Donavin69

Member
I can't take credit for all of the code, but the bots that I run (including HeartBot) are basically done like the attached.

I just have a scheduled task running on the computer to start Mafia, have it autologin, and have the bot.ash as the breakfast script.
 

Attachments

  • Bot.ash
    736 bytes · Views: 88

Rinn

Developer
Yes a chatbot script will process system messages. The sender will be "system". I use a simple one to call my overdrink script and logout when the nightly maintenance in 5 minutes message is sent.
 

Sentrion

Member
Yes a chatbot script will process system messages. The sender will be "system". I use a simple one to call my overdrink script and logout when the nightly maintenance in 5 minutes message is sent.
This is basically what I do, but the sender is actually "System Message". Either that, or my script is behaving really oddly.

As for logging in, I have a scheduled task on Windows that runs at X:40 every night (10 minutes after rollover starts). This has failed me only once recently, when rollover went quite a bit longer than expected.
 
Last edited:

Lilac

Member
Tangentially related: Will chatbot scripts pick up green messages as well, or just system messages?
 

Grotfang

Developer
Depends on what green messages you are looking for. It will happily pick up on dungeon announcements, for example, which are green (I think?). In contrast, it won't pick up on response text from "/use <whatever", which is also green. /who is already integrated into ash.
 

Lilac

Member
Depends on what green messages you are looking for. It will happily pick up on dungeon announcements, for example, which are green (I think?). In contrast, it won't pick up on response text from "/use <whatever", which is also green. /who is already integrated into ash.

I'm looking for kmail notifications in particular, but a handful of other ones would be nice (having a curse item used on you, for instance). Are these recognized?
 

Grotfang

Developer
Probably not, but you are welcome to test them. They aren't really chat messages (with a sender and content) in the same way as others. If you could come up with a sensible way of representing them, then I can look at integrating them, but conceptually it doesn't make a huge amount of sense to me. The way I tend to look at what should be a message is what you would want to appear in a chat log. If it deserves a place in a log, then it probably deserves a place in a chatbot script.
 

Lilac

Member
For those curious, chatbotScript does not pick up event messages by default. I ended up modifying ChatManager.java to call a special event handler function in my chatbotScript every time it handles processEvent. My function then checks if it's a kmail or whatever and does stuff appropriately.

Thanks, though!
 

Grotfang

Developer
For those curious, chatbotScript does not pick up event messages by default. I ended up modifying ChatManager.java to call a special event handler function in my chatbotScript every time it handles processEvent. My function then checks if it's a kmail or whatever and does stuff appropriately.

I'm not surprised it doesn't pick up on them. My question is should it? If so, how should it?
 

StDoodle

Minion
I think it'd be nice to see them register as messages with an empty-string sender (since that's guaranteed never to be a player's name). Also makes for fairly trivial "ignore event" handling. I would suggest leaving all "type of event" parsing to the scripter, for simplicity. (NB: My $0.02 only)
 

Sentrion

Member
I have no idea how it should be represented, but I would absolutely love if this could be done. I've always wanted my bot to act upon receiving a kmail, but I didn't want to go through the trouble of loading messages.php every minute or whatever.
 
Top