Blockland Forums > Modification Help
Chat Bot Help
¥ola:
Why doesn't this work?
jes00:
--- Quote from: ¥ola on June 12, 2012, 03:18:45 PM ---Why doesn't this work?
--- End quote ---
You forgot a semicolon at the end of a parent.
There is no need for two packages and parents and all that.
--- Code: ---package ChatBotYola
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
Parent::clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg);
if($ChatBotYolaActive)
{
switch$(%msg)
{
case "Hey":
commandToServer('messageSent', "ChatBot: Hey");
}
}
if(%name $= $Pref::Player::NetName)
{
switch$(%msg)
{
case "ChatBot On":
$ChatBotYolaActive = true;
case "ChatBot Off"
$ChatBotYolaActive = false;
}
}
}
};
activatePackage(ChatBotYola);
--- End code ---
¥ola:
--- Quote from: jes00 on June 12, 2012, 03:36:50 PM ---You forgot a semicolon at the end of a parent.
There is no need for two packages and parents and all that.
--- Code: ---package ChatBotYola
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
Parent::clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg);
if($ChatBotYolaActive)
{
switch$(%msg)
{
case "Hey":
commandToServer('messageSent', "ChatBot: Hey");
}
}
if(%name $= $Pref::Player::NetName)
{
switch$(%msg)
{
case "ChatBot On":
$ChatBotYolaActive = true;
case "ChatBot Off"
$ChatBotYolaActive = false;
}
}
}
};
activatePackage(ChatBotYola);
--- End code ---
--- End quote ---
Wow, Well thanks a very lot mate
¥ola:
Still not working :/
jes00:
--- Quote from: ¥ola on June 12, 2012, 03:46:20 PM ---Still not working :/
--- End quote ---
Oops, forgot a syntax error.
--- Code: ---package ChatBotYola
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
Parent::clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg);
if($ChatBotYolaActive)
{
switch$(%msg)
{
case "Hey":
commandToServer('messageSent', "ChatBot: Hey");
}
}
if(%name $= $Pref::Player::NetName)
{
switch$(%msg)
{
case "ChatBot On":
$ChatBotYolaActive = true;
case "ChatBot Off":
$ChatBotYolaActive = false;
}
}
}
};
activatePackage(ChatBotYola);
--- End code ---