View Full Version : Responding to Clan Chat
acsheets
12-19-2009, 06:43 AM
First, I apologize if this has been covered in another thread. I have looked and could not find anything on this topic.
I am working on a small clanbot. This is mainly a project to teach myself the scripting used within mafia. I was wondering if it was possible to respond to commands sent via clan chat (not pm). At the moment I've been playing with the pm trigger and was hoping to expand. Anything that points me in the right direction would be greatly appreciated.
Spiny
12-19-2009, 07:29 AM
From all that I've heard in regards to KoL bots that have the capability to chat... PyKoL (http://forums.kingdomofloathing.com/vb/showthread.php?t=154587&highlight=pykol) is more apt than something done in mafia.
acsheets
12-19-2009, 07:32 AM
Thats what I had mainly read. It was actually earlier today that I stumbled upon chat_clan() and it peaked my interest. Finding that function got my gears turning, wondering if there was a way to parse the clan chat.
I was more interested in it being able to be given commands via clan chat.
That FN Ninja
12-19-2009, 03:18 PM
If you search the forums for "chatbot" a lot of the results have helpful information. Also, I would look into Alhifar's Cagebot.ash (http://kolmafia.us/showthread.php?t=1896) for some scripting examples.
Grotfang
12-19-2009, 04:07 PM
chat_clan(string) is useful at posting messages into chat. It's a function I have used regularly. Unless Alhifar has updated his cagebot script, be careful using it. Some of the functions no longer exist.
Using mafia to respond to messages posted in clan chat is not something I believe is possible using its native abilities. What is it exactly you are wanting it to be able to do?
mredge73
12-19-2009, 05:07 PM
You cannot parse the chat box, mafia doesn't let you do that. I don't know the argument against parsing chat but I am sure there is a reason.
You are limited to responding to PM and can use chat_clan() or chat_private() to send messages through chat to clannies only. Unfortunately chat_reply() was removed for some reason, it allowed you to reply to anyone regardless if they were in your clan or not. I am still unsure why that was removed, it made building chat bots much easier.
acsheets
12-19-2009, 07:31 PM
Thank you all for the help. This basically lets me stop barking up the wrong tree and focus in on what I can do. Thanks to all.
Grotfang
12-26-2009, 10:56 AM
I am still unsure why [chat_reply()] was removed, it made building chat bots much easier.
I don't buy that. I couldn't find much difference between chat_reply( string ) and chat_private( string , string )
In a chatbot, convention means main() starts with main( sender , message ), so I just swap all cases where I might have used chat_reply( string ) with chat_private( sender , string ). Exactly the same effect.
What I would like to see changed would be effective queuing of different commands. For example, if a chatbot is acting on a message and receives a new one, it will pause the original, start and complete the new, then return to finish the original.
This is not good behaviour, and is something I am currently trying to fix (slowly, though - as I don't have a huge amount of free time right now).
Powered by vBulletin® Version 4.1.12 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.