Blockland Forums > Modification Help
Toggling client chatbot on/off?
(1/5) > >>
slimabob:
I have a client-sided chatbot that I've made but I would like to be able to tell him a command and then he would de-activate until I say another command, which would turn him back on. The only problem is, I'm not quite sure how to do this.
MegaScientifical:
Make it so, when you say "CHATTBOT off" it sets $CHATBOToff to 1. Then, put an if check around all the bot's code to make sure that is "!$CHATBOToff"
Bloxxed:
Or if it's in a package you could do deactivatepackage(chatbot);
ThinkInvisible:
Just an example.

--- Code: ---function chatbot_Toggle(%x) {
     if(%x)
          $chatbot = 0;
     else
          $chatbot = 1;
}

package chatbot {
     function whateverYouUseForTheChatbot(%args, %str, %theclient) {
          parent::whateverYouUseForTheChatbot(%args, %str, %theclient);
          if($chatbot && %theclient $= "yourname" && %str $= "Turn off.")
               chatbot_toggle(1);
          else if(%theclient $= "yourname" && %str $= "Turn on.")
               chatbot_toggle();
          if($chatbot && %str $= "Hello chatbot!")
               commandToServer('messageSent', "CHATBOT| Hi.");
          else
               echo("Disabled! c:");
     }
};
activatePackage(chatbot);
--- End code ---
MegaScientifical:
Honestly, that's coded a bit worse than people say I code. I'd provide my own example, but I'd rather repair his code than try an example which might not fit into his variation.
Navigation
Message Index
Next page

Go to full version