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...
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.
Other robots from Synthiam community

Pashley's Jd Days

Jstarne1's Building A Giant 3D Printer 720X350x~400Mm Build...

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.
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.
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.
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.
@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.
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.
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.
I voted. I think. My phone did some weird stuff when I clicked the button.
@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.
I had a chuckle when I read that. Isn't technology a wonderful thing, lol. Seriously though, thanks for your vote too.
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.