SCI Programming.com
Welcome, Guest. Please login or register.
August 24, 2017, 02:34:55 AM
Home  >  Tutorials  >  Chapter 12: Creating the Room 1 Script
Chapter 12: Creating the Room 1 Script

Alright, so now we have all of our views, all of our texts, and the heart of our point and click menu written, it is time to actually fire it up and place it in a room. This Chapter is here really to serve as an example of how to init, or use our menu in an actual room. This is pretty much the bare minimum. If you don't understand how this works, may I suggest taht you check out Troflip's advanced tutorials, specifically Locales and Regioins.

Code:
/******************************************************************************/
(include "sci.sh")(include "game.sh")                                 (script 1)
/******************************************************************************/
(use "controls")(use "cycle")(use "feature")(use "game")(use "main")(use "obj")
/******************************************************************************/
(instance public rm001 of Rm
(properties picture scriptNumber)
  (method (init)
  (super:init())

  (self:setScript(RoomScript))
  (self:setRegions(950)) // PnC Menu
		
  (switch(gPreviousRoomNumber)
    (case 500 (send gEgo:view((send gEgo:view))// last ego view
                         loop((send gEgo:loop))// last ego loop
                         posn((send gEgo:x) (send gEgo:y)))// last ego x & y
                         )// end case 500 - Inventory room
    (default  (send gEgo:posn(150 130)loop(1)))
  )// end gPreviousRoomNumber switch

  SetUpEgo()
  (send gEgo:init())

  )// end method
)// end public instance
/******************************************************************************/
(instance RoomScript of Script
(properties)
  (method (handleEvent pEvent)
  (super:handleEvent(pEvent))
    (if(==(send pEvent:type())evMOUSEBUTTON)  
      (if(not(& (send pEvent:modifiers) emRIGHT_BUTTON))// left clicks
//****************************************************************************
//                       PLAYABLE AREA                                  
//****************************************************************************










//****************************************************************************
      )// end left click
    )// end mouse button
  )// end method
)// end instance
There it is, our Room 1 Script! All ready and waiting to be point and clicked upon!
<< Prev Back to Tutorials

The SCI Programming Community
Copyright © 2007 - 2017, All Rights Reserved.