Author Topic: Intro Buttons  (Read 183 times)

0 Members and 1 Guest are viewing this topic.

Offline RJD

Intro Buttons
« on: May 30, 2004, 10:04:54 AM »
In my game's intro, I want to have a button appear when you click, such as in later Space Quests, asking if you want to watch the intro, skip, or restore.  I tried following Brians Tut. and using the button code from there, but where I am trying it it doesnt work

Code: [Select]
               // End the title screen, start the game
         (if(CAN_CONTINUE)
      (var button)
= button Print(
  "What do you want to do?"
  #title "Space Quest 3 1/2"
  #font LARGE_FONT
  #icon 0 0 0
  #button "Watch Intro  " 1
  #button "Skip Intro" 0
  #button "Restore" 2
)
(if(== button 1)
  Print("You are watching the intro")
  )
(if(== button 0
  (send gRoom:newRoom(2))
)
(if(== button 2
  Print("You are Restoring")
  )
  )
  )
                )
          )
      )
   )
 )

As you can see, scripting isn't my specialty.  When I try compiling this, the script says "Undefined Symbol "var".   I would also like to know how to close the whole thing if the player chooses to watch the intro.  I know how to make it restore, I just haven't bothered putting it in first.  Help!!!


Beep Beep Boo Bop Boo Beep

Offline Doan Sephim

Re:Intro Buttons
« Reply #1 on: May 30, 2004, 12:20:11 PM »
what method do you have that in? i think you need to have that in the handle event method (which is in the RoomScript instance).
like:
(method (handleEvent pEvent)
(var button)
(super:handleEvent(pEvent))
then if you want to have the intro inturruptable by a button to skip it you could just copy and paste the code from the title screen:
(if(not(send pEvent:claimed))
(if( (==(send pEvent:type) evKEYBOARD) and (==(send pEvent:message) $3C00))
ToggleSound()
)(else
(send gRoom:newRoom(INITROOMS_SCRIPT))
)))
and instead of the [(send gRoom:newRoom(INITROOMS_SCRIPT)] you would put your [= button Print...]

i might be wrong but i think you have to have the variables in the method before the (super)'s of that method or else it wont understand what it is.
i think that should work...but i'm kinda dumb at coding too, sooooo...i'll let anyone else correct me.
doan

Offline RJD

Re:Intro Buttons
« Reply #2 on: May 30, 2004, 12:30:34 PM »
Thanks doan, but I already got it working.  The code for anybody that wants it:

Code: [Select]
        (if(CAN_CONTINUE)
                  = CAN_CONTINUE Print(
                    "Choose what you would like to do"
                    #title "What would you like                        to do now?"
                    #button "Watch Intro"  1
                    #button "Skip Intro" 2
                        #button "Restore" 3
                 )
                 (switch(CAN_CONTINUE)
                   (case 1
                        return
                   )
                   (case 2
                       (send gGame:restart())
                      return
                        )
                        (case 3
                           (send gGame:restore())
        = CAN_CONTINUE FALSE
            )
        )
       )
      )
    )
  )
)
Keep in Mind thar this is meant specifically for my titlescreen
Thanks anyways Doan!
« Last Edit: May 30, 2004, 02:32:50 PM by RJD »
Beep Beep Boo Bop Boo Beep


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.045 seconds with 22 queries.