Using Exec() Commands To Help Make A Game

Steve G

United Kingdom
robot video thumbnail
robot video thumbnail

K-9 asks "Would you like to play a game?"

So from the famous(ish) line from the movie "War Games", I have taught K-9 a simple, but fun game to entertain people and wanted to showcase it here. I've had some time on my hands, and I gave scripting a game a go, the game being "Rock, Paper, Scissors" aka "Roshambo" aka "lots of other things". As K-9 doesn't have any hands I had to think of a way for him to play this game with people. The following video shows the solution I came up with...

So yes, using the Exec() script command to open, show, and close pictures was the way to go, and I'm fairly pleased with the result. There is a bit more I want to do with it, such as add more photos (preferably funny ones) for each each word, try to get better results from using the "Random" scripts as one of them doesn't seem to fire very much, and the main thing I want to add is a game counter. But for now, and for anyone interested, I have done a quick tutorial for how I did it which, for anyone how doesn't now how to use the Exec() commands, explains how they can be utilized.

This is a simplified version from what's in the video, with a few of the Cheat Sheet commands taken out (such as the rotating ears) which are only relevant to K-9's build and project. So on with the tutorial...

1)Find yourself some pictures, three rocks, three papers, and three scissors, and save these in your "Pictures" folder on your computer. You will need the command paths for these a bit later. They can be found by right clicking on the photo then click on "Properties". The command path you need can be seen in "Location", but you will need to add a forward slash and the name of the photo. Below is an example...

User-inserted image

so your full command should look something like this...

C:\Users\steve_000\Pictures\rock paper scissors\rock 1.PNG

We will use these command paths shortly.

2) Add a Speech Synthesis control to an ARC project.

3) Then add a Speech Recognition control.

4) In the Speech Recognition control, you will need to add 4 new commands. Open the config menu (gear icon) on the speech rec control and type in 4 new "Phrases"...

Lets play rock paper scissors Rock Paper Scissors

5)Here is where you will need your command paths for the photos. Look for the # symbol to see where you will need to put your own command paths. In the first phrase, add the following script...

NOTE: The following scripts have been improved and updated, although the one's below still work. Check out post #11 on page 2 for the updated version.

ControlCommand("Speech Recognition", PauseOn)
sleep(1000)
sayezbwait("Okay then. That sounds like fun. You start.")
ControlCommand("Speech Recognition", PauseOff)

6)In the second phrase "Rock", add...

#rock
ControlCommand("Speech Recognition", PauseOn)


$rock = GetRandom(0,2)

if($rock = 0)
sleep(1000)
Sayezb("Rock. That is a tie. Let's try that again.")

#The exec command path below is what needs to be changed to
#with your own command path.
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 1.png")

sleep(3000)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

elseif($rock = 1)
sleep(1000)
Sayezb("Paper. Paper, wraps Rock. So, I win.")

#Change to your command path below
exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 1.png")

sleep(3000)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

elseif($rock = 2)
sleep(1000)
Sayezb("Scissors. Rock, blunts Scissors. Well done. You win.")

#Change to your command path below
exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors 1.png")

sleep(3000)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

endif
sleep(2000)
ControlCommand("Speech Recognition", PauseOff)

7)Then in "Paper"...

#paper
ControlCommand("Speech Recognition", PauseOn)

$paper = GetRandom(0,2)

if($paper = 0)
sleep(1000)
Sayezb("Rock. Paper, wraps Rock. You are good at this. Well done.")

#Change to your command path below
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 2.png")

sleep(3000)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

elseif($paper = 1)
sleep(1000)
Sayezb("I guessed paper too. That makes it a tie. Let's try again.")

#Change to your command path below
exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 2.png")

sleep(3000)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

elseif($paper = 2)
sleep(1000)
Sayezb("Scissors. Scissors, cut Paper, so, I beat you that time. Unlucky.")

#Change to your command path below
exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors 3.png")

sleep(3000)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )
endif
sleep(2000)
ControlCommand("Speech Recognition", PauseOff)

8)And finally "Scissors"...

#scissors
ControlCommand("Speech Recognition", PauseOn)

$scissors = GetRandom(0,2)

if($scissors = 0)
sleep(1000)
Sayezb("Rock. Rock, blunts Scissors. I win. You are not very good at this.")

#Change to your command path below
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 3.png")

sleep(3000)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

elseif($scissors = 1)
sleep(1000)
Sayezb("Paper. Scissors, cut Paper. Nicely played. Let's try again.")

#Change to your command path below
exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 3.png")

sleep(3000)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

elseif($scissors = 2)
sleep(1000)
Sayezb("Scissors. That makes it a tie breaker. Let's see if we can do better.")

#Change to your command path below
exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors 3.png")

sleep(3000)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

endif
sleep(2000)
ControlCommand("Speech Recognition", PauseOff)

9)Now Click "Save" to save the changes made in the speech rec control.

10)Now plug in your headset or microphone and say to your robot "Lets play rock, Paper, Scissors.", and enjoy the game.

And that's all there is to it. It's no work of art or anything, and as I mentioned before, improvements can and hopefully will be made. But it was something I wanted to try and friends and family love playing it with K-9.

If anyone wants to help a guy out and make changes to improve the scripts above, please do so. The one thing I would really like is a "first to 5 points" game counter which I tried various ways of doing so using a $counter = 0 variable and other things, but nothing worked the way I wanted it to. If anyone wants to add that to my script, I would be forever grateful;).

So I hope you enjoyed the video, and for those who didn't know how to use the Exec() script command, I hope this helped. If you have any games or game ideas you would like to share then please feel free. And when I get around to making any more games, I will post them here too.

Steve. :)

By — Last update

ARC Pro

Upgrade to ARC Pro

ARC Pro will give you immediate updates and new features needed to unleash your robot's potential!

United Kingdom
#1  

I did have another video to share with you guys, but YouTube is having problems uploading it. I'll try again tomorrow. And below is a link for the project for anyone who what's to at with it..,

RockPaperScissorsgame.EZB

PRO
Canada
#2  

lol, sweet idea Steve. I like the pictures coming up to go along with it, great concept!

United Kingdom
#3  

@Jeremie.

He he, thanks buddy. I started with just one picture for each subject but then thought "Blah, boring", so went with some more amusing ones (some not seen in video). I say, it's only a simple game, but this kept my nephew and niece (and adults) entertained for a good couple of hours (or at least until the battery went flat) when they came around the other day.

Trying to think of other games I could do with my still limited, but slowly growing scripting knowledge. confused:)

#4  

Haha! What fun. Brilliant. Your having way too much fun with that little dog of yours. The Dr's going to want him back if you keep teaching him these tricks. :P

United Kingdom
#5  

Lol, thanks Dave. Funny, talking about the Dr, I had a thought of doing a multiple choice Doctor Who quiz using similar methods with the pictures. Maybe I'll give it a go. Anyway I'm glad you enjoyed it. Thanks again.:)

#6  

This sounded like a fun thing so I played around with it for a while and made a project with what I did. I added a scorekeeper and had it announce the score every round and whose favor it is, as well as, an announcement of a winner (whoever wins 5 rounds first). I'm not sure how you wanted to display the score so I didn't put in any display of that. At the moment everything is by voice. It also asks if you want to play another game at the end. The pictures still show up as before. I'll put up the project to the cloud sometime today for you to download. I just want to clean up a few things and do a writeup on how I did it to help you understand what was done and why.

I would like to add a way to vary the responses given by K9 as it goes through the rounds, but that will take a bit longer.

Speaking of the pictures, here are some suggestions that came to mind:

Rock pictures Picture of Rock Hudson or Kid Rock or Dwayne Johnson A rock bouncing off a cartoon character's head or the K9's head depending on who lost

Paper pictures Picture of a tax form or homework with an "F" on it Newspaper with funny headline Toilet paper Paper airplane Shredded paper

Scissors pictures Wrestlers with one in a scissors hold Kid running with scissors

Then there would be pictures of people winning and losing contests.

Also no need to limit yourself to static images. Use some GIFs. There are tons of funny ones around. Maybe with a little sound effects.

United Kingdom
#7  

@WBS.

They are some great ideas about the pictures, and especially the GIF idea, and I'm well pleased you added a score counter too. Yeah I should have said, I did actually want verbal score counter, so your project sounds great. When you load it to the Cloud, I'll be sure check it out. It will be interesting to look at the script to see where I went wrong with my "Counter" attempts.

About chairing the responses, I had a little trouble with that as mentioned in post #1. In each subject, the last response variable would hardly ever fire, so Ithought instead of having three random responses, I would duplicate the existing ones and have three of each (nine random in total).L, which would hopefully swimg the last "Scissors" response in to action more. I'll try it later and see how it goes. It'll be interesting to see your solution to this as well

Steve.:)

#8  

Okay, I've finally uploaded the game. It's called "RPS Game." It seems to have a problem pronouncing the numbers 2 and 4. I'll have to work on that. Also, I forgot to take the # symbol from in front of the Exec() commands in the RPS Main script (two places near the end). And, I had changed the SayEZB() commands to simply Say() Commands for my convenience. I will correct both these things and re-upload it soon.

EDIT I re-uplpaded it and changed it's name so as to make it more specific. It is now called RPS Game_K9.

United Kingdom
#9  

@WBS.

That's great. I'll check it out tomorrow. I look forward to seeing what changes you've made and compair notes. I made a few changes to my version as well this evening, adding some more GetRandom() commands to display more pictures, and give more random responses to each robot answer. I'll post it here tomorrow also with hopefully another quick video. I've still got a lot to learn in regards to writing script as I'm only used to writhing 3, 4, 5 line scripts so this was a bit of a challenge, but I think it all worked out. I haven't really tested it yet, but the short tests I did seemed okay.:)

United Kingdom
#10  

A bit of an update for the "Rock, paper, Scissors" game.

I have added in a few more random script lines for the category (Rock, paper and Scissors) as for some reason the third ($rock = 2) random code wouldn't trigger, so i duplicated the first one and put it at the end. It is marked as "#Redundant but needed", and it has done the job so the three main categories all now fire as expected. As far as I'm aware I scripted it right the GetRandom() parts right, so not sure why it didn't work before. Maybe someone could confirm that what I did is correct.:)

I have also added random script lines for K-9's responses, so now he doesn't always say the same response for his guess. Along with this, I have also added some more fun pictures to go with his responses, along with some "You win/I win" pictures that makes the game a little more interesting and engaging to play.

Here's an updated video demonstration with the changes made which I hope you will enjoy...

I have also posted the updated scripts below. Remember, the same thing still applies where if you wanted to use the scripts yourself, you will need to change the exec("C:\Users\steve_000\Pictures\rock paper scissors****** *.png") command paths to use your own photos.

GAME START

ControlCommand("Speech Recognition", PauseOn)
sleep(1000)
ControlCommand("Ears", ScriptStart)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock paper scissors start.png")
sayezbwait("Okay then. That sounds like fun. You give your guess first, then I will say mine. Good luck.")
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )
ControlCommand("Speech Recognition", PauseOff)

ROCK

#Rock
ControlCommand("Speech Recognition", PauseOn)
$rock = GetRandom(0,3)

#ROCK

if($rock = 0)
$phrase = GetRandom(0,3)
sleep(1000)
if($phrase = 0)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 1.png")
Sayezbwait("Rock. That is a draw. Let's try again.")
elseif($phrase = 1)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 2.png")
Sayezbwait("Rock. That's a tie. Let's have another go.")
elseif($phrase = 2)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 3.png")
Sayezbwait("Rock. We guessed the same. Let's play again.")
elseif($phrase = 3)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 1.png")
Sayezbwait("Rock. That is a draw. Let's try again.")
endif
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

#PAPER

elseif($rock = 1)
$phrase = GetRandom(0,3)
sleep(1000)
if($phrase = 0)
sleep(500)

exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 3.png")
Sayezbwait("I guessed, paper. Paper raps rock. My point. Better luck next time.")
elseif($phrase = 1)
sleep(500)

exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 4.png")
Sayezbwait("Paper. Paper raps rock. I win. I thought you were good at this?")
elseif($phrase = 2)
sleep(500)

exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 5.png")
Sayezbwait("Paper. Paper raps rock. Unlucky.")
elseif($phrase = 3)
sleep(500)

exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 3.png")
Sayezbwait("I guessed, paper. Paper raps rock. My point. Better luck next time.")
endif
exec("C:\Users\steve_000\Pictures\rock paper scissors\i win 1.png")
sleep(1500)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

#SCISSORS

elseif($rock = 2)
$phrase = GetRandom(0,3)
sleep(1000)
if($phrase = 0)
exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors 1.png")
Sayezbwait("Scissors. Rock blunts scissors. You did well there.")
elseif($phrase = 1)
exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors 2.png")
Sayezbwait("I guessed scissors. Rock blunts scissors.  Well played")
elseif($phrase = 2)
exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors 3.png")
Sayezbwait("Scissors. Rock blunts scissors. Good job.")
elseif($phrase = 3)
exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors 1.png")
Sayezbwait("Scissors. Rock blunts scissors. You did well there.")
endif
exec("C:\Users\steve_000\Pictures\rock paper scissors\you win 1.png")
sleep(1500)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

#ROCK (redundant, but needed)

elseif($rock = 3)
$phrase = GetRandom(0,3)
sleep(1000)
if($phrase = 0)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 1.png")
Sayezbwait("Rock. That is a draw. Let's try again.")
elseif($phrase = 1)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 2.png")
Sayezbwait("Rock. That's a tie. Let's have another go.")
elseif($phrase = 2)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 3.png")
Sayezbwait("Rock. We guessed the same. Let's play again.")
elseif($phrase = 3)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 1.png")
Sayezbwait("Rock. That is a draw. Let's try again.")
endif
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

endif
sleep(1000)
ControlCommand("Speech Recognition", PauseOff)

PAPER

#Paper
ControlCommand("Speech Recognition", PauseOn)
$paper = GetRandom(0,3)

#ROCK

if($paper = 0)
$phrase = GetRandom(0,3)
sleep(1000)
if($phrase = 0)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 4.png")
Sayezbwait("Rock. Paper rap's Rock. You win. Well done.")
elseif($phrase = 1)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 5.png")
Sayezbwait("I guessed, rock. Paper rap's Rock. Well played.")
elseif($phrase = 2)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 6.png")
Sayezbwait("My guess was, rock, and paper rap's Rock. So, you win.")
elseif($phrase = 3)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 4.png")
Sayezbwait("Rock. Paper rap's Rock. You win. Well done.")
endif
exec("C:\Users\steve_000\Pictures\rock paper scissors\you win 2.png")
sleep(1500)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

#PAPER

elseif($paper = 1)
$phrase = GetRandom(0,3)
sleep(1000)
if($phrase = 0)
exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 6.png")
Sayezbwait("I guessed paper too. That makes it a tie. Let's try again.")
elseif($phrase = 1)
exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 7.png")
Sayezbwait("My guess was paper as well. That makes a tie break. Let's go again.")
elseif($phrase = 2)
exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 8.png")
Sayezbwait("oops, paper was my choice too, which makes it a draw. Let's have another go.")
elseif($phrase = 3)
exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 6.png")
Sayezbwait("I guessed paper too. That makes it a tie. Let's try again.")
endif
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

#SCISSORS

elseif($paper = 2)
$phrase = GetRandom(0,3)
sleep(1000)
if($phrase = 0)
sleep(500)

exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors 4.png")
Sayezbwait("I guessed, scissors. Scissors cut Paper, so, I beat you that time. Unlucky.")
elseif($phrase = 1)
sleep(500)

exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors 5.png")
Sayezbwait("Scissors. Scissors cut Paper, so, I win. Unlucky.")
elseif($phrase = 2)
sleep(500)

exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors 6.png")
Sayezbwait("My guess was, scissors. Scissors cut Paper, so, I beat you this time. Unlucky.")
elseif($phrase = 3)
sleep(500)

exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors 4.png")
Sayezbwait("I guessed scissors. Scissors cut Paper, so, I beat you that time. Unlucky.")
endif
exec("C:\Users\steve_000\Pictures\rock paper scissors\i win 3.png")
sleep(1500)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

#ROCK (redundant, but needed)

elseif($paper = 3)
$phrase = GetRandom(0,3)
sleep(1000)
if($phrase = 0)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 4.png")
Sayezbwait("Rock. Paper rap's Rock. You win. Well done.")
elseif($phrase = 1)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 5.png")
Sayezbwait("I guessed, rock. Paper rap's Rock. Well played.")
elseif($phrase = 2)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 6.png")
Sayezbwait("My guess was, rock, and paper rap's Rock. So, you win.")
elseif($phrase = 3)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 4.png")
Sayezbwait("Rock. Paper rap's Rock. You win. Well done.")
endif
exec("C:\Users\steve_000\Pictures\rock paper scissors\you win 2.png")
sleep(1500)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

endif
sleep(1000)
ControlCommand("Speech Recognition", PauseOff)

SCISSORS

#Scissors

ControlCommand("Speech Recognition", PauseOn)
$scissors = GetRandom(0,3)

#ROCK

if($scissors = 0)
$phrase = GetRandom(0,3)
sleep(1000)
if($phrase = 0)
sleep(500)

exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 7.png")
Sayezbwait("My guess was, rock. Rock blunts Scissors. I win. Unlucky.")
elseif($phrase = 1)
sleep(500)

exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 8.png")
Sayezbwait("Rock. Rock blunts Scissors. Better luck next time.")
elseif($phrase = 2)
sleep(500)

exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 9.png")
Sayezbwait("I guessed rock. Rock blunts Scissors. I win. You are not very good at this.")
elseif($phrase = 3)
sleep(500)

exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 7.png")
Sayezbwait("My guess was, rock. Rock blunts Scissors. I win. Unlucky.")
endif
exec("C:\Users\steve_000\Pictures\rock paper scissors\i win 5.png")
sleep(1500)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

#PAPER

elseif($scissors = 1)
$phrase = GetRandom(0,3)
sleep(1000)
if($phrase = 0)
exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 9.png")
Sayezbwait("I guessed, paper. Scissors cut Paper. Nicely played. Let's try again.")
elseif($phrase = 1)
exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 10.png")
Sayezbwait("Paper. Scissors cut Paper. You are quite good at this.")
elseif($phrase = 2)
exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 11.png")
Sayezbwait("My guess was, paper. Scissors cut Paper. You win.")
elseif($phrase = 3)
exec("C:\Users\steve_000\Pictures\rock paper scissors\paper 9.png")
Sayezbwait("I guessed paper. Scissors cut Paper. Nicely played. Let's try again.")
endif
exec("C:\Users\steve_000\Pictures\rock paper scissors\you win 4.png")
sleep(1500)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

#SCISSORS

elseif($scissors = 2)
$phrase = GetRandom(0,3)
sleep(1000)
if($phrase = 0)
exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors draw.png")
Sayezbwait("Scissors. That makes it a tie breaker. Let's see if we can do better.")
elseif($phrase = 1)
exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors draw.png")
Sayezbwait("Oh dear. That was my guess too. Let's try again.")
elseif($phrase = 2)
exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors draw.png")
Sayezbwait("I guessed scissors as well. That,s a draw. Let's have another go.")
elseif($phrase = 3)
exec("C:\Users\steve_000\Pictures\rock paper scissors\scissors draw.png")
Sayezbwait("Scissors. That makes it a tie breaker. Let's see if we can do better.")
endif
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

#ROCK (redundant, but needed)

elseif($scissors = 3)
$phrase = GetRandom(0,3)
sleep(1000)
if($phrase = 0)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 7.png")
Sayezbwait("My guess was, rock. Rock blunts Scissors. I win. Unlucky.")
elseif($phrase = 1)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 8.png")
Sayezbwait("Rock. Rock blunts Scissors. Better luck next time.")
elseif($phrase = 2)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 9.png")
Sayezbwait("I guessed rock. Rock blunts Scissors. I win. You are not very good at this.")
elseif($phrase = 3)
exec("C:\Users\steve_000\Pictures\rock paper scissors\rock 7.png")
Sayezbwait("My guess was, rock. Rock blunts Scissors. I win. Unlucky.")
endif
exec("C:\Users\steve_000\Pictures\rock paper scissors\i win 5.png")
sleep(1500)
$attributes = "/F /IM dllhost.exe"
Exec( "taskkill", $attributes )

endif
sleep(1000)
ControlCommand("Speech Recognition", PauseOff)

With the new script changes, the game works SOOOO much better than it did before as ($rock = 2) "Scissors" triggers much more often now. Again, this ain't no masterpiece, but it was my first attempt at writing something a little more complex than I'm used to, using multiple variables and random codes in one (or three) places. There is probable a much better and cleaner way to write this little game, but it works and I'm happy with the results. I hope you are too.:)

BTW, the spelling mistake for "Wrap's" was deliberate for speech synthesis reasons, as it didn't seem to pronounce it right, and "Rap's" works much better.;)

@WBS.

I used some of your picture suggestion in the update, and they look good. I'm about to try your version. Looking forward to seeing how you went about scripting it, and to playing it.

Steve.

United Kingdom
#11  

@WBS.

I just checked out your version of RBS. What on earth have you done to my game?:P

Kidding of course. It's great what you have done with it, and I absolutely LOVE the points counter. It works really well (I didn't expect anything less). It was a joy to play and interest to see who you rewrote it. It much smaller and cleaner, and I can see by what you have done that I have a long way to go in improving my knowledge of writing scripts. Info see your point in putting the main body of the game in the speech recognition control. I may actually change mine to Cheat Sheet commands and move the game to a script manager.

I think I see way my attempt at including a counter failed as I was trying to take points from three separate scripts, where as the main body of your version is in one script. Although I guess it could be done with a counter script outside of the speech rec control which I would love to include in my updated version, but that's a bit beyond my ability just now.

If I could nit pick on one thing though, the pictures wouldn't activate and I got an error on line 82 (or near that). It was he EXEC() variable that was causing the trouble. I don't know why that was as it looked good to me.

Anyway, I really liked what you did with it, and thanks for sharing the download link.:)

Steve.

#12  

Hi Steve; Glad you liked it. I'll look into why the picture thing is failing. Working on the random K9 responses now. I plan to have the response sentences broken into 3 parts, each of which will be randomly changeable to make a complete, coherent sentence. That should mix up the responses quite a bit. I'll be incorporating your new phrases as well, if that's ok. For instance a randomly chosen phrase like "I chose " or "I selected " would be combined with whatever K9 chose (rock, paper or scissors). Then appending on a random suffix phrase to complete the sentence. It will also have the random parts chosen on the basis of whether K9 won or lost a given round. Such as, if he won, the sentence might be: "Lucky me, I chose rock. Doing a happy dance in my mind!"

The parts being: "Lucky me," "I chose" "rock" "Doing a happy dance in my mind!"

If K9 loses: "Maybe next time. This time I selected paper. How can you be so lucky?".

Those parts being: "Maybe next time. This time " "I selected" "paper." "How can you be so lucky?"

Sounds complicated, but it's really not. I'll write over my old project with the new stuff on the cloud when I finish. And feel free to use whatever I have written in your version. The whole thing if you want. It's really still your creation. I'm just doing some grunt work on it. It's fun for me.

United Kingdom
#13  

@WBS.

No problem. Incorporate away.;)

If I get timeater today, I'll try to incorporate the point counter in to my version after I've moved a few things around. I'm still trying to think of another simple game I can try to add that's within my ability to write. I have a quiz idea, so maybe I'll give that a try.

#14  

Hi Steve; Hope you are doing well and having fun. I know I am. Nearly finished the changes I wanted to make. Even found a Script bug. Just wanted to share something about the random function. It occurred to me that if it was missing the last possibility (2), then the thing to do was eliminate that as being the last one. I did this simply by going one higher in the random function, from 2 to 3. Now it chooses a number from 0 to 3 instead. I used a following statement to make anything above 1=2. Like this:


$K9Choice =GetRandom(0,3)
if($K9Choice > 1)
  $K9Choice =2
endif  

This way the number 2 is no longer the last possible choice, 3 is. So 2 comes up as often as anything else. And if 3 happens to come up (which it rarely does, just like 2 rarely came up) then it is simply converted to 2. Seems to work well. I did the same thing in choosing a phrase from the GetRandom function.

Unfortunately the bug I found affects my method of choosing a random picture to show during a given round, but I have a work around for that for now. Not elegant, but work arounds rarely are.

United Kingdom
#15  

@WBS.

Hi. Yeah I'm good thanks. Hope you are too. The addition of adding another random possibility was similar to what I did and it works great now so all is good there now. Interesting find about the script bug you discovered (I just read your other thead asking about this), and glad you found a workaround. I might have a go at a multiple choice quiz this week using similar methods, so I'll keep you posted with how I get on with it.:)

United Kingdom
#16  

I have a new update for a quiz game idea I've been working on. Just finishing off the final touches.

United Kingdom
#17  

User-inserted image

Doctor Who Interactive Quiz

Another update with a new game to play with. After playing around with the Rock, Paper, Scissors project, I decided to do something on a slightly larger scale and with a different format. So I came up with a multiple choice quiz based in Doctor Who, 1, because I'm a fan of the show, and 2, because this quiz project will be part of my K-9's master project.

It uses the same idea of using the EXEC("") commands to show pictures relevant to the questions and answers used in the quiz that makes it more engaging to play. It has 15 questions with 4 possible answers to each question and corresponding replies spoken by K-9.

User-inserted image

This is a first draft of the quiz where by I only use a speech recognition control for the body of the quiz. I later plan to change it around and use a separate script manager to make the whole thing a little more compact and using variables to trigger the correct responses. The quiz can of course be adapted to use a different subject, use more or less questions and possible answers, and to use different pictures and phrases.

So here is a video demonstration of the quiz, with K-9 being quizmaster that I hope you will enjoy. You can play along too when watching to see how much you know about the show. @DJ. If you're reading this, it would be cool to see how many you get right;). By the way, I gave a few wrong answers in the video for demonstration purposes... honestly, that was the reason.:P

Enjoy.

I won't post all of the scripts here as it would make this post VERY long. But I have a basic project of the quiz on the cloud called "Doctor Who Quiz" and K-9's quiz project called "K-9's Doctor Who Quiz" that has all of his Cheat Sheet commands for his head movements. Anyway, let me know what you think. As always, I'd love to hear your thoughts.

Steve.:)

EDIT: I am writing up an Instructable describing how the quiz was put together that will hopefully generate more viewer interest towards EZ-Robot. I'll post a link when it's up.

#18  

Finally took the time to sit down and watch you're latest contest with K9 and it was Excellent! Not to mention entertaining.

The voice response you use with it is very nice. Is it another voice simply added to the default (and only) female voice in the current Windows -7 version, or is it something else entirely? I sometimes wonder if using Vocaloid would be a feasible way to go with a voice.

I've got an idea with using JDs vision processing to tell if I'm doing a rock paper or scissors gesture, but it will take some time to get right yet. I'll make a video when I do.

Anyway, keep up the great work! It's very inspiring.

United Kingdom
#19  

@WBS.

Thanks for your kind words, and in really pleased that you found the video enjoyable. I had similar thoughts about using the camera and recognition options for a game as well, like a simple card game or something, but that's something for another time. BTW, the voice K-9 has hat you asked about is a third party one from Cepstral, which is installed on my Windows 8.1 laptop and K-9's Acer W3 tablet. I wanted something that had a slight robotic sound to it and Cepstral seems to be the only computer speech company that offer voice effects as part of their package.

Although my games thread doesn't seem to have sparked much interest on here, it's gained some interest through others sources, as I've had a few nice emails sent to me asking about the quiz and K-9's build in general, which is nice. The quiz video also had some positive comments on the "Let's make Robots" site, with one person who commented saying they are looking to "take the plunge" and get involved with EZ-Robot which was very cool to see, and is the reason why I share what I do elsewhere as I like to support and promote EZ-Robot where possible.

United Kingdom
#20  

User-inserted image

So I've published an Instructable that describes how the Doctor Who interactive quiz was put together, with information on how to train voice recognition. It also breaks down and explains the different elements of one of the scripts used to showcase the ease of using EZ-Script, in a hope of bringing more customers over to EZ-Robot.

The Instructable has also been entered in to a "Fandom" competition as the quiz falls into the correct category, where if you scroll down the list, you can place a vote. If anyone would like to vote for my little project, you can also click here then click on "Vote". If you are kind enough to vote, myself and K-9 would be very grateful indeed. Also, I think my project is the only entry using the EZ-Robot platform, so it would be great to see this as runner up or even win. It would be great exposure for EZ-Robot, and of course K-9 would be happy about it too (and me).

Wish us luck.:D

#21  

Voting done. Thanks for the link to Cepstral. I'll be checking them out. I also found the information about building K9 on Let's Make Robots quite interesting.

Good luck with the contest! Seems like a win-win deal for everyone concerned.

#22  

I voted. I think. My phone did some weird stuff when I clicked the button.

United Kingdom
#23  

@WBS.

Thanks for your vote, and glad you found the "Lets make Robots" write up interesting. The only reason I posted it there was because of a post I read here a while ago saying that we should post our EZ-Robot builds there to show others what the EZ-Robot world is all about. You're welcome for the Cepstral link as well. If you decide to purchase one of their voices and use any voice effects they have, I'll be happy to help if you need it, as a little bit of set up is required.

@Dave.

Quote:

My phone did some weird stuff when I clicked the button.

I had a chuckle when I read that. Isn't technology a wonderful thing, lol. Seriously though, thanks for your vote too.:)

United Kingdom
#24  

Quick question for anyone who can help. I have an idea for another game that require watching a video which is embedded in to a website. Is there a way of doing this?

Here's what I would need to happen...

Game starts on ARC and opens up a website using the browser command.

Website opens then a short embedded video start would need to start playing automatically.

Ideally I would like to have the video automatically go full screen.

Once video has played, browser closes and returns back to ARC.

The embedded videos that play are using Adobe to do so. Sure I could download the video and play them off my C: drive, but the videos are dynamic and change daily which is what the game is based on. Any ideas on how to achieve this?

Thanks.

#25  

Is this video playing on the PC or the tablet on the K-9?

United Kingdom
#26  

On the tablet (or PC as they are both Windows 8.1).

#27  

Ok, I don't know about Adobe but you can use the Exec function again like this:


$WebSite ="https://www.youtube.com/v/?v=VrKdLSiUvaM&autoplay=1 "
Exec($WebSite)

The things to notice are: The substitution of the "watch" portion of the Youtube link with v/. As in: $WebSite ="https://www.youtube.com/watch?v=VrKdLSiUvaM&autoplay=1" Exec($WebSite) $WebSite ="https://www.youtube.com/v/?v=VrKdLSiUvaM&autoplay=1" Exec($WebSite)

That starts it in full screen. The "&autoplay=1" added at the end gets it playing upon loading.

Hope that helps.

EDIT: Oddly, if you click the link in this post it does not come up playing. However, running it in a script it does.

EDIT AGAIN: There seems to be an oddity in the character combination of 1" in my post. Somehow it comes up as 1"; in the post. This, in turn, makes the link not work quite right. If I add a space to separate the 1 from the " things work properly and, in this case, the video starts up upon loading as it should. Just a little quirk in the system. Much like me, come to think of it. :D

United Kingdom
#28  

@WBS.

Okay cool. I,ll give that a try shortly.

Thanks.

United Kingdom
#29  

@WBS.

I tried the...

$WebSite ="https://www.youtube.com/watch?v=VrKdLSiUvaM&autoplay=1 " Exec($WebSite)

and it worked straight off which was great which was cool, so thank you for that (funny why just clicking the link doesn't work). Couldn't get the..

$WebSite ="https://www.youtube.com/v/?v=VrKdLSiUvaM&autoplay=1 " Exec($WebSite)

to work though. Anyway here is an example of a website that has an embedded weather video that uses Adobe Flash Player to play it...

BBC Weather for London

If I could get this sort of thing to work, that would be great if anyone else has any ideas.:)

#30  

I'll take another stab at it. This assumes you have the entire internet path to the flash video you want to play. eg: http://Mysite.com/MyFlashVideo.swf.
Because the settings needed have quote marks in them, they can't be copied into variables in the scripts so I opted for a generic file to reside on the hard disk somewhere. The code for it is:


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Flash Video</title>
</head>

<body style="margin:0">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="100%" height="100%">
  <param name="movie" value="http://Yoursite.com/MyFlashVideo.swf" />
  <param name="quality" value="high" />
  <param name="wmode" value="transparent">
  <PARAM NAME="SCALE" VALUE="exactfit">
     <embed src="http://Yoursite.com/MyFlashVideo.swf"
      quality="high"
      type="application/x-shockwave-flash"
      WMODE="transparent"
      width="100%"
      height="100%"
     SCALE="exactfit" 
      pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html>

Just copy and paste the above into a notepad and save it under the name of your choice with the "html" extension.

Note that you have to enter the http path and swf name twice. Once for the "Movie" param name and once for the "embed src" tag.

Then, in the script, use the Exec command to run it when desired as in:


Exec("C:\RunTheFlash.html")

Don't know it that's quite what you want but maybe it will lead you to it.

United Kingdom
#31  

@WBS.

Thanks for the info you posted above. Unfortunately it didn't work for me. I put un the URL I was testing with but a blank page came up. Below is a screen grab of the web page containing the relevant info...

User-inserted image

www.bbc.co.uk/weather/2643743

I tried different variations and managed at one point to open the site, but wouldn't play the video. I guess I'm not to fussed with this at the moment so may put it on the back burner for now. but if you, or anyone else reading for that matter, would like to play around with it further if you have time, I would be grateful.

Steve.

#32  

Yeah, that's the problem. To make my method work you have to know the exact path to the flash file you want to play, as well as, the name of the file. Looking at the source code for the web page you specified I believe I found the name and path for the file in question, Problem is, like many web sites, it is obfuscated so that people can't just play it alone. They want you to have to open the web page (and see the ads) to be able to play it. For this they also have their own system of playing the Flash files to further hide it.

I tried just adding the extension "swf" to see if it would play, but it wouldn't which confirmed my suspicions. Thing is, even if I could get it to play, the name will change every time they update the file so you would have to find the new name and enter it in the html file every time. That could probably be automated, but would not be worth it if you can't even play the file anyway. I'll look about and see if anyone has an answer to all this and let you know.

United Kingdom
#33  

Thanks buddy. It was worth a shot a guess. If you did find a solution that would be cool, but please don't put yourself out on my account looking in to this any further, and I'm greatful for the help you have offered already.:)

Steve.

United Kingdom
#34  

I thought I'd revive this thread and ask if anyone has any ARC games they would like to share with everyone? I was going to try and come up with another game, but my current E4-B4 build is taking up my spare time.

United Kingdom
#35  

If I get more time or ideas to post some more game, I will post them here. Suggestions are always welcome.