Brushless Motor Movement Panel icon Brushless Motor Movement Panel Control brushless motor controllers (hoverboard-style) via EZ-B: configure direction, speed and optional brake ports for DIY robot movement. Try it →

ARC Pro

Upgrade to ARC Pro

Subscribe to ARC Pro, and your robot will become a canvas for your imagination, limited only by your creativity.

#9  

InMoov cheats! Here's what I have at the beginning of my script to set the variables;


ControlCommand("Auto Position", AutoPositionAction, "Readyset")
Sleep(5000)
$inmoov = "inmoov = 0"
$human = "human = 0"
# get a response value
$x = 0
RepeatWhile($x < 5)
$x++
$response = GetRandomUnique(0,3)

it's adding up correctly but saying the wrong thing.


113: if($inmoov>$human)
114: sayezb("I won, nice game")
119: endif
120: Print("My score is "+$inmoov)
> My score is inmoov = 0
121: Print("Your score is "+$human)
> Your score is human = 011111

On this one InMoov announced he won.

Author Avatar
United Kingdom
LinkedIn Twitter Google+ YouTube
#10  

Every time you use the script

$human = $human + 1

You are effectively only adding a 1 to the end of the string. "Human = 0" + 1 is "Human = 01".

It is saying the correct thing for what you are asking to to say. What you are asking for is not the same as what you want.

Your variables for the scoring aren't decimal they are strings. The lines of code should be;

$inmoov = 0
$human = 0

These are decimal and you will be able to use math with them. You cannot use math with strings.

With these lines of code $human + 1 would be 1, then 2, then 3 as the variable is a number not a string.

#11  

oops sorry Bob... Rich is right, I made a mistake...

before your game set your variables like this... then start the game...


$human=0
$inmoov=0
#12  

Thank you both for all your help with this.