|

Let's modify the script on our button object's On Click event to only display the message if it is "Hello world!".


1 ) D oubl e - c li ck on t h e bu tt on obj ec t . E di t t h e On C li ck s cr ip t t o a dd a n i f s t a t eme n t , li ke t hi s :


i f s t r M s g == " He llo Wo r ld !" t h e n

D i a log. M e ss a g e ("E very d ay I w ake up a nd s ay ... " , s t r M s g ) ; e nd


Use a tab character to indent the original "Dialog.Message..." line to the right a little. (It's good practice to indent any lines inside an if statement in order to help make the logic easier to follow.) To insert a tab character at the start of the line, place the cursor to the left of the "D" and press the Tab key.


image

Tip: You can indent one or more lines at once by highlighting them and pressing Tab to increase the indent (to the right), or Shift+Tab to decrease the indent (to the left).


|