| Blockland Forums > Modification Help |
| My first chat bot (NEED HELP AGAIN) |
| << < (6/7) > >> |
| Placid:
--- Quote from: Uxie on August 18, 2011, 10:59:09 PM ---o.o --- End quote --- i'd take that as a no lol i almost missed it too.. i caught it on a final look through |
| PurpleMetro:
Uh guys... How do I add more commands to my client-side chatbot? I think it has something to do with this 'case' function thingy. |
| Placid:
--- Quote from: Placid on August 18, 2011, 10:07:01 PM --- --- Code: ---package chatbot { function clientCmdChatMessage(%a,%b,%c,%msg,%cp,%name,%cs,%fmsg) { parent::clientCmdChatMessage(%a,%b,%c,%msg,%cp,%name,%cs,%fmsg); if(%msg $= "testing testing 123") { if(%name == $pref::player::netName) { commandToServer('messageSent',"Your testing is win, " @ $pref::player::netName @ "!"); } } else if(%msg $="command") { //do stuff here } } }; activatePackage(chatbot); --- End code --- --- End quote --- |
| jes00:
--- Quote from: PurpleMetro on August 19, 2011, 10:51:01 AM ---Uh guys... How do I add more commands to my client-side chatbot? I think it has something to do with this 'case' function thingy. --- End quote --- I prefer to make it like this: --- Code: ---package chatbot { function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg) { parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg); switch$(%msg) { case "Test": if (%name $= "jes00") { commandToServer('messageSent',"Testing 1 2 3"); commandToServer('messageSent',"Test: Success!"); } break; case "Victory!": commandToServer('messageSent',"Yahhh!!!"); break; case "the muffin smells good!": commandtoserver('messagesent',"It does indeed!"); break; case "Testing": schedule(3000,0,commandtoserver,'messageSent',"Test: Success!"); break; } } }; activatePackage(chatbot); --- End code --- If I say Test then it checks if the user's name is jes00 and then it makes me say Testing 1 2 3, Test: Success. If someone says Victory! then I say Yahhh!!! If someone says the muffin smells good! I say It does indeed! If someone says Testing in three seconds I say Test: Success |
| Uxie:
What does break do? I dont think I've ever heard of that. |
| Navigation |
| Message Index |
| Next page |
| Previous page |