This example shows how to give the user a message after a certain amount of time has past. This can be a useful way to give the user a hint.
We will create a simple script with a screen message. If the user does not click the 'ok' button on the message after three seconds, a voice over will play asking the user to click 'ok'.
This method will work for any type of hint that uses a timer.
Step 1 - Add a Screen Message a Script
In a new script, drag a Playable Content Screen Message into a frame.
Give the Screen Message a title and some text. I will use 'Welcome' for the title and 'Click 'ok' to continue' for the text.
Step 2 - Add a Notification After the Welcome Message Closes
When the user does click the 'ok' button, the welcome Screen Message will close. Let's make a notification appear in that case.
Click the blue '+' button at the bottom of the Screen Message and select 'close'.
A new frame will be created. The condition will be an Object Event condition checking to see if the Screen Message has closed.
Add a Notification to this frame. Enter 'Done!' as the message.
When the user closes the screen message, a notification will appear that says 'Done!'. Save the script.
Step 3 - Add a Frame with a Timed Message
At the moment, the script looks like this:
Add a new frame by clicking the '+' button on the Welcome frame.
Name the new frame 'Timed Hint'. We'll add a voice over that will remind the user to click the 'ok' button. If you haven't yet created a voice over audio file, you can do that by following the steps in this article.
Add an audio resource to the frame and add your voice over audio file to the media frame.
We need the right condition. We only want this audio to play when:
- Three seconds have passed since the Welcome screen appeared
- The Welcome screen has not been closed (the button has not been pressed)
For the first part, we can use a Timer Condition. Drag a Timer Condition into the frame. Then type 3 into the seconds field.
We want to add a second condition to this frame. If you'll remember, the frame with the Notification has a condition which is waiting for the Welcome message to close. We want the opposite of that for our second condition in this frame.
Drag an Object Event condition into this frame. This will create a Compound Condition with the Timer Condition we just added and the Object Event Condition.
- Operator - This is set to 'And'. This means both conditions must be true for the audio to play
- Script Object - Welcome message
- Event - 'Close'
- Negate Result - Checked. This means, for the Object Event condition check the opposite. The Object Event condition is checking if the Welcome message is closed but since this box is checked, it means, anything except closed.
In plain language, this condition asks:
"Have three seconds past and is the welcome message is not closed?"
If that is true, the voice over audio will play. That might be enough. There is one final step which can be used or not.
As it is, if the voice over audio starts playing and the user clicks the 'ok' button before the audio has finished, the audio will play until it is done. If you want the audio to stop immediately when the 'ok' button is clicked, go to the next step.
Step 4 - Close the Timed Hint Frame
If the user clicks the 'ok' button, the timed hint isn't needed any more. We can close the frame that contains the hint once we know the user is past that point.
Once the Notification is displayed, we know that the 'ok' button has been clicked. In that frame, we can add another resource called Close Frame. Drag the resource into the frame with the Notification.
Select 'Timed Frame' in the Frame drop down and save the script.
Now the Timed Hint frame will close as soon as the Welcome screen 'ok' button is clicked.
A closed frame will never activate. It will also close the frame immediately. If the user clicks the 'ok' button while the voice over hint is playing, the close frame will stop the audio from finishing.