Blockland Forums > Modification Help

Any tutorials for a server-sided chatbot?

Pages: (1/2) > >>

YourBuddyBill:

Specifically, I need:
The standard response
A way to turn responses on and off
A way to check if something someone typed would give more than one response, so that if it did this chatbot would only give the first response in the list of responses, so people couldn't spam his responses.
A way to kill the player with a custom CI deathmessage, akin to forcekilling but with any damage type.
A way to kick the player with a reason
A way to slap the player as in Munk's Server Pack, but only when the future victim said something specific

Does anyone have a tutorial or something to help me with this?
I'm trying to make a chatbot called Ted.
Among his features, if someone said "Ted" ("is my" or "'s my" or "s my") "bitch", they would be slapped with the message Ted has slapped (playername)!

Slicks555:

It really depends on how advanced you want it. A very, very basic chatbot can be done with something simple like this:


--- Code: ---function parseChat(%cl, %message)
{
%name = %cl.name;
switch$(getWord(%message,0))
{
case "Hello":
return "Hello, " @ %name @ ".";
case "Say":
return getWords(%message,1);
case "Bye":
return "Bye, " @ %name @ ".";
}
}

--- End code ---
Then just feed it through a package like this:

--- Code: ---package chatBot {
function serverCmdMessageSent(%client, %msg)
{
parent::serverCmdMessageSent(%client, %msg);
if(getWord(%msg,0) $= "Bot")
botSay(parseChat(%client, %msg));
}
};
function botSay(%msg)
{
announce("Bot\c6:" SPC %msg);
}

--- End code ---


YourBuddyBill:


--- Quote from: Slicks555 on March 27, 2012, 02:28:49 PM ---It really depends on how advanced you want it. A very, very basic chatbot can be done with something simple like this:

-snip

--- End quote ---
A bit more advanced, really. I want it to have toggleable responses, responses could be turned on or off if it was one specific BL_ID that was trying to toggle it. I believe I stated all that in the OP...

Brian Smithers:


--- Quote from: YourBuddyBill on March 27, 2012, 03:19:22 PM ---A bit more advanced, really. I want it to have toggleable responses, responses could be turned on or off if it was one specific BL_ID that was trying to toggle it. I believe I stated all that in the OP...

--- End quote ---
With the code he provided you can do all that
We're not going to spoon feed you all the code you know.

YourBuddyBill:


--- Quote from: Brian Smithers on March 27, 2012, 03:22:45 PM ---With the code he provided you can do all that
We're not going to spoon feed you all the code you know.

--- End quote ---
I just need to figure out how to toggle it, I'll go tear up other people's mods for the specifics of most of it.
I'm relatively new to scripting, mind you, I can generally only manage simple edits.
Of course, I might be able to piece even the toggling together by using some simple variable thing, but...

Long story short, don't assume I'll magically know all the basics.

Pages: (1/2) > >>

Go to full version