Blockland Forums > Modification Help
AFKbot issue
(1/3) > >>
adam savage:

--- Code: ---case "AFK": if(!hasItemOnList(%name, $AFKBot::List))
{
commandToServer('messageSent', "AdamBot: " @ %name @ " is now AFK.");
$AFKBot::list = addItemToList($AFKbot::List, %name);
}
--- End code ---

I have a switch and everything above the code, but it says syntax error.
Fluff-is-back:
post the error report
Chrono:
It's likely that the error is found before this.
adam savage:
>>> Some error context, with ## on sides of error halt:
^^^^case "--AdamBot_Code5": CommandToServer('messageSent', "Code 5 initiating..."); if($IAmAdmin){ schedule(1000,0,shutdown);}

^^^^case "AFK": if(!hasItemOnList(%name, $AFKBot::List))
^^^^^{
^^^^^^commandToServer('messageSent', "AdamBot: " @ %name @ " is now AFK.");
^^^^^^$AFKBot::list = addItemToList($AFKbot::List, %name);
^^^^^}

^^^^case: ##"##Back": if(hasItemOnList(%name, $AFKBot::List))
^^^^^{
^^^^^^$AFKBot::list = removeItemfromList($AFKbot::List, %name);
^^^^^^commandToServer('messageSent', "AdamBot: " @ %name @ " is back!");
^^^^^}

^^^^case: "BRB": commandToServer('messageSent', "AdamBot: " @ %name @ " will Be Right Back.");

DO NOT WORRY, THE BOT TURNS OFF. Replaced indentions with "^"
Ipquarx:
At first I couldn't figure out what was wrong, because I assumed your case's were correct.
My assumption was wrong.

I fixed the code, along with replacing the ^'s with actuall indentation.

--- Code: ---case "--AdamBot_Code5":
CommandToServer('messageSent', "Code 5 initiating...");
if($IAmAdmin)
{
schedule(1000,0,shutdown);
}

case "AFK":
if(!hasItemOnList(%name, $AFKBot::List))
{
commandToServer('messageSent', "AdamBot: " @ %name @ " is now AFK.");
$AFKBot::list = addItemToList($AFKbot::List, %name);
}
case "Back":
if(hasItemOnList(%name, $AFKBot::List))
{
$AFKBot::list = removeItemfromList($AFKbot::List, %name);
commandToServer('messageSent', "AdamBot: " @ %name @ " is back!");
}
case: "BRB": commandToServer('messageSent', "AdamBot: " @ %name @ " will Be Right Back.");
--- End code ---
Also, using $IAmAdmin is not a smart idea, as you can just change it anytime you want.
You should check through the player list and check if the player is admin like that.
Navigation
Message Index
Next page

Go to full version