http://forum.blockland.us/index.php?topic=143501.0
But nobody wants another chatbot ._.
package derp { function clientCmdChatMessage(%c,%a,%b,%fmsg,%cp,%name,%cs,%msg) { parent::clientCmdChatMessage(%c, %a, %b, %fmsg, %cp, %name, %cs, %msg); if(getWord(%msg,0) $= "DerpBot") derpBotParse(%name, getWords(%msg,1)); }};activatePackage(derp);function derpBotParse(%name, %msg){ if(getWord(%msg, 0) $= "say") commandToServer('messageSent',"DerpBot:" SPC getWords(%msg,1)); if(getWord(%msg,0) $= "help") commandToServer('messageSent',"DerpBot: I'm a stupid, basic chatbot script. Tell me to say stuff!!");}
Code: [Select]package derp { function clientCmdChatMessage(%c,%a,%b,%fmsg,%cp,%name,%cs,%msg) { parent::clientCmdChatMessage(%c, %a, %b, %fmsg, %cp, %name, %cs, %msg); if(getWord(%msg,0) $= "DerpBot") derpBotParse(%name, getWords(%msg,1)); }};activatePackage(derp);function derpBotParse(%name, %msg){ if(getWord(%msg, 0) $= "say") commandToServer('messageSent',"DerpBot:" SPC getWords(%msg,1)); if(getWord(%msg,0) $= "help") commandToServer('messageSent',"DerpBot: I'm a stupid, basic chatbot script. Tell me to say stuff!!");}You're welcome
package AxoBot_Client{ function clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg) { parent::clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg); AxoBot_Check(%name,%msg); }};activatePackage(AxoBot_Client);function AxoBot_Check(%name,%msg){ if(firstword(%msg) $= "^axobot") { %name = stripMLControlChars(%name); %msge = restwords(%msg); %cmd = firstWord(%msge); %arg = restWords(%msge); if(isFunction(%func = "axoBotCmd" @ %cmd)) call(%func, %name, %arg); else commandtoserver('MessageSent',"AxoBot: Command not found."); }}function AxoBotCmdExample(%name,%args){ commandtoserver('MessageSent',"AxoBot: This is an example function, it'll kick in when somebody says ^axobot example.");}
Code: [Select]package AxoBot_Client{ function clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg) { parent::clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg); AxoBot_Check(%name,%msg); }};activatePackage(AxoBot_Client);function AxoBot_Check(%name,%msg){ if(firstword(%msg) $= "^axobot") { %name = stripMLControlChars(%name); %msge = restwords(%msg); %cmd = firstWord(%msge); %arg = restWords(%msge); if(isFunction(%func = "axoBotCmd" @ %cmd)) call(%func, %name, %arg); else commandtoserver('MessageSent',"AxoBot: Command not found."); }}function AxoBotCmdExample(%name,%args){ commandtoserver('MessageSent',"AxoBot: This is an example function, it'll kick in when somebody says ^axobot example.");}
That is an inefficient way of doing it.