Author Topic: A chatbot  (Read 2648 times)

Hello. I want to make a server-sided chatbot that says stuff if you say a special command like for example /help. How would i do that? Also, i would like someone to help me with this in steam chat if you can.
« Last Edit: August 09, 2014, 05:47:03 PM by matthew »

What have you got so far? This isn't the board where you ask for someone else to do it all.

I have not made the code yet because i dont know where to start.  There is a tutorial on how to make a chatbot on the forums but not what im looking for.
« Last Edit: August 09, 2014, 05:16:20 PM by matthew »

You just had some code though. Start with a package, and use the function clientCmdChatMessage(%a,%b,%c,%d,%pre,%name,%suff,%msg) like you had. Except don't use %a,%b,%c,%fmsg,%p,%name,%s,%fmsg, that makes you try to define %fmsg twice.

Like this?

package chatbot {
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg) {
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
}
};
activatePackage(chatbot);
« Last Edit: August 09, 2014, 05:22:10 PM by matthew »

Everybody seems to find that one single chatbot tutorial. Well it kinda starts off right, with a package, a function, and a parent.


Whoops, didn't see that.

For server sided you just need a function, do you want commands, like /help? Or someone says something in chat to trigger it?

I want commands. Anyways i just updated the script. It looks like this now:
package chatbot {
function ChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%fmsg) {
parent::ChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%fmsg);
}
};
activatePackage(chatbot);

Then you can ignore what you got. For server commands the function is serverCmdBlah(%client,%arg1,%arg2...argN) so you can type in /blah into chat. Your first argument will always be %client in this case, and you can tag on more. Like if you want /blah little and /blah big to do different things you add an argument.

Like this??

package chatbot {
function serverCmdBlah(%client,%msg,%arg2);
};
activatePackage(chatbot);
« Last Edit: August 09, 2014, 05:39:16 PM by matthew »

Yeah, and you change Blah for whatever you want. Also I don't think you should put in %msg in this case, just put it as %arg1. Then to send a message to a client you can use messageClient(%client,'',"message here"); notice how the second argument of messageClient is a set of ' as to be left blank.

Ok, I think i almost got it right. This is what it looks like now!:

package chatbot {
function ServerCmdHelp(%client)
{
   messageClient(' ',"\c3MattBot\c6:" SPC "Hey");
}


};
activatePackage(chatbot);

But for some reason nothing shows up on the screen when i use the command.

Im trying to make it so only the person that said the command can see the message aswell

The first argument of messageClient is the client itself. So it should look like messageClient(%client,'',"\c3MattBot\c6: Hey");