| Blockland Forums > Modification Help |
| So I made a chatbot... |
| << < (2/4) > >> |
| Port:
--- Quote from: LundoomGaming on April 12, 2012, 01:01:40 PM --- --- End quote --- Please learn TorqueScript before trying to help others with TorqueScript. |
| Treynolds416:
--- Quote from: LundoomGaming on April 12, 2012, 01:01:40 PM --- --- Code: --- --- End code --- --- End quote --- I don't even... |
| adam savage:
--- Quote from: LundoomGaming on April 12, 2012, 01:01:40 PM ---Try this --- Code: ---package chatbot { function clientCmdChatMessage(%cl, %voice, %pitch, %line, %pre, %name, %suf, %msg) { parent::clientCmdChatMessage(%cl, %voice, %pitch, %line, %pre, %name, %suf, %msg); %self = (%name $= $Pref::Player::NetName); if(!%self) { return; } if(firstWord(%msg)$="Comedybot") saystuff(restWords(%msg)); } }; function saystuff(%msg) { switch(%msg) { if(%msg == "") { commandToServer( 'messageSent', "comedyBot: Yes?" ); } else if(%msg == "afk") { commandToServer( 'messageSent', "comedyBot: I'll see you when you get back!" ); } else if(%msg == "brb") { commandToServer( 'messageSent', "comedyBot: I'll see you when you get back!" ); } else if(%msg = "back") { commandToServer( 'messageSent', "comedyBot: Welcome back!" ); } } } activatePackage( "chatbot" ); --- End code --- --- End quote --- Oh my epic fail This code will work --- Code: ---package ChatBot { function clientCmdChatMessage(%c,%a,%b,%fmsg,%cp,%name,%cs,%msg) { if(%msg $= "AFK") { commandToServer('messageSent',"ComedyBot: See you when you get back!"); } if(%msg $= "Back") { commandToServer('messageSent',"ComedyBot: Welcome Back!"); } //Remove this and you'll break your chat, so don't. parent::clientCmdChatMessage(%c,%a,%b,%fmsg,%cs,%name,%cp,%msg); } }; ActivatePackage(ChatBot); --- End code --- |
| Lugnut:
oh my god how many tabs is that |
| Treynolds416:
Why does nobody indent properly! It's the easiest part of scripting! |
| Navigation |
| Message Index |
| Next page |
| Previous page |