| Blockland Forums > Modification Help |
| Toggling client chatbot on/off? |
| << < (2/5) > >> |
| slimabob:
So if I had: --- 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") commandToServer('messageSent',"<color:e5e500>Mimic<color:ffffff>: This was a triumph!"); else if(%msg $= "Hi Mimic") commandToServer('messageSent',"<color:e5e500>Mimic<color:ffffff>: Hello how are you?"); } }; activatePackage(chatbot); --- End code --- I would change it to: --- 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") commandToServer('messageSent',"<color:e5e500>Mimic<color:ffffff>: This was a triumph!"); else if(%msg $= "Hi Mimic") commandToServer('messageSent',"<color:e5e500>Mimic<color:ffffff>: Hello how are you?"); else if(%msg $= "Go to sleep mimic") deactivatepackage(chatbot); else if(%msg $= "Wake up Mimic") activatepackage(chatbot); } }; activatePackage(chatbot); --- End code --- if I was doing it Bloxxed's way? |
| MegaScientifical:
--- Code: ---That way would break it, since the package is no longer on to work and turn itself on. [codepackage MimicBot { function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg) { Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg); if(firstWord(%msg) $= "Mimic," && (!$MimicBotOff || %msg $= "Mimic, Wake up")) { switch$(restWords(%msg)) { case "Testing": commandToServer('messageSent', "Mimic: This was a triumph!"); case "Hi": commandToServer('messageSent', "Mimic: Hello how are you?"); case "Go to sleep": $MimicBotOff = 1; case "Wake up": $MimicBotOff = 0; } } } }; activatePackage(MimicBot); --- End code --- 1: You can't put color code in regular chat, unless the host has some stupid chat mod. 2: It's better to only activate if you start by saying "Mimic, " so no one accidentally sets it off. 3: I turned it into a switch check for now, since you only have specific statements to check. 4: Using variables means that it can always check. 5: Wait for even more responses, as they will probably be much better... |
| slimabob:
--- Quote from: MegaScientifical on August 20, 2011, 06:20:48 PM ---1: You can't put color code in regular chat, unless the host has some stupid chat mod. 2: It's better to only activate if you start by saying "Mimic, " so no one accidentally sets it off. 3: I turned it into a switch check for now, since you only have specific statements to check. 4: Using variables means that it can always check. 5: Wait for even more responses, as they will probably be much better... --- End quote --- 1: Huh, its always worked perfectly fine with colorcodes on every server I've used him on. 2: I'm not really sure how to do that :I I'm not very good with toruquescript yet. (I noticed you did that though in your version, I'll have to mess around with that so I can understand it better.) 3: Alright, I'll use that for now. 4: Okay, I'll be sure to remember that. 5: Actually, yours was pretty useful, thanks. I'm open to any other help though. |
| slimabob:
YES! I got him to work! On the way, I discovered he had about 15 other syntax errors but I fixed them all! I'm so happy :D |
| slimabob:
I'm so confused... It executes properly but doesn't respond to anything I say to him. Ive tried telling him to wake up but that has no effect. --- Code: ---package MimicBot { function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg) { Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg); if(firstWord(%msg) $= "Mimic" && (!$MimicBotOff || %msg $= "Mimic Wake up")) { switch$(restWords(%msg)) { case "Testing": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: This was a triumph!"); case "Hi": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: Hello how are you?"); case "Good": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: That's not good, that's Great!"); case "lol": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: HAHAHAHAHAHAAA I don't get it.."); case "derp": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: Herp-a-Derp."); case "wtf": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: What the fail?!? I don't understand your human language at all.."); case "Mimic": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: What do you want?"); case "Hi": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: Hello."); case "Cool": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: What are you talking about?! I'm not cold!"); case "I don't know": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: Wait, you DON'T know?! Everyone knows!!"); case "What?": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: You heard him!"); case "NO U": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: No, i do believe he WAS talking to you."); case "slimabob": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: Hey, I know that guy!"); case "No wait": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: No you wait. This is MY game MY rules."); case "Hi everyone.": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: I don't see anyone here i like.."); case "Shut up": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: No you shut the up."); case "No YOU shut up": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: No you do this shutting up thing!"); case "afk": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: Quick, he's going afk! Do all sorts of annoying stuff to him before he comes back!"); case "This sentence is false.": commandToServer('messageSent',"<color:e5e500>Mimic<color:ffffff>: FFFFFFFUUUUUUUUUUU- PARADOOX!!!!!!!!"); case "Cake": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: LIES! THERE IS NO CAKE!"); case "That makes mimic sad.": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: WAAAAAAA I'M FEELING SIMULATED SADNESS!!!!"); case "who are you?": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: To tell you the truth, I have no idea."); case "Youre stupid!": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: Technicaly, since I'm a computer program, I'm smarter than you.."); case "your mom": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: I don't have a mom, I'm an orphan."); case "bye": commandToServer('messageSent', "<color:e5e500>Mimic<color:ffffff>: BYE! DON'T COME BACK!"); case "Go to sleep": $MimicBotOff = 1; case "Wake up": $MimicBotOff = 0; } } } }; activatePackage(MimicBot); --- End code --- Crap triple post.... |
| Navigation |
| Message Index |
| Next page |
| Previous page |