I wrote a chatbotScript for my clannies to use that faxes a Mer-kin tippler into the clan. It dumps a photocopy, goes to a clan with a tippler, comes back to fax that in, and finally tells the sender that it's done. However, I came upon an interesting problem where the sender variable apparently gets cleared by the first whitelist function, resulting in my trying to /msg an empty string (the chat event message I get is 'Unknown recipient "". Message (axed.) not sent.').
Here is the relevant code:
I put print()s throughout to find the perpetrator, and like I said, it seems to be that first whitelist. I've fixed my script for the time being by declaring a new string, but I'm really curious as to why I was having this problem.
Here is the relevant code:
Code:
void main(string sender,string message,string channel)
{
if (channel == "")
{
if (message == "fax tippler")
{
if (item_amount($item[photocopied]) == 1)
cli_execute("fax send");
cli_execute("/whitelist clan1");
cli_execute("fax receive");
cli_execute("/whitelist clan2");
cli_execute("fax send");
chat_private(sender,"Faxed.");
}
}
}
I put print()s throughout to find the perpetrator, and like I said, it seems to be that first whitelist. I've fixed my script for the time being by declaring a new string, but I'm really curious as to why I was having this problem.