Blockland Forums > Modification Help
my chatbot problem
(1/2) > >>
tylerk196:

--- Code: ---package chatbot {
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg) {
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
if (%msg $= "testing testing 123") {}
if (%name $= "tylerk196") {
commandToServer('messageSent',"Your testing is win!");
}

}
};
activatePackage(chatbot);
--- End code ---
It keeps repeating over and over, what is wrong with this code?


P.S. how do you add a activate/deactivate? this is going to be a AFK chatbot
MegaScientifical:
You closed the first if too early, so all it's doing is checking if you talked.
tylerk196:
so i move the close to the end?
Red_Guy:
try formatting your code in a more consistent manner - it helps to see whats actually going on:


--- Code: ---package chatbot
  {
   function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
     {
      parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
      if (%msg $= "testing testing 123")
        {
        }
      if (%name $= "tylerk196")
        {
         commandToServer('messageSent',"Your testing is win!");
        }

     }
  };
activatePackage(chatbot);


--- End code ---
I made no changes to your script, I just reformatted
TripleNickels:
What you're going to want to do is delete the first if statement (hint: remove the {} too) and change the second one to

--- Code: ---if(%name $= "tylerk196" && %msg $= "testing testing 123")

--- End code ---

Otherwise, I see no issues.
Navigation
Message Index
Next page

Go to full version