Robot-Specific Blocks#
Introduction#
The Rover Rescue Playground features blocks exclusive to the VR Rover, including custom Drivetrain, Actions, and Sensing category blocks.
The VR Rover has access to the standard VR Events, Control, Operators, Variables, My Blocks, and Comments blocks.
Below is a list of all available Playground-specific Blocks:
Drivetrain - Move and monitor the VR Rover.
Actions
drive - Drives the VR Rover continuously forward or in reverse.
drive for - Drives the VR Rover for a set distance.
turn - Turns the VR Rover continuously left or right.
turn for - Turns the VR Rover a specific number of degrees.
turn to heading - Turns the VR Rover to face a specific heading.
go to object - Turns and drives the VR Rover to the selected object.
stop driving - Stops all rover movement.
Settings
set drive velocity - Sets the speed for drive blocks.
set turn velocity - Sets the speed for turn blocks.
set drive heading - Manually sets the rover’s heading value.
set drive timeout - Limits how long drivetrain blocks wait to reach their target.
Values
drive is done? - Returns whether the drivetrain is no longer moving.
drive is moving? - Returns whether the drivetrain is currently moving.
drive heading - Returns the drivetrain’s current heading in degrees.
Actions - Interact with the rover’s resources, enemies, and built-in AI systems.
Actions
minerals action - Picks up, drops, or uses minerals.
absorb enemy radiation - Absorbs radiation from an enemy.
standby - Puts the VR Rover into standby mode until a battery threshold is reached.
Values
rover sees - Returns whether the VR Rover sees an object in its vision range.
rover detects - Returns whether the VR Rover detects minerals or enemies in its detect radius.
minerals in storage - Returns how many minerals the VR Rover is carrying.
storage capacity - Returns the VR Rover’s current carrying capacity.
rover direction - Returns the direction to an object in degrees.
rover distance - Returns the distance to an object in millimeters or inches.
rover location - Returns the X or Y coordinate of an object in millimeters or inches.
under attack? - Returns whether the VR Rover is currently under attack.
enemy level - Returns the level of the closest detected enemy.
enemy radiation - Returns the radiation of the closest detected enemy.
battery level - Returns the VR Rover’s current battery level in %.
level - Returns the VR Rover’s current level.
XP - Returns the VR Rover’s current experience points.
when under attack - Runs attached blocks when the VR Rover is attacked.
when level up - Runs attached blocks when the VR Rover levels up.
Sensing - Detect nearby objects with the rover’s Distance Sensor.
Distance found an object? - Returns whether the Distance Sensor detects an object.
object distance - Returns the distance to the nearest detected object.
The examples on this page use the default Playground start position.
Drivetrain#
Actions#
drive#
The drive block moves the drivetrain forward or in reverse using the current drive velocity. This block runs continuously until another Drivetrain block interrupts it or the project stops.
drive [forward v]
Parameters |
Description |
|---|---|
direction |
The direction the robot drives:
|
Example
when started
[Drive forward, then stop.]
drive [forward v]
wait (2) seconds
stop driving
drive for#
The drive for block moves the drivetrain forward or in reverse for a specified distance using the current drive velocity.
drive [forward v] for (200) [mm v] ▶
Parameters |
Description |
|---|---|
direction |
The direction the robot drives:
|
distance |
The distance the robot drives, as an integer or decimal. |
unit |
The unit of measurement:
|
expanding arrow |
By default, this is a waiting block, so the drivetrain will finish moving before running the next block. Expand the block to say and don’t wait to make it non-waiting. |
Example
when started
[Drive forward for 500 mm.]
drive [forward v] for (500) [mm v] ▶
turn#
The turn block turns the drivetrain continuously left or right using the current turn velocity. The drivetrain will keep turning until another Drivetrain block runs or the project stops.
turn [right v]
Parameters |
Description |
|---|---|
direction |
The direction the robot turns:
|
Example
when started
[Turn right, then stop.]
turn [right v]
wait (2) seconds
stop driving
turn for#
The turn for block turns the drivetrain left or right for a specific number of degrees using the current turn velocity.
turn [right v] for (90) degrees ▶
Parameters |
Description |
|---|---|
direction |
The direction the robot turns:
|
angle |
The number of degrees the robot turns, as an integer or decimal. |
expanding arrow |
By default, this is a waiting block, so the drivetrain will finish turning before running the next block. Expand the block to say and don’t wait to make it non-waiting. |
Example
when started
[Turn left, then turn right.]
turn [left v] for (90) degrees ▶
turn [right v] for (180) degrees ▶
turn to heading#
The turn to heading block turns the drivetrain to face a specific heading using the current turn velocity.
turn to heading (90) degrees ▶
Parameters |
Description |
|---|---|
heading |
The absolute heading the drivetrain will turn to, from -360 to 360 degrees. |
expanding arrow |
By default, this is a waiting block, so the drivetrain will finish turning before running the next block. Expand the block to say and don’t wait to make it non-waiting. |
Example
when started
[Turn to face east.]
turn to heading (90) degrees ▶
go to object#
The go to object block turns and drives the VR Rover to the selected object.
go to [minerals v] ▶
Parameters |
Description |
|---|---|
object |
Which object the VR Rover will go to:
|
expanding arrow |
By default, this is a waiting block, so the rover will finish moving before running the next block. Expand the block to say and don’t wait to make it non-waiting. |
If the VR Rover detects multiple minerals or multiple enemies, it will move to the closer option.
If minerals or an enemy are not detected in the rover’s visual range when the block runs, the robot will not drive. The base can always be targeted.
Example
when started
[Drive to the closest mineral.]
go to [minerals v] ▶
stop driving#
The stop driving block immediately stops all movement of the drivetrain.
stop driving
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
[Drive forward, then stop.]
drive [forward v]
wait (4) seconds
stop driving
Settings#
set drive velocity#
The set drive velocity block sets the default movement speed as a percentage for all subsequent drive blocks in the project. By default, the drive velocity is set to 50%.
set drive velocity to (50) [% v]
Parameters |
Description |
|---|---|
velocity |
Sets the default movement velocity from 0% to 100%. |
Example
when started
[Move faster.]
set drive velocity to (100) [% v]
drive [forward v] for (100) [mm v] ▶
set turn velocity#
The set turn velocity block sets the default velocity as a percentage for all subsequent turn blocks in the project. By default, the turn velocity is set to 50%.
set turn velocity to (50) [% v]
Parameters |
Description |
|---|---|
velocity |
Sets the default turn velocity from 0% to 100%. |
Example
when started
[Turn faster.]
set turn velocity to (100) [% v]
turn [right v] for (90) degrees ▶
set drive heading#
The set drive heading block sets the gyro’s current heading to a specified value.
set drive heading to (0) degrees
Parameters |
Description |
|---|---|
heading |
The heading value to assign, in degrees. |
Example
when started
[Set the heading, then turn to 0 degrees.]
set drive heading to (90) degrees
turn to heading (0) degrees ▶
set drive timeout#
The set drive timeout block sets a time limit for how long a Drivetrain block will wait to reach its target. If the robot cannot complete the movement within the set time, it will stop automatically and continue with the next block.
Note: The drivetrain’s time limit is used to prevent Drivetrain blocks that do not reach their target position from stopping the execution of other blocks in the stack.
set drive timeout to (1) seconds
Parameters |
Description |
|---|---|
time |
The maximum number of seconds a Drivetrain block will run before stopping and moving to the next block. |
Example
when started
[Drive for at most 1 second.]
set drive timeout to (1) seconds
drive [forward v] for (25) [inches v] ▶
Values#
drive is done?#
The drive is done? block returns a Boolean indicating whether the drivetrain is not moving.
True - The drivetrain is not moving.
False - The drivetrain is moving.
Note: This block only detects movement from blocks that can expand to show the and don’t wait option.
<drive is done?>
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
[Start turning when the drive is complete.]
drive [forward v] for (200) [mm v] ◀ and don't wait
wait until <drive is done?>
turn [right v] for (360) degrees ▶
drive is moving?#
The drive is moving? block returns a Boolean indicating whether the drivetrain is moving.
True - The drivetrain is moving.
False - The drivetrain is not moving.
Note: This block only detects movement from blocks that can expand to show the and don’t wait option.
<drive is moving?>
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
[Print while the rover is moving.]
drive [forward v] for (200) [mm v] ◀ and don't wait
while <drive is moving?>
print [Still Moving...] ▶
wait (0.1) seconds
clear all rows
end
print [Done!] ▶
drive heading#
The drive heading block returns the drivetrain’s heading angle as a decimal number, in the range 0 to 359.99 degrees.
(drive heading in degrees)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
[Display the heading after turning.]
turn [right v] for (90) degrees ▶
print (drive heading in degrees) ▶
set cursor to next row
Actions#
Actions#
minerals action#
The minerals action block interacts with minerals in the Rover Rescue Playground.
minerals [pick up v]
Parameters |
Description |
|---|---|
action |
What to do with minerals:
|
Picking up minerals stores them in the VR Rover until they are dropped or used.
Using minerals replenishes some of the VR Rover’s energy. Minerals can only be used if they are on the ground.
The VR Rover gains Experience Points (XP) by using minerals or dropping them at the base.
Example
when started
[Drive to the closest mineral and pick it up.]
go to [minerals v] ▶
minerals [pick up v]
absorb enemy radiation#
The absorb enemy radiation block absorbs radiation from an enemy in the Rover Rescue Playground.
absorb radiation
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
[Drive to the closest enemy and absorb radiation.]
go to [enemy v] ▶
absorb radiation
standby#
The standby block puts the VR Rover into standby mode until the specified battery threshold is reached.
standby until [50] % battery
Parameters |
Description |
|---|---|
percent |
The battery threshold that causes the VR Rover to exit standby mode, from 0 to 100. |
While in standby, the VR Rover uses its battery more slowly, but the Number of Days Survived counter increases at a higher rate.
When the battery reaches the selected threshold, the VR Rover exits standby mode and returns to normal battery usage and day progression.
If the selected threshold is equal to or above the current battery level, the VR Rover will not enter standby mode.
Example
when started
[Wait in standby until battery reaches 35%.]
standby until [35] % battery
go to [minerals v] ▶
Values#
rover sees#
The rover sees block returns a Boolean indicating whether the VR Rover sees the selected object using its built-in AI technology.
True - The selected object is within 1000 millimeters of the VR Rover and within its field of view.
False - The selected object is farther than 1000 millimeters away and/or outside the field of view.
<sees [minerals v]?>
Parameters |
Description |
|---|---|
object |
Which object to check for:
|
The VR Rover’s field of view is 40 degrees, shown in the mini-map as the gray translucent cone extending from the front of the rover.
Example
when started
forever
if <sees [minerals v]?> then
go to [minerals v] ▶
end
end
rover detects#
The rover detects block returns a Boolean indicating whether the VR Rover detects minerals or enemies using its built-in AI technology.
True - The selected object is within the rover’s detect radius.
False - The selected object is not within the rover’s detect radius.
<detects [minerals v]?>
Parameters |
Description |
|---|---|
object |
Which object to detect:
|
The VR Rover’s detect radius is 800 millimeters, shown in the mini-map as the yellow circle around the rover.
Example
when started
forever
if <detects [minerals v]?> then
go to [minerals v] ▶
end
end
minerals in storage#
The minerals in storage block returns the current amount of minerals the VR Rover has in its storage.
(minerals in storage)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
print (minerals in storage) ▶
set cursor to next row
storage capacity#
The storage capacity block returns the carrying capacity of the VR Rover’s storage.
(storage capacity)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
print (storage capacity) ▶
set cursor to next row
rover direction#
The rover direction block returns the direction from the VR Rover to the selected object in degrees.
([minerals v] direction in degrees)
Parameters |
Description |
|---|---|
object |
Which object’s direction to report:
|
For minerals and enemies, this block only reports values when the selected object is within 1000 millimeters and inside the rover’s 40 degree field of view.
If base is selected, the direction is reported even when the base is not in the field of view. For the base, this block reports a value from -180 to 180 degrees.
Example
when started
print ([minerals v] direction in degrees) ▶
set cursor to next row
rover distance#
The rover distance block returns the distance from the VR Rover to the selected object.
([minerals v] distance in [mm v] :: custom-actions)
Parameters |
Description |
|---|---|
object |
Which object’s distance to report:
|
unit |
The unit used to report the distance:
|
For minerals and enemies, this block only reports values when the selected object is within 1000 millimeters and inside the rover’s 40 degree field of view.
If base is selected, the distance is reported even when the base is not in the field of view.
Example
when started
print ([minerals v] distance in [mm v] :: custom-actions) ▶
set cursor to next row
rover location#
The rover location block returns the X or Y coordinate of the selected object using the rover’s built-in AI technology.
([minerals v] location [X v] in [mm v])
Parameters |
Description |
|---|---|
object |
Which object’s location to report:
|
axis |
Which coordinate to return:
|
unit |
The unit used to report the coordinate:
|
For minerals and enemies, this block only reports values when the selected object is within 1000 millimeters and inside the rover’s 40 degree field of view.
If base is selected, the location is reported even when the base is not in the field of view.
Example
when started
print ([base v] location [X v] in [mm v]) ▶
set cursor to next row
print ([base v] location [Y v] in [mm v]) ▶
set cursor to next row
under attack?#
The under attack? block returns a Boolean indicating whether the VR Rover is currently under attack from an enemy.
True - The VR Rover is under attack.
False - The VR Rover is not under attack.
<under attack?>
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
forever
if <under attack?> then
drive [reverse v] for [500] [mm v] ▶
end
end
enemy level#
The enemy level block returns the level of the closest enemy detected by the VR Rover.
(enemy level)
Parameters |
Description |
|---|---|
This block has no parameters. |
When no enemies are detected in the VR Rover’s detect radius, this block returns 0.
Example
when started
forever
if <(enemy level) [math_equal v] [1]> then
go to [enemy v] ▶
else
drive [reverse v] for [500] [mm v] ▶
end
end
enemy radiation#
The enemy radiation block returns the radiation of the closest enemy detected by the VR Rover.
(enemy radiation)
Parameters |
Description |
|---|---|
This block has no parameters. |
When no enemies are detected in the VR Rover’s detect radius, this block returns 0.
Example
when started
print (enemy radiation) ▶
set cursor to next row
battery level#
The battery level block returns the current battery level of the VR Rover as a percent.
(battery level in % :: custom-actions)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
print (battery level in % :: custom-actions) ▶
set cursor to next row
level#
The level block returns the current level of the VR Rover.
(level)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
print (level) ▶
set cursor to next row
XP#
The XP block returns the current number of Experience Points the VR Rover has.
(XP)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when started
print (XP) ▶
set cursor to next row
when under attack#
The when under attack block runs its attached stack each time the VR Rover is attacked by an enemy.
when under attack
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when under attack
absorb radiation
when level up#
The when level up block runs its attached stack each time the VR Rover moves from one level to the next.
when level up
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
when level up
print [The VR Rover has leveled up!] ▶
set cursor to next row
Sensing#
Distance#
Distance found an object?#
The Distance found an object? block returns a Boolean indicating whether the Distance Sensor has detected an object within 2000 mm.
True - The Distance Sensor has detected an object.
False - The Distance Sensor has not detected an object.
<[distance v] found an object?>
Parameters |
Description |
|---|---|
distance sensor |
Which Distance Sensor to use. In this Playground, the available sensor is |
Example
when started
[Turn until the Distance Sensor detects an object.]
turn [right v]
wait until <[distance v] found an object?>
stop driving
object distance#
The object distance block returns the distance of the nearest object from the Distance Sensor.
([distance v] in [mm v])
Parameters |
Description |
|---|---|
distance sensor |
Which Distance Sensor to use. In this Playground, the available sensor is |
unit |
The unit of measurement:
|
Example
when started
[Wait until the Distance Sensor detects an object, then print the distance.]
turn [right v]
wait until <[distance v] found an object?>
stop driving
print ([distance v] in [mm v]) ▶