Blockland Forums > Modification Help
Chat Bot Help
¥ola:
One last time, I got my last chat bot to work but now I'm trying to figure something else out.
What is an efficient way so that this is possible:
Randomperson: Hey ChatBot
Yola: ChatBot: Hey
In other words,
How would I get a chat message to send a
commandToServer('messageSent', "message");
I mean efficient as in I'm going to repeat this multiple times, as in for different chat messages (ex. "Hey", "Whats Up?")
SpreadsPlague:
check every chat message, make a switch for different cases like "hey" or "what's up" or whatever, then compare what was said to the cases and send your message
¥ola:
Correctly using a switch?
--- Code: ---package ChatBot
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
if($ChatBotActive)
{
switch$(%msg)
{
case "ChatBot On":
commandToServer('messagesent', "ChatBot: Turning On");
case "ChatBot Off":
commandToServer('messagesent', "ChatBot: Turning Off");
--- End code ---
Yes I realize that it's not actually turning it on and off
Wordy:
I am confused, what is your problem here?
¥ola:
No problem, wondering how to do this correctly,
Am I using the switch correctly?