Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Asked — Edited
Resolved Resolved by Rich!

Is There A Global Command For Repeating A Script That Was Just Executed?

I am looking to see if EZ Builder has a global command for repeating the last script executed.



#Nudge Right Script
# Turn turn the robot right just a little at a speed of 150, then return to max motor settings at 255
right(150, 200)
right(255, 1)


#Nudge left Script
# Turn turn the robot left just a little at a speed of 150, then return to max motor settings at 255
left(150, 200)
left(255, 1)

Then I would like to be able to repeat the last script executed, so I can make a Speech Recognition ControlCommand call to the "RepeatLastScript", that could repeat the last script played, so I can just use the phrase "Again", and possibly another one for "More", which would play the last executed Script twice.




Upgrade to ARC Pro

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

United Kingdom
Not that I'm aware of however a solution would be to add a variable to the end of each script and use this variable to see what was last run.

I.E. at the end of each script have


$lastrun = "Script Name Here"

Obviously change the Script Name Here part in each case.

Then, have your "Again" command use IF to check i.e.


IF($lastrun = "nudge left")
ControlCommand("nudge left", ScriptStartWait)
ElseIF($lastrun = "nudge right")
ControlCommand("nudge right", ScriptStartWait)
ElseIf($lastrun = "turn left")
ControlCommand("turn left", ScriptStartWait)
and so on
Wow @Rich . That worked perfect.

I put the following code in the Speech Recognition Window under the Phrase "Again".


IF($lastrun = "Nudge Left")
ControlCommand("Script Manager", ScriptStartWait, "Nudge Left")
ElseIF($lastrun = "Nudge Right")
ControlCommand("Script Manager", ScriptStartWait, "Nudge Right")
ElseIf($lastrun = "Nudge Forward")
ControlCommand("Script Manager", ScriptStartWait, "Nudge Forward")
ElseIf($lastrun = "Nudge Reverse")
ControlCommand("Script Manager", ScriptStartWait, "Nudge Reverse")

Thanks again Rich!

United Kingdom
If you have other scripts running these movements it may cause a few small issues but if they are only voice controlled it should be fine.

I'm happy to help.
So the solution to that would be to duplicate the scripts, but under different names if other scripts needed to ControlCommand to the same action?
United Kingdom
The issue would be that the last speech triggered script and the last run script may not be the same. An alternative, have the speech commands run the variable then ControlCommand to fire the script, so basically a 2 line script in the speech recognition command, the first line sets the variable, the second is the controlcommand.
That's the way I am doing it. Thanks.