Author Topic: Chat Bot code error  (Read 1251 times)

I'm trying to create a bot its my first time scripting so if you would go easy on me that would be helpful also.
Here is the error from the console I can't seem to find whats wrong with line 17
If you want to see whats going on or fix something here's my code:
http://leopard.hosting/download.php?f=hjgwu

Anything would be helpful thanks

you are putting the if statement outside the function declaration

in addition to what conan said, this is invalid syntax:

you probably mostly just need to change the ; to a ) at the end of the if, and fix your brackets

I see you are using the Chatbot Tutorial. Make sure you are doing the steps correctly and reading and understanding it.

In chatbot_getRandomPhraseFromWords(%word) function, you have if(%phrases !$= "Hello"), but in the Tutorial, it's if(%phrases !$= ""). Only alter things after you get it working because I see what you were thinking, but that shouldn't have hello in it.

Secondly, if(%hasTrigger = chatBot_messageHasTriggerWord(%msg); should just be:

%hasTrigger = chatBot_messageHasTriggerWord(%msg);

Lastly, you need to understand how things are structured in programming. Notice your Curly Brackets/Braces ( -> { or -> } ). You should be able to see what is wrong if you understand how they should be placed.

Try reading this to understand how they are placed: https://forum.blockland.us/index.php?topic=192083.0