Author Topic: Chatbot syntax errors.  (Read 1787 times)


Now it's giving me a syntax error on line 6, which happens to be:

Code: [Select]
switch$(%msg)
Why is that?

(Dangit, another double post)

post the entire code here if there's an error

Code: [Select]
package chatbot
{
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
                switch$(%msg);
                {
                        case "Testing":
                               commandToServer('messageSent',"<color:e5e500>Mimic<color:ffffff>: This was a triumph!");
                        case "Hi":
                              commandToServer('messageSent',"<color:e5e500>Mimic<color:ffffff>: Hello, how are you?");
                        case "good":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: That's not good, that's GREAT!");
                        case "Mimic":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: What do you want?");
case "Derp":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: Herp-a-Derp");
case "lol":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: HAHAHAHAHAHA.. I don't get it..");
case "moo":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: Shut up, you aren't some kind of cow!");
case "gtfo":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: No, YOU get the fudge out! ..I'm kinda hungry now..");
case "cool":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: What are you talking about? I'm not cold!");
case "shut up":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: No you do the shutting of the up.");
case "no you shut up":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: No YOU do this shutting up thing!");
case "asdf":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: Oh no, what went wrong NOW?");
case "GO JUMP IN A TOILET!":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: But it's cold and wet in there and I don't like it!");
case "oops":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: Oh no, what did you do THIS time?");
case "slimabob":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: Hey, I know that guy!");
case "Hia":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: I hope this server was better than the last one..");
case "Dont worry mimic, it will be":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: It had better be, or I'll ragequit.");
case "afk":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: He's going AFK, quick everyone do something annoying to him!");
case "brb":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: Okay.. but don't take too long..");
case "connected.":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: Hi, I don't think I like you.");
case "I don't like you":
                                commandtoserver('messagesent',"<color:e5e500>Mimic<color:ffffff>: Good, then the feeling's mutual.");
                }
}

};
activatePackage(chatbot);

-snip-

You can't have a semicolon after switch$(%msg).

You can't have a semicolon after switch$(%msg).

It's still giving me a syntax error on the same line even after i remove the semicolon.

EDIT: this was in the console:

« Last Edit: July 30, 2011, 03:40:32 PM by slimabob »

did you restart blockland?
sometimes the execution system messes up if a script's been executed already

did you restart blockland?
sometimes the execution system messes up if a script's been executed already
Yep, call setmodpaths(getmodpaths()); before the execution to avoid this problem, or restart like otto said.

Restarted blockland.

The syntax error is still there.

The code worked fine for me. This may be a stupid question but are those As in the error report actually in the script? Because the hashes are located in them and I never get anything like that on an error report.

No, the A's arent in the script. I fixed it though by just reverting back to the multiple "if" statements. Locking.