Bug chatbotScript executing twice

So, I've tried to replicate the issue on a smaller scale, but I haven't been able to.
It seems that my buffbot, when sending himself commands (using chat_private() to himself, from his loginScript) is running the chatbotScript twice.

I thought at first maybe somehow the loginScript was being run on two threads simultaneously, but the addition of a few well placed print()s shows that the loginScript is sending the message once, and the chatbotScript is executing twice. My guess is, since it's appearing in the chat log twice (once for outgoing, once for incoming) that it's being interpreted as two incoming messages? Maybe? Again, I tried to duplicate this on a severely simple scale, but it behaved as I would have hoped.

Anything I could provide to help I'd be glad to give.

Scripts are here: http://code.google.com/p/ominous-buffer/source/browse/trunk/OB/scripts/
buffbot.ash is the chatbotScript, login.ash is the loginScript.
 

Alhifar

Member
As far as I'm aware, chatbotScripts execute on both incoming and outgoing messages, which would explain your issue.
 
As far as I'm aware, chatbotScripts execute on both incoming and outgoing messages, which would explain your issue.

That's demonstrably false.

Demonstration:
test.ash:
Code:
void main(string who, string what, string where){
 if(where!="")return;
 print(who+": "+what);
 if(who!=my_name())return;
 print(what);
}

Output from manual send:
Code:
Almighty Sapling: Seven
Seven

Output from
Code:
void main(){
 chat_private("almighty sapling","yo3");
}
is
Code:
Almighty Sapling: yo3
yo3

None of the output appeared twice.

So, now my question is should they execute on outgoing messages? I can't imagine that being a very useful behavior.
 
Last edited:

Veracity

Developer
Staff member
I made the following:

Code:
void main(string sender, string message, string channel)
{
    print( "sender = '" + sender + "'" );
    print( "message = '" + message + "'" );
    print( "channel = '" + channel + "'" );
}
and activated it thusly:

> set chatbotScript=chatbot_script.ash

chatbotScript => chatbot_script.ash
I tested it with "modern" chat and discovered that my script was not called. I should not be surprised; KoLmafia doesn't support that yet.

I selected "older" chat. Normally, when I run "older" chat, I run ActiveChat, which requires the following Chat option:

Display Channel Name, even for the channel you are in

but, for the purpose of this test, I disabled ActiveChat.

In "clan", I typed "test".

Here is what I see in the CLI:

sender = 'Brianna'
message = 'test'
channel = '/clan'

Here is what I see in chat:

[clan] Brianna: test

I then sent myself a private message: "/msg Brianna abc"

I see this in the gCLI:

sender = 'Brianna'
message = 'abc'
channel = ''
And I see this in chat:

private to Brianna: abc
A short time later, I see this in the gCLI:

sender = 'Brianna'
message = 'abc'
channel = ''
And I see this in chat:

Brianna (private): test
So, you are correct: the chatbot script is not called on outgoing messages. It is only called on messages that KoL sends.

It just so happens that KoL sends two messages for private messages that you send to yourself:

- One labeled "private to xxx"
- One labeled "xxx (private)"

Both have the identical message text. And both are passed to the chatbot script.
 
Last edited:
This isn't the behavior I am seeing.
I'm using Older chat, not ActiveChat.

Sending the message (to myself) results in *one* output to the gCLI, regardless of how I send it (from gCLI with /msg, from gCLI with ash chat_private, from a separate script with chat_private, and in the relay browser via /msg).

Further, an outgoing message to any other account results in NOTHING printing in my gCLI, even though I still get the "private to Whomever" message.

Two different mafias behaving differently. No time to test now, but these are the differences in the files that I saw pertaining to chat.
File that executes twice:
Code:
chatLinksUseRelay=false
logChatMessages=false

File that executes once:
Code:
chatLinksUseRelay=true
logChatMessages=true
useChatMonitor=false
useSeparateChannels=true

EDIT:
Also, just noticed that the instance of mafia that executes twice for a self-sent message executes 0 times for a private sent to another account.
 
Last edited:
Top