Chatbot... (again?!)

Pazleysox

Member
Code:
import <zlib.ash>

void main(string sender, string message, string channel) { 
	Print(Sender + ":"+ message +" in "+channel, "green");
	if(contains_text(message, "hello")){
		chat_clan("Hello, " +sender);
	}
	
	}

I pulled this from another thread, and another script... I've been working around with it, but can't get it to recognize anyone except myself.

I know the point of a chatbot is to run headless, but I was trying to see if I could get it to work with me at the helm.

Does anyone have a working script they are willing to share, or show me why it's potentially not working?

To make things worse, chat does not refresh when this script is running.
 
Last edited:

Pazleysox

Member
I found this code, which seems to work... oddly enough...

Code:
void main( string sender , string message, string channel )
{
    if (channel=="")
    {    
        channel="PM";
        print("Incoming PM from " +sender+ " saying:  "+message,"blue");    
    }    
    else
    {
        print("Listening to "+channel+", Incoming from: " +sender+ " saying:  "+message,"green");
	if(contains_text(to_lower_case(message), "hello"))
		{
		chat_clan("Greetings, " +sender);
		}
	else if(contains_text(to_lower_case(message), "hihi"))
		{
		chat_clan("hi, " +sender);
		}

	
    }}

but I keep breaking it, and then fixing it. it seems very temperamental...
 

Pazleysox

Member
This doesn't do anything...

Code:
    if (channel=="events")
	{
	if(contains_text(to_lower_case(message), "new message received from"))
  	chat_clan("I got a k-mail!");
		return; }
I found this post: http://kolmafia.us/showthread.php?20245-Automation-scripts&p=135184&viewfull=1#post135184 by lostcalpolydude, and readup on the Chatbot information. That's where i pulled the channel name from...

Code:
	if(contains_text(to_lower_case(channel), "new message received from"))
		{
  	chat_clan("testing");
		return; }
(tried this too)

Anyone know how to get the bot to recognize events?
 

heeheehee

Developer
Staff member
Oh, I see. Pazleysox -- you used "events", not "Events". ASH strings are case-sensitive (and have been for a number of years).
 
Top