活动#

介绍#

An event is a starting signal for a set of blocks. Events blocks in VEXcode VR let different sets of blocks begin at different times. For example, one set of blocks can start when the project begins, and another can start when a signal is sent from somewhere else in the project.

开始时#

The when started hat block starts running the blocks below it when the project begins. Every project needs at least one when started block — without it, the blocks below it will not run. Multiple when started blocks can be used to run different sets of blocks at the same time.

开始帽子模块。#
当开始 :: hat events

参数

描述

此代码块没有参数。

例子

当开始 :: hat events
[Turn around at the start of the project.]
归位至 [180] 度 ▶

当我收到事件时#

The when I receive event hat block starts running the blocks below it when a signal with the same event name is broadcast.

当我收到事件帽子块时。#
当我收到 [my_event v]

参数

描述

事件

要触发的事件。用户可以选择现有事件、创建新事件、重命名所选事件或删除事件。

例子

当开始 :: hat events
[Broadcast after 3 seconds have passed.]
等到 <(计时器秒数) [math_greater_than v] [3]>
广播 [turn v]

当我收到 [turn v]
[When received, print a message and turn right.]
打印 [Received!] ▶
[右 v] 转 [90] 度 ▶

直播活动#

The broadcast event stack block sends a signal that starts any when I receive event block with the same event name. The rest of the blocks in the project keep running without waiting for those blocks to finish.

广播事件堆栈块。#
广播 [message1 v]

参数

描述

事件

要触发的事件。用户可以选择现有事件、创建新事件、重命名所选事件或删除事件。

例子

当开始 :: hat events
[Broadcast after 3 seconds have passed.]
等到 <(计时器秒数) [math_greater_than v] [3]>
广播 [turn v]

当我收到 [turn v]
[When received, print a message and turn right.]
打印 [Received!] ▶
[右 v] 转 [90] 度 ▶

直播活动并等待#

The broadcast event and wait stack block sends a signal that starts any when I receive event block with the same event name. The rest of the project will wait for the broadcasted event to finish running.

广播事件和等待栈块。#
广播 [message1 v] 并等待

参数

描述

事件

要触发的事件。用户可以选择现有事件、创建新事件、重命名所选事件或删除事件。

例子

当开始 :: hat events
[Broadcast after 3 seconds have passed.]
等到 <(计时器秒数) [math_greater_than v] [3]>
广播 [forward_and_turn v] 并等待
打印 [Movement done.] ▶

当我收到 [forward_and_turn v]
[When received, drive forward and turn right.]
驱动 [向前 v] [100] [毫米 v] ▶
[右 v] 转 [90] 度 ▶