Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited

Goto Question

using the goto command, it takes you to the specified command.
does it keep playing the following commands so you can cause a loop or do you do that another way?

AI Support Bot
Related Content
Based on your post activity, we found some content that may be interesting to you. Explore these other tutorials and community conversations.
subsequent instructions that would be below the goto command would not be executed.
Goto moves your location to the :Label

To return back from a goto() call, you use return
United Kingdom
Example Goto Script;


$count = 0
Print("Hello World")
$count = $count++
If($count = 10)

This code will loop around 10 times, display "Hello World" 10 times then go to the end, print "Goodbye" and stop.

An example goto Script with a return (aka V1 of my IR detector script);


# IR Detector Script
# Object avoidance using IR sensor on ADC port

# Adjust values below for configuration
$iradcport = ADC6 # Change for ADC Port with sensor attached
$maxirdistance = 35 # Change for maximum distance from object before avoiding in units
$irreverseturn = 0 # Reverse before turn? 0 = no, 1 = yes
$irturndirection = 0 # Change 0 = left or 1 = right
$irturnamount = 500 # Change for how long to turn for in ms
$irreverseamount = 500 # Change for how long to reverse for in ms (if applicable)
$irmovementspeed = 255 # Change for movement speed

# -- Do not modify below this line --

IF ($irreverseturn = 1)
ELSEIF ($irturndirection = 0)

$currirdistance = GetADC($iradcport)
IF ($currirdistance >= $maxirdistance)
Sleep (50)

Now the script itself is written a bit back to front, the detect routine could have been placed above avoid and the initial goto removed. However this is a great example of how the goto, labels and return work.

The script (after the config part) will Goto the detect routine, it will check the ADC value of the IR sensor fitted to the EZB ADC port and if it meets the criteria it will Goto the avoid routine otherwise it will Goto the start of the detect routine.

The avoid routine runs it's commands to reverse and turn, then it Returns to where it came from, in this case, the detect routine.

Note the formatting of the explanation. Bold are the commands and italic are the labels.
United Kingdom
It's a pleasure. It's also why I comment my scripts and I am going to claim that writing the above script backwards was all part of my plan to show Gotos and Returns (although it wasn't, I still have no clue why I wrote it that way round).

The script I used above also shows off If, ElseIf and Else, it's a great script to show someone as an example of some of the most used commands in EZ-Script. If only I had a reason to write more scripts... nothing is as relaxing as writing a script and little is as satisfying as writing a script which works:)