Canada
Asked — Edited
Resolved Resolved by Rich!

Help Needed Converting This Script From Python To Ez-Script

I have switched my robot over to Ez-Robot and I need some help converting the following Python script over the EZ-Robot language.

if (data == "lets do some math"): math()

if (data == "one"):
      one()
      global first
      first += 1
      print(first)

if (data == "two"):
      two()
      global first
      first += 2
      print(first)

if (data == "three"):
      three()
      global first
      first += 3
      print(first)

if (data == "four"):
      four()
      global first
      first += 4
      print(first)

if (data == "five"):
      five()
      global first
      first += 5
      print(first)

if (data == "add one"):
      plusone()
      global second
      second += 1
      print(second)

if (data == "add two"):
      plustwo()
      global second
      second += 2
      print(second)

if (data == "add three"):
      plusthree()
      global second
      second += 3
      print(second)

if (data == "add four"):
      plusfour()
      global second
      second += 4
      print(second)

if (data == "add five"):
      plusfive()
      global second
      second += 5
      print(second)

if (data == "what does that equal"):
      equals()
      global number
      number = (first+second)
      i01.mouth.speak(str(first) + "plus" + str(second) + "is" + str(number))
      global first
      first = (first + second)
      global second
      second = 0

if (data == "start over"):
      i01.mouth.speak("OK")
      rest()
      sleep(2)
      i01.mouth.speak("ready")
      global first
      first = 0
      global second
      second = 0
      print("starting from 0")

It's a script where the robot does addition. Can anyone help me out with this, thanks


ARC Pro

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.

#17  

@ Rich and @ d.cochrane Thanks for your help with this. I should mark this resolved but I don't know who to give it to. You have both given me something to use in my quest to get this script working with Ez-Robot. What to do?

#18  

I think that Rich and I are about the same in that we help just to help. I dont think either of us care about who gets credit. its just good that we can help some.

#19  

I've been prompted to mark this resolved. I could use some more help to get me going, so I'll leave it active for a couple more days, just in case someone has anymore thoughts on it.

United Kingdom
#20  

For the record, if there's ever any question of who to give credit to between me and anyone else, give it to the other guy (unless I've provided more help that is). At this point I'd like to think that almost 300 questions answered I can let a few slide when it's close.

Which part do you need more help on?

I only quickly read over the above again but it looks like you want to use WaitForSpeech()

This will hold the script until the command is spoken.

Use that spoken command to set a variable or in an IF statement to trigger commands or responses.

Or use the speech recognition control for speech commands. When one is spoken have that trigger a script or control or sequence of events using ControlCommand()

#21  

Thanks for everyone's help. I'll have more questions I'm sure,