Author Topic: Setting Variables Error  (Read 614 times)

I'm just learning how to script and I have a problem...

I keep getting a Syntax Error when i try to set a variable:
Code: [Select]
{
$Hello = 1;
}

Can someone tell me what i'm doing wrong?

I'm just learning how to script and I have a problem...

I keep getting a Syntax Error when i try to set a variable:
Code: [Select]
{
$Hello = 1;
}

Can someone tell me what i'm doing wrong?

I don't know why you have the brackets, you don't need brackets to declare a variable.

Well that was just something small, this is the actual thing:
Code: [Select]
package chatbotActive
{
$Active = 1;
function clientCmdChatMesage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg)
{
parent::clientCmdChatMessage(%a,%b,%c,%fmsg,%cp,%name,%cs,%msg);
%self = (%name $= $Pref::Player::NetName);
switch$ (%msg)
{
case "CB, Turn Off":
if(%self)
if($Active = 1)
comamandToServer('messageSent',"ChatBot: Shutting Down…");
deactivatePackage("chatbot");
$Active = "0";
case "CB, Turn On":
if(%self)
if($Active = 0)
commandToServer('messageSent',"ChatBot: Powering Up…");
activatePackage("chatbot");
$Active = "1";
}
}
};

activatePackage( "chatbotActive" );

I get the error at $Active = 1;

put the variable outside the package

Thank you very much. Lockin'.