Blockland Forums > Modification Help
Chatbot syntax errors.
Orthone:
--- Code: ---package chatbot {
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
parent::clientCmdChatMessage(%a,%b,%c,%msg,%cp,%name,%cs,%msg);
if (%msg $= "Testing") {
commandToServer('messageSent',"This was a triumph!");
}
}
};
activatePackage(chatbot);
--- End code ---
slimabob:
Awesome. I get it now, thanks a lot.
slimabob:
Okay I have another problem, now all my chat is red and it doesnt say who sent what message.
(Oh crap, double post)
otto-san:
--- Code: ---package chatbot {
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
if (%msg $= "Testing") {
commandToServer('messageSent',"This was a triumph!");
}
}
};
activatePackage(chatbot);
--- End code ---
the fmsg arg was wrong in the parent
slimabob:
So if I wanted to add more commands, I think i would just do this (but im not sure):
--- Code: ---package chatbot {
function clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
if (%msg $= "Testing") {
commandToServer('messageSent',"This was a triumph!");
if (%msg $= "Hi") {
commandToServer('messageSent',"<color:e5e500>Mimic<color:ffffff>: Yo.");
}
}
}
};
activatePackage(chatbot);
--- End code ---
It's giving me syntax errors and I made sure that the brackets were equal.