lesson
What starts a script?
1 · Learn
An event can start a set of program instructions. Clicking a start button or pressing an assigned key can be an event. The commands after that event run when it occurs.
Two scripts may have different starting events. Plan them clearly so a user knows what to do. Pressing the wrong key may not trigger the script at all; that is different from an error inside its sequence.
2 · Worked example
I assign A to a bell and B to a drum. Pressing B should start the drum script, not the bell script.
3 · Your turn
If a script starts only when A is pressed, must clicking anywhere on the screen start it?
Check your answer
No. It runs in response to its specified event unless another part of the program also starts it.
4 · Apply your learning
Make two labelled event scripts in an approved block tool. Test each trigger separately and explain the result to a partner.
Adult guidance and safety
Use an adult-approved offline or school-managed application. Use invented data, original images and pretend identities. Paper models explain an idea but must be followed by suitable practical device work. Never enter real passwords or personal information in the working pad.
Open your writing and drawing pad
Write, draw or show your working. Use a mouse, pen or finger. This pad is not a submitted answer.
Not saved to your account. Download your drawing as PNG and your typed notes as TXT before leaving or refreshing. They are separate files. Do not enter private information.
Open a picture saved on this device to draw on it again. Opening replaces the drawing, but Undo can restore it. PNG only, up to 4 MB and 4096 × 4096 pixels. The picture stays in this browser; it is not uploaded. Paper lines in a saved picture become part of that picture.
Clear the drawing? Your typed notes will stay. You can undo this action.
Your pad is empty.
Open a UTF-8 TXT file from this device, up to 40 KB and 10,000 characters. It stays in this browser. Opening can be undone until you type again. Downloads keep a new copy; they do not change the file you opened.
Replace the notes on this page with the opened file? Download the current notes first if you want to keep them.
Typed notes are not submitted answers.
Practice this lesson
Lesson resources
Browse the available practice activities and worksheets for this lesson.
Your progress