Blockland Forums > Modification Help
Chat Bot Help
¥ola:
Seem to be having yet another problem:
A problem with this
--- Code: ---package ChatBotRegister
{
function function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
if(%name $= "¥ola")
{
switch$(%msg)
{
case "ChatBot On":
$ChatBot::On = true;
case "ChatBot Off":
$ChatBot::On = false;
}
}
}
};
activatepackage (ChatBotRegister);
--- End code ---
ThinkInvisible:
"function function"
what
¥ola:
--- Quote from: ThinkInvisible on June 11, 2012, 05:42:28 PM ---"function function"
what
--- End quote ---
Wow.
Ipquarx:
Yikes.
SYNTAX ERROR INBOUND
¥ola:
Why won't this work?
--- Code: ---package ChatBotGreet
{
function newChatHud_addLine(%text)
{
Parent::newChatHud_addLine(%text);
if(%text $="connected.")
{
if($ChatBot::On)
{
%num = getrandom(1,5);
commandtoserver('messagesent', "ChatBot: @ %num);
}
}
}
};
activatepackage (ChatBotGreet);
--- End code ---
Full Script:
--- Code: ---package ChatBot
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
if($ChatBot::On)
{
switch$(%msg)
{
case "Hey":
commandToServer('messagesent', "ChatBot: Hey");
}
}
}
};
package ChatBotRegister
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
Parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
if(%name $= "¥ola")
{
switch$(%msg)
{
case "ChatBot On":
$ChatBot::On = true;
case "ChatBot Off":
$ChatBot::On = false;
}
}
}
};
activatepackage (ChatBotRegister);
package ChatBotGreet
{
function newChatHud_addLine(%text)
{
Parent::newChatHud_addLine(%text);
if(%text $="connected.")
{
if($ChatBot::On)
{
%num = getrandom(1,5);
commandtoserver('messagesent', "ChatBot: @ %num);
}
}
}
};
activatepackage (ChatBotGreet);
--- End code ---