Point and Click Tutorial: Chapter 12 - Creating the Room 1 Script

From SCI Wiki
Jump to navigationJump to search

All right, so now we have all of the views, all of the texts, and the heart of the 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 the menu in an actual room. This is pretty much the bare minimum. If you don't understand how this works, may I suggest that you check out Troflip's advanced tutorials, specifically Locales and Regions.

Room 1


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

 

< Previous: Chapter 11 - Creating the Point and Click Script Next: Chapter 13 - Examples of Scripting Point and Click Responses >