I am trying to generate a random colour from four predefined colours. The pre defined colours are Red,Blue,Green,Yellow. Please take a look at what I written so far.
$1 = "RED"
$2 = "GREEN"
$3 = "BLUE"
$4 = "YELLOW"
$COLOUR = GETRANDOM($1,$4)
I know why the error I am getting is because the GetRandom is looking for a numeric value. I do not know if the script is capable of what I am trying to accomplish.
Upgrade to ARC Pro
Experience early access to the latest features and updates. You'll have everything that is needed to unleash your robot's potential.
This is one way to do it...
This is an easier way to do it...
This one is a lot more involved than DJ's examples in the fact it will pick a colour, then change it's mind, pick another one etc. until the same colour is picked multiple times. It also gives voice feedback on each pick.
Script is rather old now and may have some errors in due to syntax changing (probably the SayWait() commands) but the idea is there to build off of. It's also a very rough script, I would probably have written it differently today as there are many ways I can see without too much probing that I could have made it a lot less code.
@Rich: Thank You also for your help.
May I use the scripts posted in this thread in my project?
To answer "how would I know to use..." this is, as Richard mentioned, common programming technique. You know by learning, either in a class room, from tutorials and books or from examples.