Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: chatbotScript

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    3

    Default chatbotScript

    I'm trying to setup the most simple chatbot ever. It will evolve into something else later, but I'm just trying to get the most basic function to work.

    Here's the script.ash:

    void main(string sender, string message){
    print(sender + ": " + message , "green");
    }

    So it's just logging the private message. I have chatbotScript=script.ash . I even have chatbotScriptExecuted=true, even though, looking at the source code, it's not even being used here. The script runs fine if I run it from the KolMafia gCLI, and I specify my own parameters, and logs the message in the gCLI.

    But, it's not running when I receive a private message. The private message shows up in chat, and showing up in gCLI as a regular PM, but it's not running the script. Any ideas here?

    Thanks.

  2. #2

    Default

    try declaring
    Code:
    void main(string sender, string message, string channel) {
    ...
    }
    This will give you access to channel info, which will be empty for pm's.
    Before you ask, please check the FAQ.
    Veracity: My "humble opinion" trumps your "humble opinion". IMHO.

  3. #3
    Developer
    Join Date
    Nov 2008
    Location
    Paris, France
    Posts
    4,511

    Default

    void main(string sender, string message){
    print(sender + ": " + message , "green");
    }
    Originally Posted by Subsonice View Post
    It works for me.
    Try the Nemesis Quest Script or the FamiliarFeeder interface.
    *shakes KoLMafia tech support magic 8-ball* Update mafia to the latest daily .JAR!
    NEW Dad ASCENSION STARTED 20120730
    ------------------------------
    Welcome to Parenthood, Noob

  4. #4
    Junior Member
    Join Date
    Jul 2011
    Posts
    3

    Default

    try declaring
    Code:
    void main(string sender, string message, string channel) {
    ...
    }
    This will give you access to channel info, which will be empty for pm's.
    Originally Posted by StDoodle View Post
    I tried this before, and just tried it again. It still doesn't respond to PMs. I'm not sure that if the problem is with the script, because I'm using a script that the wiki and other people have used, and it works fine for them, I suppose. When I run the script manually from KolMafia, it works fine. Something is not triggering the script to run. I'm using v14.6 on Windows XP.

    Thanks for your response : )

  5. #5
    Junior Member
    Join Date
    Jul 2011
    Posts
    3

    Default

    It works for me.
    Originally Posted by slyz View Post
    I figure it works for other people. I don't know what the deal is. Is it running as your chatbotScript, and running when a PM is sent to you?

  6. #6
    Developer
    Join Date
    Nov 2008
    Location
    Paris, France
    Posts
    4,511

    Default

    Depending on your system, you might want to make sure that the name of the script file is in lower case too.

    What does the gCLI say when you try "get chatbotScript"?
    Try the Nemesis Quest Script or the FamiliarFeeder interface.
    *shakes KoLMafia tech support magic 8-ball* Update mafia to the latest daily .JAR!
    NEW Dad ASCENSION STARTED 20120730
    ------------------------------
    Welcome to Parenthood, Noob

  7. #7
    Senior Member mredge73's Avatar
    Join Date
    Dec 2008
    Location
    Houston TX
    Posts
    519

    Default

    Extra simple logging script:

    Code:
    ## Use this script by placing it in your scripts directory and typing "set chatbotScript=ChatLogger.ash" into the gCLI.
    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");
        }
        record note
        {
            string sender;
            string message;
            string channel;
            int date;
        }[int] ChatLog;
        
        File_to_Map("ChatLog.txt",ChatLog);
        int NE= count(ChatLog);
        while (ChatLog[NE].sender != "") NE=NE+1;
        
        
        ChatLog[NE].sender= sender;
        ChatLog[NE].message= message;
        ChatLog[NE].channel= channel;
        ChatLog[NE].date= today_to_string().to_int();
        Map_to_File(ChatLog,"Chatlog.txt");    
    }
    Be sure to set it as your chatbotScript.
    "set chatbotScript=ChatLogger.ash"

    Note: Big "S"

  8. #8
    Senior Member
    Join Date
    Jan 2010
    Posts
    692

    Default

    The private message shows up in chat, and showing up in gCLI as a regular PM, but it's not running the script.
    Originally Posted by Subsonice View Post
    What? Since when do PMs appear in the gCLI? Is it, by chance, appearing in green?

    Or am I seriously misinterpreting your desires?

  9. #9
    Developer Grotfang's Avatar
    Join Date
    Jun 2009
    Location
    United Kingdom
    Posts
    588

    Default

    I believe this issue has been corrected. For completionists out there, 14.6 came before some in-game changes were made to chat that broke our reception of them. Downloading a daily build resolved the issue.

  10. #10
    Senior Member
    Join Date
    Feb 2009
    Posts
    143

    Default

    [code]
    record note
    {
    string sender;
    string message;
    string channel;
    int date;
    }[int] ChatLog;

    File_to_Map("ChatLog.txt",ChatLog);
    int NE= count(ChatLog);
    while (ChatLog[NE].sender != "") NE=NE+1;


    ChatLog[NE].sender= sender;
    ChatLog[NE].message= message;
    ChatLog[NE].channel= channel;
    ChatLog[NE].date= today_to_string().to_int();
    Map_to_File(ChatLog,"Chatlog.txt");
    }
    Originally Posted by mredge73 View Post
    Is there a way to set this to keep only the last 30 things said?

Similar Threads

  1. Bug chatbotScript executing twice
    By bordemstirs in forum Bug Reports
    Replies: 6
    Last Post: 10-11-2014, 07:41 PM
  2. 12349: It really is chatbotScript
    By RSS Bot in forum Latest SVN Changes
    Replies: 0
    Last Post: 07-29-2013, 02:10 PM
  3. Replies: 0
    Last Post: 07-27-2013, 02:13 PM
  4. chatbotScript and Faxbot
    By bordemstirs in forum Community Support
    Replies: 8
    Last Post: 04-10-2011, 10:58 AM
  5. chatbotScript
    By Alhifar in forum Scripting Discussion
    Replies: 19
    Last Post: 04-21-2009, 03:18 AM

Posting Permissions

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