VEXcode VR allows users to disable and enable blocks within their projects. This is a useful feature for testing or debugging a project without having to take the project apart. The user can disable or enable a block(s) to test the differences in the robot’s behavior when that block is or is not in the project.
This article will cover:
- How to disable and enable blocks
- What happens to individual blocks when disabled
- What happens when a block with nested blocks is disabled
- Disabling and enabling a single nested block
- Disabling a “hat” block
How to disable and enable blocks
To disable a block, right-click or long-press on the block to activate the Context Menu and then select Disable Block.
To enable a disabled block, activate the Context Menu for that block and select Enable Block.
What happens to individual blocks when disabled
While a block(s) is disabled, it is shown grayed out with a grid of diagonal lines over it.
The disabled block is treated like a comment. It has no effect on the flow of the project.
In the example project above, the robot will not wait after driving in reverse, but will immediately turn right.
What happens when a block with nested blocks is disabled
When you disable a block with blocks nested within it, all of the blocks are disabled. Blocks like a loop or if-then-else conditional, that have nested blocks, can be disabled in the same way a single block can.
Activate the Context Menu of that loop or conditional Control block, and then select Disable Block.
The image below shows what happened when the repeat loop was disabled. The loop and the two blocks inside of it were all disabled.
You can enable the main block and all nested blocks within it by activating the Context Menu of the main block and selecting Enable Block.
When the main block is enabled, all nested blocks will also be enabled.
Disabling and enabling a single nested block
You can disable single blocks within a loop or if-then-else by following the same steps for disabling any other block: activate that block’s Context Menu and choose Disable Block.
Here is an example of only disabling a single block within a loop.
The Context Menu for the main block will not provide an option for enabling the nested block because the main block was not disabled.
If later you want to enable that nested block, you will need to activate its Context Menu.
Disabling a “hat” block
You can disable an entire stack of blocks by disabling the “hat” block that contains them all.
Activate the Context Menu of the “hat” block, and then select Disable Block.
The image below shows what happened when the When Started “hat” block is disabled. All of the blocks contained under the When Started block will not run.