Blockland Forums
Home
Help
Login
Register
Blockland Forums
»
Blockland Forums
»
Modification Help
»
A chatbot
« previous
next »
Print
Pages: [
1
]
2
3
4
Author
Topic: A chatbot (Read 2646 times)
matthew
August 09, 2014, 05:02:45 PM
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
»
Ad Bot
Advertisement
Zeblote
August 09, 2014, 05:07:28 PM
What have you got so far? This isn't the board where you ask for someone else to do it all.
matthew
August 09, 2014, 05:10:22 PM
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
»
Thorfin25
August 09, 2014, 05:15:51 PM
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.
matthew
August 09, 2014, 05:18:27 PM
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
»
Thorfin25
August 09, 2014, 05:21:14 PM
Everybody seems to find that one single chatbot tutorial. Well it kinda starts off right, with a package, a function, and a parent.
Zeblote
August 09, 2014, 05:21:52 PM
Quote from: Thorfin25 on August 09, 2014, 05:15:51 PM
clientCmdChatMessage
Quote from: matthew on August 09, 2014, 05:02:45 PM
server-sided
Thorfin25
August 09, 2014, 05:23:44 PM
Quote from: Zeblote on August 09, 2014, 05:21:52 PM
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?
matthew
August 09, 2014, 05:24:53 PM
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);
Thorfin25
August 09, 2014, 05:27:36 PM
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.
matthew
August 09, 2014, 05:31:22 PM
Like this??
package chatbot {
function serverCmdBlah(%client,%msg,%arg2);
};
activatePackage(chatbot);
«
Last Edit: August 09, 2014, 05:39:16 PM by matthew
»
Thorfin25
August 09, 2014, 05:55:24 PM
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.
matthew
August 09, 2014, 05:58:52 PM
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.
matthew
August 09, 2014, 06:01:08 PM
Im trying to make it so only the person that said the command can see the message aswell
Thorfin25
August 09, 2014, 06:02:20 PM
The first argument of
messageClient
is the client itself. So it should look like
messageClient(%client,'',"\c3MattBot\c6: Hey");
Print
Pages: [
1
]
2
3
4
« previous
next »
Blockland Forums
»
Blockland Forums
»
Modification Help
»
A chatbot