Author Topic: Any Short Tutorials for Making a Chatbot?  (Read 1144 times)

The title explains it all, I need a short and easy, yet working and cool tutorial for making a chatbot... anyone have one???


http://forum.blockland.us/index.php?topic=143501.0

I already linked him that exact tutorial, so he probably wants something shorter and more cut-and-paste.

I would suggest asking people for basic chatbots that they have already made and then looking at the code and figuring out what does what.

But nobody wants another chatbot ._.

But nobody wants another chatbot ._.
It's good if you want to learn how to do some things.

Code: [Select]
package derp {
function clientCmdChatMessage(%c,%a,%b,%fmsg,%cp,%name,%cs,%msg)
{
parent::clientCmdChatMessage(%c, %a, %b, %fmsg, %cp, %name, %cs, %msg);
if(getWord(%msg,0) $= "DerpBot")
derpBotParse(%name, getWords(%msg,1));
}
};
activatePackage(derp);
function derpBotParse(%name, %msg)
{
if(getWord(%msg, 0) $= "say")
commandToServer('messageSent',"DerpBot:" SPC getWords(%msg,1));
if(getWord(%msg,0) $= "help")
commandToServer('messageSent',"DerpBot: I'm a stupid, basic chatbot script. Tell me to say stuff!!");
}
You're welcome

Code: [Select]
package derp {
function clientCmdChatMessage(%c,%a,%b,%fmsg,%cp,%name,%cs,%msg)
{
parent::clientCmdChatMessage(%c, %a, %b, %fmsg, %cp, %name, %cs, %msg);
if(getWord(%msg,0) $= "DerpBot")
derpBotParse(%name, getWords(%msg,1));
}
};
activatePackage(derp);
function derpBotParse(%name, %msg)
{
if(getWord(%msg, 0) $= "say")
commandToServer('messageSent',"DerpBot:" SPC getWords(%msg,1));
if(getWord(%msg,0) $= "help")
commandToServer('messageSent',"DerpBot: I'm a stupid, basic chatbot script. Tell me to say stuff!!");
}
You're welcome
That is an inefficient way of doing it.
Code: [Select]
package AxoBot_Client
{
function clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg)
{
parent::clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg);
AxoBot_Check(%name,%msg);
}
};
activatePackage(AxoBot_Client);

function AxoBot_Check(%name,%msg)
{
if(firstword(%msg) $= "^axobot")
{
%name = stripMLControlChars(%name);
%msge = restwords(%msg);
%cmd = firstWord(%msge);
%arg = restWords(%msge);
if(isFunction(%func = "axoBotCmd" @ %cmd))
call(%func, %name, %arg);
else
commandtoserver('MessageSent',"AxoBot: Command not found.");
}
}

function AxoBotCmdExample(%name,%args)
{
commandtoserver('MessageSent',"AxoBot: This is an example function, it'll kick in when somebody says ^axobot example.");
}
« Last Edit: March 27, 2012, 11:32:27 AM by Axolotl »

Code: [Select]
package AxoBot_Client
{
function clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg)
{
parent::clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg);
AxoBot_Check(%name,%msg);
}
};
activatePackage(AxoBot_Client);

function AxoBot_Check(%name,%msg)
{
if(firstword(%msg) $= "^axobot")
{
%name = stripMLControlChars(%name);
%msge = restwords(%msg);
%cmd = firstWord(%msge);
%arg = restWords(%msge);
if(isFunction(%func = "axoBotCmd" @ %cmd))
call(%func, %name, %arg);
else
commandtoserver('MessageSent',"AxoBot: Command not found.");
}
}

function AxoBotCmdExample(%name,%args)
{
commandtoserver('MessageSent',"AxoBot: This is an example function, it'll kick in when somebody says ^axobot example.");
}

That is an inefficient way of doing it.