Users Manual
CLASS 3
124
Activity
Tori secret safe door motion coding
Now let's create a script when we receive the 'doorlock check' broadcast. The role of the 'when doorlock check
is received' script is to broadcast a message that the door is closed if the number entered when the door is open
matches the password. If the number entered when the door is closed matches the password, the door will open.
Let’s go ahead and make it!
Create a script like the one above.
First, when you receive the "doorlock check" broadcast, this script is executed. In this case, we use 'if ~ or' blocks.
This block can be found in the Controls tab. This block is similar to the 'if' block we learned earlier. Just the
‘or~’ part is added to the ‘if’ block. In other words, if it does not satisfy the condition of 'if' block, then the script
contained inside ‘or~’ part will be executed. If it satisfies the condition of ‘if’ block, then the script inside the ‘if’ block
will be activated and the script inside the ‘or~’ part will not.
If you meet the condition 'door = open' in the block or 'block' (if the door is open), you will go inside and broadcast
'Close_Check'. If you do not meet this condition, you can go inside and broadcast 'Open_Check'. 'Close_Check' is
a script that closes a door if it is matched against a password and does not close a door if it is not. 'Open_Check' is
a script that opens the door when matches the password but does not open the door if it does not match.
Now let's take a look at the two scripts that were broadcast on the next page.
The two scripts are very similar, so if you understand them well, you can easily code them.