Blockland Forums > Modification Help
Chat Bot Not Working
<< < (2/3) > >>
Azure:

--- Quote from: Port on December 11, 2011, 08:03:33 AM ---Try reading your code.
if (%msg %= "Activate BlueBot} is invalid, but the correct form is on the line right below it.

--- End quote ---
Oh, I see the typo... Darn cant believe i never noticed that was supposed to be parenthesis. Lol. Okay I will change it and test.
Azure:

--- Quote from: Azure on December 11, 2011, 08:20:38 AM ---Oh, I see the typo... Darn cant believe i never noticed that was supposed to be parenthesis. Lol. Okay I will change it and test.

--- End quote ---

Crap, it's still not working. Still saying it has syntax errors.
Superb:
if(%msg %= "Activate BlueBot}

Should be

if(%msg $= "Activate BlueBot")
Headcrab Zombie:
If you properly indented your code the second error would be easy to identify as well


--- Quote from: Azure on December 11, 2011, 07:32:46 AM ---//Made by BLID 26544
package chatbot
{
   function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
   {
      parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
      if (%msg %= "Activate BlueBot")
         if (%name $= "Azure")
         {
            commandToServer('messageSent',"BlueBot : 2 + 2 = 4! Yipee!");
         }
      }
   }
};
activatePackage(chatbot);

--- End quote ---
Hint: You're missing a bracket somewhere
Also on the Activate BlueBot line you had a closing bracket instead of a closing parenthesis.

Also if you look at the console it says where the error is.
Next, if you get a text editor that has syntax highlighting (I use Notepad++), it can help out on some things like this. If you place the insertion point next to a bracket, it will highlight that bracket, and the corresponding open/close bracket
Finally, don't use these for more then testing purposes. They annoy people.
Greek2me:
You also need a semicolon at the end of parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
Navigation
Message Index
Next page
Previous page

Go to full version