Author Topic: A Chatbot Problem  (Read 780 times)

Code: [Select]
package ToastBot
{
     function serverCmdMessageSent(%client,%message)
     {
          Parent::serverCmdMessageSent(%client,%message);
          if (getWord(%message,1) $= "ToastBot")
          {
               switch$ (getWord(%message,0))
               {
                    case "Hello":
                         messageAll('',"\c3ToastBot\c6: Hello, "@%client.name@".");
                    case "Goodbye":
                         messageAll('',"\c3ToastBot\c6: Goodbye, "@%client.name@".");
                    default:
                         messageAll('',"\c3ToastBot\c6: Unknown command.");
                    case "Bye":
                         messageAll('',"\c3ToastBot\c6: Bye, "@%client.name@".");
               }
          }
     }
};
activatePackage(ToastBot);
What is wrong with this? Bye won't work.

Can you post more info, Does it just not work or is everything "Unknown Command" or is there a syntax error?

Trigun helped me fix it. I just needed to have default last.