
I made a short little bot in a second, and when I try to execute it, it fails to work. I went over it and looked at it but it still won't work.
package Chatbot
{
$wins = 0;
$losses = 0;
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
parent::clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg);
if(%name !$= $Pref::Player::NetName)
return;
}
if(%msg $= "RPSBot" && getWordCount(%msg) == 2)
{
%attack[1] = "rock";
%attack[2] = "scissors";
%attack[3] = "paper";
$fattack = random($attack)
$word = getWord(%msg,2);
switch$(%word)
{
case "rock"
{
if($fattack $= "rock"
{
commandToServer('messageSent',"We both chose rock.. I guess it's a tie. You have "@$wins@" wins and "@$losses@" losses.");
}
if($fattack $= "scissors";
{
commandToServer('messageSent',"Man, I lost. I chose scissors. You have "@$wins@" wins and "@$losses@" losses.");
$wins += 1;
}
if($fattack $= "paper";
{
commandToServer('messageSent',"Yay! I chose paper! You have "@$wins@" wins and "@$losses@" losses");
$losses += 1;
}
case "scissors"
{
if($fattack $= "rock"
{
commandToServer('messageSent',"Yay! I chose rock! You have "@$wins@" wins and "@$losses@" losses.");
$losses += 1;
}
if($fattack $= "scissors";
{
commandToServer('messageSent',"We both chose scissors.. I guess it's a tie. You have "@$wins@" wins and "@$losses@" losses.");
}
if($fattack $= "paper";
{
commandToServer('messageSent',"Man, I lost. I chose paper. You have "@$wins@" wins and "@$losses@" losses");
$wins += 1;
}
case "paper"
{
if($fattack $= "rock"
{
commandToServer('messageSent',"Man, I lost. I chose rock. You have "@$wins@" wins and "@$losses@" losses.");
$wins += 1;
}
if($fattack $= "scissors";
{
commandToServer('messageSent',"Yay! I chose scissors! You have "@$wins@" wins and "@$losses@" losses.");
$losses += 1;
}
if($fattack $= "paper";
{
commandToServer('messageSent',"We both chose paper.. I guess it's a tie. You have "@$wins@" wins and "@$losses@" losses");
}
}
}
}