Author Topic: Help with Chatbot  (Read 1611 times)

So far, I created a bot that reacts to chat messages, but when updating it I get a very strange error message.

That's my script:
Code: [Select]
package KalBot
{
        function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
        {
                parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
                switch$(%msg)
                {
                        case "Update KalBot":
                                if (%name $= "Kaladune")
                                {
                                      commandToServer('messageSent',"KalBot: updating...");
                                      exec("Add-Ons/Client_KalBot/Client.cs");
                                      commandToServer('messageSent',"KalBot: Updated!");
                                }
                                return;

                        case "win":
                                if (%name !$= "Kaladune")
                                {
                                      commandToServer('messageSent',"KalBot: Omg that noob won");
                                }
                                return;
                               
                        case "Hi":
                                      commandToServer('messageSent',"KalBot: Hey!");
                                return;

                        case "Deactivate KalBot":
                                      commandToServer('messageSent',"KalBot: D=");
                                      commandToServer('messageSent',"KalBot: Deactivated...");
                                      deactivatePackage(KalBot);
                                return;
                                
                        case "Shut up":
                                      commandToServer('messageSent',"KalBot: Shut up yourself...");
                                return;
                }

        }
        
};
activatePackage(KalBot);

And this is what the console says when updating KalBot:

Quote
Executing Add-Ons/Client_KalBot/client.cs.
Add-Ons/Client_KalBot/client.cs Line: 44 - Syntax error.
>>> Some error context, with ## on sides of error halt:
                        case "Shut up":

                                      commandToServer('messageSent',"KalBot: Shut up yourself...");

^^^^^^^^return;

                }



        }

        

};

deactivatePackage(KalBot);

activatePackage(KalBot);

*Õ##\##Ú¤*VS%+L®
d¨U·ÝÎŽ~B·xi4§¬|Fºt¥u|HÇì¾¼º²ö^{ÌcLq¤&+­ ø°OQßdÖ¶ÚÅ1z…>‹"H—i¦!½‡âCÌↄZ/¶Õ[
>>> Error report complete.

De-activating package: KalBot
Activating package: KalBot
Any ideas?
« Last Edit: March 22, 2012, 12:38:35 PM by Blocki »

Does this Kalbot talk with your name in chat? Just curious...

it'll look like:

Kaladune: KalBot: Hey!

could you possibly post the actual script file

I hate to ask such an obvious question, but do you have all that junk stuff special character crap at the bottom of your script?

I hate to ask such an obvious question, but do you have all that junk stuff special character crap at the bottom of your script?
some text editors might put stuff in the file but don't show it in the text editor itself

try opening it in other text editors (ie notepad) if you aren't using it already

Me using notepad++
I noticed that it doesn't work if you use tab, you have to type 5 spaces but that didn't fix it...

could you possibly post the actual script file
I hate to ask such an obvious question, but do you have all that junk stuff special character crap at the bottom of your script?
I posted the complete script in OP.

I posted the complete script in OP.
He means the file itself, he's going to open it in a different editor and see if he can find out if there really is that crap at the bottom.


So you mean I open it in another editor and look whether notepad++ generated that random stuff?

So you mean I open it in another editor and look whether notepad++ generated that random stuff?
You or somebody else, yes. Either attatch the cs file or handle it yourself.

Will attach it in 5 minutes, I'm not on my computer at the moment.

There it is:

So it works the first time, but when you update, you get strange syntax errors?


Try putting setModPaths(getModPaths()); before executing.