Are you sure? Button

Touch Portal Snippets

A button that shows you an "are you sure" message before doing the actual action. Handy for dangerous actions.

Are you sure?

On Press

When you press this button, it will turn the button ON. After 3 seconds, the state will be turned to OFF again. These three seconds is your window to be able to run the action.

When you press the button again during those 3 seconds, the state is still ON and thus the ELSE part of the button will be executed. The very dangerous script will be run.

If you wait for those 3 seconds and press the button, the state will be OFF again so it will not run the script.

On Event

In the on event section we turn the button to red with the title "Sure?" when the button turns to ON. Which the button state is during 3 seconds after pressing it.

If the button is OFF it will show the normal version, pink-ish with the title "Scary Action".

End Result