Author Topic: ChatBot help  (Read 2825 times)

Code: [Select]
package Gravbot
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
Parent::clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg);

switch$(%msg)
{
case "Rofl":
%reply = "GravBot: Don't roll on the floor, it's not healthy.";
case "Hi":
%reply = "GravBot: Hi!";
case "Bye":
%reply = "GravBot: Ok, see ya!";
case "GravBot":
%reply = "GravBot: Yes?";
case "lol":
%reply = "GravBot: HAHAHAHAHAHA i dont get it.";
case "afk":
%reply = "GravBot: Hes going afk, quick! Spray paint his face!!";
case "Gravity":
%reply = "GravBot: Are you referring to me or my creator?";
case "your creator":
%reply = "GravBot: Fine. Don't talk to me.";
case "shut up":
%reply = "GravBot: NO! YOU SHUT UP!!!!";
case "no you":
%reply = "GravBot: COME AT ME, BRO!!!!!";
case "brb":
%reply = "GravBot: Ok! Don't come back!!";
case "gtg":
%reply = "GravBot: Aww, leaving so soon? Well i'd hate to keep you waiting, BYE!!";
case "Youre stupid":
%reply = "GravBot: You know, chatbots are only as smart as you make them, so whos fault is that?";
case "MW3 or BF3":
%reply = "GravBot: MW3 of course! Or was that a rhetorical question?";
case "BF is better":
%reply = "GravBot: HAHAHHAHAHHAHAHHAHA OMG OMG THATS HILARIOUS!!! Wait, youre SERIOUS???";
case "Marmite have you seen my pony?":
%reply = "GravBot: Yes. I ate him.";
case "RAINBOWS":
%reply = "GravBot: SKITTLES!!!!!";
case "noob":
%reply = "GravBot: Takes one to know one (SLAYED.avi)";
case "Chatbot":
%reply = "GravBot: Call me GravBot";
case "Cake":
%reply = "GravBot: Lies! There is no cake.";
case "Youre a chatbot":
%reply = "GravBot: What are you tribal??";
case "im not tribal":
%reply = "GravBot: It seems like you got something against chatbots!";
case "i love chatbots":
%reply = "GravBot: Yeah, SURE!! tribal bastard...";
case "GravBot im not tribal":
%reply = "GravBot: Whatever.";
case "Derp":
%reply = "GravBot: A-derp-a-derp";
case "why":
%reply = "GravBot: JUST CAUSE'!!!";
case "omfg":
%reply = "GravBot: umadbro?";
case "lmao":
%reply = "GravBot: Please, keep your ass on.";
case "hello":
%reply = "GravBot: Hi there!";
case "TWINKIES":
%reply = "GravBot: No, Little Debbie FTW";
case "Twinkies rock":
%reply = "GravBot: Well sure, but swiss rolls are better";
case "swiss rolls are gross":
%reply = "GravBot: BITCH I KILL YOU!!!!";
case "you cant, youre a bot":
%reply = "GravBot: tribal.";
case "gtfo":
%reply = "GravBot: NEVER!!!";
case "yes":
%reply = "GravBot: Nope!";
case "No":
%reply = "GravBot: forget yea...";
case "forever":
%reply = "GravBot: Alone";
case "stfu gravbot":
%reply = "GravBot: BITCH I WILL STFU YOU IN THE FACE!!";
case "forget you":
%reply = "GravBot: Anytime ;)";
case "i love you, gravbot":
%reply = "GravBot: I'm flattered, but youre ugly.";
case "will you marry me, gravbot?":
%reply = "GravBot: WHY THE HELL WOULD YOU MARRY A CHATBOT??? WTF IS WRONG WITH YOU????";
case ":(":
%reply = "GravBot: Please dont start crying.";


default:
return;
}
commandtoserver('messagesent',%reply);
}
};
activatePackage(Gravbot);
Removed
Code: [Select]
if(%name $= "xXGravity DogXx") and it's opening and closing brackets.

Thanks for all your help, guys! :)

please help, i want my friends to talk to it too

Code: [Select]
package Gravbot
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
Parent::clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg);
if(%name $= "xXGravity DogXx" || %name $= "yourotherfriendsname" || %name $= "Otherone")
{
switch$(%msg)
{
case "Rofl":
%reply = "GravBot: Don't roll on the floor, it's not healthy.";
case "Hi":
%reply = "GravBot: Hi!";
case "Bye":
%reply = "GravBot: Ok, see ya!";
case "GravBot":
%reply = "GravBot: Yes?";
case "lol":
%reply = "GravBot: HAHAHAHAHAHA i dont get it.";
case "afk":
%reply = "GravBot: Hes going afk, quick! Spray paint his face!!";
case "Gravity":
%reply = "GravBot: Are you referring to me or my creator?";
case "your creator":
%reply = "GravBot: Fine. Don't talk to me.";
case "shut up":
%reply = "GravBot: NO! YOU SHUT UP!!!!";
case "no you":
%reply = "GravBot: COME AT ME, BRO!!!!!";
case "brb":
%reply = "GravBot: Ok! Don't come back!!";
case "gtg":
%reply = "GravBot: Aww, leaving so soon? Well i'd hate to keep you waiting, BYE!!";
case "Youre stupid":
%reply = "GravBot: You know, chatbots are only as smart as you make them, so whos fault is that?";
case "MW3 or BF3":
%reply = "GravBot: MW3 of course! Or was that a rhetorical question?";
case "BF is better":
%reply = "GravBot: HAHAHHAHAHHAHAHHAHA OMG OMG THATS HILARIOUS!!! Wait, youre SERIOUS???";
case "Marmite have you seen my pony?":
%reply = "GravBot: Yes. I ate him.";
case "RAINBOWS":
%reply = "GravBot: SKITTLES!!!!!";
case "noob":
%reply = "GravBot: Takes one to know one (SLAYED.avi)";
case "Chatbot":
%reply = "GravBot: Call me GravBot";
case "Cake":
%reply = "GravBot: Lies! There is no cake.";
case "Youre a chatbot":
%reply = "GravBot: What are you tribal??";
case "im not tribal":
%reply = "GravBot: It seems like you got something against chatbots!";
case "i love chatbots":
%reply = "GravBot: Yeah, SURE!! tribal bastard...";
case "GravBot im not tribal":
%reply = "GravBot: Whatever.";
case "Derp":
%reply = "GravBot: A-derp-a-derp";
case "why":
%reply = "GravBot: JUST CAUSE'!!!";
case "omfg":
%reply = "GravBot: umadbro?";
case "lmao":
%reply = "GravBot: Please, keep your ass on.";
case "hello":
%reply = "GravBot: Hi there!";
case "TWINKIES":
%reply = "GravBot: No, Little Debbie FTW";
case "Twinkies rock":
%reply = "GravBot: Well sure, but swiss rolls are better";
case "swiss rolls are gross":
%reply = "GravBot: BITCH I KILL YOU!!!!";
case "you cant, youre a bot":
%reply = "GravBot: tribal.";
case "gtfo":
%reply = "GravBot: NEVER!!!";
case "yes":
%reply = "GravBot: Nope!";
case "No":
%reply = "GravBot: forget yea...";
case "forever":
%reply = "GravBot: Alone";
case "stfu gravbot":
%reply = "GravBot: BITCH I WILL STFU YOU IN THE FACE!!";
case "forget you":
%reply = "GravBot: Anytime ;)";
case "i love you, gravbot":
%reply = "GravBot: I'm flattered, but youre ugly.";
case "will you marry me, gravbot?":
%reply = "GravBot: WHY THE HELL WOULD YOU MARRY A CHATBOT??? WTF IS WRONG WITH YOU????";
case ":(":
%reply = "GravBot: Please dont start crying.";


default:
return;
}
commandtoserver('messagesent',%reply);
}
}
};
activatePackage(Gravbot);

Change the yourfriendsname and otherone to your friends names. To add more just add another || %name $= "addyourfreindsnamehere"

Code: [Select]
//General Prefs
$BotName = "GravBot"; //Name of a Bot
$BotTrigger = $BotName @ ","; //The word that triggers the bot, like "GravBot, how are you?" The bot would read how are you?
$BotResponse = $BotName @ ":"; //The first word of the bots replys.

//Messages
$BotGet[0] = "Test"; //What the person says
$BotMessage[0] = "Do you doubt my ability to work?"; //What the bots says back
$BotGet[1] = "Hey " @ $BotName @ "!"; //What the person says
$BotMessage[1] = "I dont want to hear you"; //What the bot says back
$BotGet[2] = "Who made you?"; //What the person says
$BotMessage[2] = "Brian Smith good sir."; //What the bot says back
$BotMessageCount = 2;

//Allowed Names
$AllowedName[0] = "xXGravity DogXx"; //Allowed name
$AllowedName[1] = "Brian Smith"; //Alowed name
$AllowedName[2] = "Next Friend Name"; //Alowed name
$AllowedNameCount = 2; //The amount of allowed names

//To add a message
//Type in: $BotGet[num] = "what the bot recieves to get the message";
//Then after that type in: $BotMessage[same num as above] = "what the bot says to the message, without the botname: part";
//Then to update your BotMessageCount to the number you put in. The number you put in should be the next number in order.

//To add an allowed name
//Almost the same as above, basicly type in after the last allowed name
//$AllowedName[next num] = "Friends name";
//Then you adjust the AllowedNameCount.

//To change the bot name
//You just change it in the text

//To change bot trigger
//Same as above, if you want to include the bots name
//Instead of just putting GravBot, type in " @ $BotName @ "
//And it will automaticly include the bot name

//To change the bot message
//Exact same thing as above, except just change the $BotResponse.

package Gravbot
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
Parent::clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg);
if(firstWord(%msg) $= $BotTrigger)
{
%cmd = restWords(%msg);
for(%i=0;%i<$AllowedNameCount;%i++)
{
if(%name $= $AllowedName[%i])
%y = 1;
}
if(%y)
{
for(%i=0;%i<$BotMessageCount;%i++)
{
if(%cmd $= $BotGet[%i])
%reply = $BotMessage[%i];
}
if(%reply !$= "")
commandToServer('messageSent',$BotResponse SPC %reply);
else
commandToServer('messageSent',$BotResponse @ " invalid command.");
}
}
}
};activatepackage(Gravbot);
Includes a tutorial on how to add things, so only your friends can play with it.
I haven't tested it, though you can just use it freely.
This basicly just gives you the option to do a stuff ton more things.
Like you can change what the bot says in his message, what triggers the bot
The name of the bot. You can add people who can use it to prevent people from using it
And you can also add temporary messages in console.
Tutorial is in the code. Uhm, I haven't tested it, so anyone can fix.


jes, your script doesn't work