| Blockland Forums > Modification Help |
| My first chat bot (NEED HELP AGAIN) |
| (1/7) > >> |
| PurpleMetro:
went wrong? I made this first chat bot from a tutorial on how to make chat bots. I followed it and named my chat bot the Secbot. After my in-game name. Well at least half of it. Anyway heres the main client.cs code for it: --- Code: ---//Secton //8448 package chatbot { function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%fmsg) { parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%fmsg) { if (%msg $= "testing testing 123") { if (%name $= "Secton") { commandToServer('messageSent',"Your testing is win, Secton!"); } }; --- End code --- After starting the game I looked up in the console to see if it had any errors and yet it did. All it said was there are Syntax errors in my code and the error report was complete. Can somebody fix this? |
| MegaScientifical:
You're missing a ton of closing brackets. (}) Add 3 before the };. |
| Darkmaster20:
Well you nee-- Warning - while you were reading a new reply has been posted. You may wish to review your post. forget. Here is what i have: --- Code: ---//Global Dbot Brain Variables $Dbot::killstreaks = 1; $Dbot::Chat = 1; $Dbot::revenge = 1; $Dbot::multikill = 1; //Global Dbot Brain Variables package Dbot { function servercmdMessageSent(%client, %message) { parent::servercmdMessageSent(%client, %message); %player = %client.getPlayerName(); if($Dbot::Chat == 1) { if(strLwr(getSubStr(%message, 0, 12)) $= "Dbot say") { messageAll("", "\c3Dbot" @ "\c6:" SPC getSubStr(%message, 12, strLen(%message)-12)); } else if(strLwr(getSubStr(%message, 0, 2)) $= "hi") { messageAll("", "\c3Dbot" @ "\c6:" SPC "Hi," SPC %player @ "!"); --- End code --- |
| Headcrab Zombie:
You should try writing code with the brackets on a seperate line, you can see them better and see if your missing something. The parent::clientCmdChatMessage line is just a function call, it ends in a semicolon and doesn't have brackets. And lastly, %msg is undefined --- Code: ---//Secton //8448 package chatbot { function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%fmsg) { parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%fmsg); if (%msg $= "testing testing 123") { if(%name $= "Secton") { commandToServer('messageSent',"Your testing is win, Secton!"); } } } }; ActivatePackage(chatbot); --- End code --- --- Quote from: Darkmaster20 on August 16, 2011, 08:06:08 PM ----snip- --- End quote --- That's a server-side chat bot, OP wants a client-side bot. (Every time someone makes a chat-bot related topic it reminds me that I still need to figure out a way to make mine answer questions) |
| PurpleMetro:
--- Quote from: Headcrab Zombie on August 16, 2011, 08:10:16 PM ---You should try writing code with the brackets on a seperate line, you can see them better and see if your missing something. The parent::clientCmdChatMessage line is just a function call, it ends in a semicolon and doesn't have brackets. And lastly, %msg is undefined --- Code: ---//Secton //8448 package chatbot { function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%fmsg) { parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%fmsg); if (%msg $= "testing testing 123") { if(%name $= "Secton") { commandToServer('messageSent',"Your testing is win, Secton!"); } } } }; ActivatePackage(chatbot) --- End code --- That's a server-side chat bot, OP wants a client-side bot. (Every time someone makes a chat-bot related topic it reminds me that I still need to figure out a way to make mine answer questions) --- End quote --- Dosen't work... :( |
| Navigation |
| Message Index |
| Next page |