Author Topic: Rock Paper Scissors Bot won't work  (Read 939 times)

word = not word $=.
thanks but now the console is inserting random spaces between my switches

That didn't help me solve the problem at all.
I need help with line 16.

as it says in the console.
But I do not know a way to fix it so somebody help
You couldn't do syntax correctly to save your life
I linked you to an article about syntax, and guess what, it's right there on the first loving page!

You've made so many mistakes, and it's pointless for us to fix them all for you because you'll never learn and in a couple weeks you'll make another coding help topic because you still don't know how to do it right! The only time I'll ever endorse locking a coding help topic is right now, you need to learn this stuff on your own.

I'll repeat myself so that you understand: Lock this topic, figure it out on your own

You couldn't do syntax correctly to save your life
I linked you to an article about syntax, and guess what, it's right there on the first loving page!

You've made so many mistakes, and it's pointless for us to fix them all for you because you'll never learn and in a couple weeks you'll make another coding help topic because you still don't know how to do it right! The only time I'll ever endorse locking a coding help topic is right now, you need to learn this stuff on your own.

I'll repeat myself so that you understand: Lock this topic, figure it out on your own
what the hell is your problem?
if you are just going to stuff around like this, then get out
seriously all I want is somebody to help me with this but you are just telling me to lock the topic
i'm in the 7th grade, I don't know much about scripting, and no, I did not find any solutions on the first loving page.

what the hell is your problem?
if you are just going to stuff around like this, then get out
seriously all I want is somebody to help me with this but you are just telling me to lock the topic
i'm in the 7th grade, I don't know much about scripting, and no, I did not find any solutions on the first loving page.
I'm saying you might learn something if you do it yourself. And I can honestly tell you that I personally know third graders that could memorize the same set of rules of syntax in under half an hour

I'm saying you might learn something if you do it yourself. And I can honestly tell you that I personally know third graders that could memorize the same set of rules of syntax in under half an hour
whatever if you keep putting me down like this then fine i'll just quit scripting which you want me to do SO much.

i've managed to fix it by myself, but now when I say the keyword, nothing happens.
https://dl.dropbox.com/u/79071525/Client_RPSBot.zip

This should work. Let me know if you don't understand something and i'll explain.

To play with it, you or someone would type RSBot choiceofrockpaperorscissorshe re.



Code: [Select]
$RPSBot::wins = 0;
$RPSBot::losses = 0;
$RPSBot::ties = 0;
package RPSbot
{
function clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg)
{
parent::clientCmdChatMessage(%a, %b, %c, %fmsg, %cp, %name, %cs, %msg);

%msg = stripMlControlChars(%msg);

if(getWord(%msg,0) $= "RPSBot")
{
%playerChoice = getWord(%msg,1);

if(%playerChoice $= "rock" || %playerChoice $= "paper" || %playerChoice $= "scissors")
{
%c[0] = "rock";
%c[1] = "paper";
%c[2] = "scissors";

%botChoice = %c[getRandom(0,2)];

%winner = RPSBot_getWinner(%botChoice,%playerChoice);

if(%winner $= "1")
{
$RPSBot::wins++;
commandToServer('messageSent',"I win, "@%botChoice@" beats "@%playerChoice@"!");
}
else
if(%winner $= "2")
{
$RPSBot::losses++;
commandToServer('messageSent',"You win, "@%playerChoice@" beats "@%botChoice@"!");
}
else
if(%winner $= "0")
{
$RPSBot::ties++;
commandToServer('messageSent',"Tie!");
}
else
echo("ERROR");
}
}
}
};
activatePackage(RPSBot);

function RPSBot_GetWinner(%this,%that)
{
if(%this $= "" || %that $= "")
return -1;

if(%this $= %that)
return 0;

if(%this $= "rock" && %that $= "scissors")
return 1;
if(%this $= "scissors" && %that $= "paper")
return 1;
if(%this $= "paper" && %that $= "rock")
return 1;

return 2;
}

Did you try just adding an extra, blank line at the beginning?