Results 1 to 5 of 5

Thread: Chatbot... (again?!)

  1. #1
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    216

    Default Chatbot... (again?!)

    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 by Pazleysox; 03-27-2017 at 09:54 PM. Reason: refresh

  2. #2
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    216

    Default

    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...

  3. #3
    Senior Member Pazleysox's Avatar
    Join Date
    Feb 2009
    Posts
    216

    Default

    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?20...l=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?

  4. #4
    Developer Grotfang's Avatar
    Join Date
    Jun 2009
    Location
    United Kingdom
    Posts
    591

    Default

    Anyone know how to get the bot to recognize events?
    Originally Posted by Pazleysox View Post
    Code:
        if (channel == "Events")

  5. #5
    Developer
    Join Date
    Aug 2009
    Posts
    2,675

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •