
/`-                      Nod Programming Inc.                          -\
/`-                   Director6 - Lingo Help File                      -\
/`-                 http://come.to/NodProgrammingInc                   -\
/`-                     Help File By: Cheese                           -\


I. Making Sprites Visible/Invisible:

 Make a box (sprite 1) and a field "Nothing" (sprite 2) on the stage

Write frame script:    
        go to the frame

Right click sprite 1:   Script:
        on mouseenter
                set the visible of sprite 2 to false
        end
        on mouseleave
                set the visible of sprite 2 to true
        end

Modify: 
   enter the following in the frame script: (make field "Whatever" editable)
        on exitframe
                if field "Whatever" = "Cheese" then 
                         set the visible of sprite 1 to false
                else
                         set the visible of sprite 1 to true
                end if
        end
*note when your answer = "Cheese" the box sprite disappears


II Rollover: (same as mouseenter/mouseleave)
    place into frame script
        on exitframe 
                if rollover(1) then
                          set the visible of sprite 2 to false
                else
                          set the visible of sprite 2 to true
                end if
        end


III. Sprite Intersection: (Make a moveable circle for sprite 3)

        on exitframe
                 put empty into field "Nothing"
                 if sprite 3 intersects 1 then
                           put "Intersects!" into field "Nothing"
                 else
                           put empty into field "Nothing"
                 end if
                 if sprite 3 within 1 then
                           put "Nothing" into field "Nothing"
                 end if
        go to the frame
        end

*note now play with it and move sprite 3 into sprite 1


IV. Location of a Sprite:

        on exitframe
                  if the locH of sprite 1 < 200 then
                            set the stagecolor = 10
                  else
                      if the locH of sprite 1 > 300 then
                                   set the stagecolor = 55
                      else
                                   set the stagecolor = 100
                      end if
                  end if
         put the locH of sprite 1 into field "Nothing"
         updatestage
        end

*you can also change the volume and cursor
    set the volume of sound 1 = the locH of sprite 1 
        (the loc of sprite 1 will change the volume of sound 1)
    set the cursor of sprite 1 to 0
        (0=none, -1=arrow, 1=beam, 2=crosshair, 3=crossbar, 4=watch)


V. Make the cursor change when you enter sprite 1:
         on mouseenter
                   set the cursor of sprite 1 to 2
         end


VI. Hooking two expressions together:
  Use the "&"

  E.g.  Move to frame 10 or so on your score and enter the following message
        in the message window
              put "This is frame " &the frame
              put "Today's date is " &the date

  E.g.  Maybe you wanted a date field in your program
        
    Make a field call is "Date"    in frame 1
       frame 1 script:   "go to the frame"  - this stops the movie on 
                                              that frame
    Make a button:  "Give date"  in frame 1
       Script for button: put "Today's date is " &the date into field "Date"


VII. Random number generator:
     
    Random ( )
       E.g.   Random(10)     --gives a random number between 1 and 10

    Listing random fruits!

       Make a field called "Fruit"  in frame 1
            frame script for frame 1: go to the frame
       Make a button called "Fruit of the day" in frame 1
            script: put word random (6) of "Apple Oranges Pears Cherry 
                    Banana Melon" into text of field "Fruit"

    More advanced!!
       Change button to "Fruit Color of the day"
       Change the script to:  set the stagecolor to integer (word random(4)
                              of "50 100 255 229")

       Add this script to the fruit button:
               puppetTransition integer (word random (3) of "20 30 40")
       Add to the frame script:    puppetTransition the frame

VIII. Working with fields

    Clear a field
       put EMPTY into field "Nothing"   or put "" into field "Nothing"

    Make a field "Nothing"   type in the word "Nothing"      frame 1
                  frame script = go to the frame
    Adding words after and before: Make a "Before" and "After" buttons
                  put "This is before" before field "Nothing"
                  put "This is after" after field "Nothing"

    Make your field 2 lines wide
          Change the script of your button to:
                  put "This is after" &return& "this is the next line" after
                  field "Nothing"

    Counting characters, words, and lines in a field:
                  put the number of chars in "I love Cheese"
                  put the number of words in "I love Cheese"
                  put the number of lines in "I love Cheese"

                  put char 4 of "I love Cheese"
                  put char 4 to 6 of "I love Cheese"
                  delete word 3 of field "Nothing"
                  put "This is great" into line 5 of field "Nothing"
