/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 83)
/******************************************************************************/
(use "controls")
(use "cycle")
(use "door")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")
(local
button5
)
/******************************************************************************/
(instance public rm083 of Rm
	(properties
		picture scriptNumber
		north 0
		east 0
		south 0
		west 0
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))

		(switch(gPreviousRoomNumber)
			(case 84
				(send gEgo:
					posn(171 180)
					loop(3)
				)
			)
   (case 81
				(send gEgo:
					posn(18 110)
					loop(2)
				)
			)
		)

		SetUpEgo()
		(send gEgo:init())
  = gTimeSeconds2 0
  (aMan: init())
	)
)
/******************************************************************************/
(instance man1 of Script
	(properties)
(method(changeState newState)
 = newState 0
 = state newState
 (switch(state)
 (case 0
 = state 0
 (aMan1: hide())
)))
 )
(instance man2 of Script
	(properties)
(method(changeState newState)
 = newState 0
 = state newState
 (switch(state)
 (case 0
  = state 0
 (aMan2: hide())
)))
 )
 (instance man3 of Script
	(properties)
(method(changeState newState)
 = newState 0
 = state newState
 (switch(state)
 (case 0
  = state 0
 (aMan3: hide())
 = gTimeSeconds2 0
)))
 )
 (instance car of Script
	(properties)
(method(changeState newState)
 = newState 0
 = state newState
 (switch(state)
 (case 0
  = state 0
 (aCar: hide())
)))

 )
(instance RoomScript of Script
	(properties)
  	(method (handleEvent pEvent)
        (super:handleEvent(pEvent))
(if(Said('look>'))
(if(Said('/button'))
Print("It's the elevator call button.")
)
(if(Said('/booth'))
Print("This is the receptionist's workplace.")
)
(if(Said('/sign,marking,letter'))
Print("<< Rooms 4-6 ")
)
(if(Said('/handrail'))
Print("It's black and boring.")
)
(if(Said('/elevator,lift'))
Print("It's not for you.")
)
(if(Said('/man,clerk,receptionist'))
Print("He's the one giving out rooms and collecting money for it.")
)
(if(Said('/'))
Print("You're inside the hotel. A receptionist is in his 'booth'.")
        )
        )
        
(if(Said('talk/man,clerk,receptionist') or (if(Said('rent/room'))))
(if(==(send gEgo: onControl()) ctlCYAN)
(if(not(rebelsCalled))
Print("Hello sir. May I help you?" #title "Receptionist:" #icon 778 0 2)
Print("Umm..no!" #title "Dr.Jummybummy:" #icon 777 0 0)
return
)
(if(send gEgo: has(INV_HOTELKEY))
Print("Nice hotel you have here." #title "Dr.Jummybummy:" #icon 777 0 0)
Print("Thank you sir!" #title "Receptionist:" #icon 778 0 2)
return
)
Print("Hello sir. May I help you?" #title "Receptionist:" #icon 778 0 2)
Print("Yeah. I'd like to rent a room." #title "Dr.Jummybummy:" #icon 777 0 0)
= button5 Print("Certainly sir. We have just one room left at the moment. It costs 350 dakos. Would you like it?" #title "Receptionist:" #button "Yes" 1 #button "No" 0 #icon 778 0 2)
(if(== button5 1)
(if(< money 350)
Print("Yeah! But I don't have enough money." #title "Dr.Jummybummy:" #icon 777 0 0)
Print("Then it's too bad. Good day sir!" #title "Receptionist:" #icon 778 0 2)
return
)
Print("Yeah! Here's 350 dakos." #title "Dr.Jummybummy:" #icon 777 0 0)
Print("Thank you sir! You're in room 6. Here's your key." #title "Receptionist:" #icon 778 0 2)
+= gScore 2
(send gEgo: get(INV_HOTELKEY))
-= money 350
return
)
(if(== button5 0)
Print("No thanks!" #title "Dr.Jummybummy:" #icon 777 0 0)
return
)
Print("The distance is too big.")
        )
        )
        )
 (method(doit)
(if(== gTimeSeconds2 8)
= gTimeSeconds2 9
(aCar: init() show() posn(306 47) setMotion(MoveTo 0 47 car))
)
(if(== gTimeSeconds2 3)
= gTimeSeconds2 4
(aMan1: init() show() posn(1 100) setCycle(Walk) setMotion(MoveTo 171 182 man1))
(aMan1: ignoreControl(ctlWHITE))
)
(if(== gTimeSeconds2 15)
= gTimeSeconds2 16
(aMan2: init() show() posn(171 182)  setCycle(Walk) setMotion(MoveTo 1 100 man2))
(aMan2: ignoreControl(ctlWHITE))
)
(if(== gTimeSeconds2 21)
= gTimeSeconds2 22
(aMan3: init() show() posn(1 44) setCycle(Walk) setMotion(MoveTo 320 44 man3))
(aMan3: ignoreControl(ctlWHITE))
)
 (if(==(send gEgo: onControl()) ctlRED)
 (send gRoom: newRoom(84))
 )
 (if(==(send gEgo: onControl()) ctlNAVY)
 (send gRoom: newRoom(81))
 )
 )
)
(instance aCar of Act
(properties
view 153
x 306
y 47
))
(instance aMan1 of Act
(properties
view 72
x 1
y 100
))
(instance aMan2 of Act
(properties
view 154
x 171
y 182
))
(instance aMan3 of Act
(properties
view 155
x 1
y 44
))
(instance aMan of Act
(properties
view 156
x 164
y 107
))
/******************************************************************************/
