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

		(switch(gPreviousRoomNumber)
			(case 4

				(send gEgo:
					posn(314 166)
					loop(1)
				)
			)
   (case 6
      (send gTheMusic:
			prevSignal(0)
			stop()
			number(1)
			loop(-1)
			play()

		)

				(send gEgo:
					posn(125 153)
					loop(2)
				)
			)
		)

		SetUpEgo()
		(send gEgo:init())
  
   (if(carIsParked)
 (postCar: init())
 )
  (if(not(locked))
 = theft TRUE
 )
	)
)
/******************************************************************************/
(instance RoomScript of Script
	(properties)
   (method (handleEvent pEvent)
   (super:handleEvent(pEvent))
   (if(Said('enter,drive/car'))
   Print("This is not your car. And besides, you have to get the Timegate working, so you don't have any time.")
   )
      (if(Said('search/car,(post<car,van,vehicle),vehicle,van,seat,(front<seat)'))
        (if(not(carIsParked))
       Print("There's is no post-car to search.")
        return
        )
                (if(== (send gEgo:onControl()) ctlCYAN or (if(== (send gEgo:onControl()) ctlRED)))
               (if(doorOp)
                (if(not(postman))
                Print("You search the car and see an employee ID card on the front seat.")
                return
                )
                Print("You search the car but don't find anything useful.")
               )
               Print("The door of the post-car is closed.")
                return
                )
                Print("For that you should move closer to the post-car.")
      )
       (if(Said('take/id,card'))
             (if(doorOp)
             (if(== (send gEgo:onControl()) ctlCYAN)
             (if(carIsParked)
              (if(not(postman))
             Print("You pick up the employee ID card and put it on.")
             = postman TRUE
              += gScore 2
              (postCar: cel(1))
                        = gEgoView 335
              (send gEgo: view(335))
              return
)
             Print("You already took the ID card.")
              return
                          )
                          Print("Where do you see a car?")
                          return
                          )
                          Print("You have to move closer to the open door first.")
                          return
                          )
                          Print("The car door is closed. You have to open it first.")
       
       )
             (if(Said('climb>'))
  (if(Said('/fence'))
  Print("You don't know what's behind the fence, so you don't want to climb it.")
  )
             (if(Said('/post,pole'))
             Print("You can't. You're affraid of heights.")
             ))
             
                     (if(Said('close,lock/door'))
             (if(== (send gEgo:onControl()) ctlCYAN or (if(== (send gEgo:onControl()) ctlRED)))
             (if(carIsParked)
             (if(doorOp)
             Print("Ok")
        (postCar: cel(0))
        = doorOp FALSE
        return
             )
             Print("The door is closed.")
             return
             )
             Print("What door? The post office door is closed already.")
             return
             )
             Print("You're not close enough to the car door.")
             )
   (if(Said('open/door'))
     (if(== (send gEgo:onControl()) ctlRED)
     Print("You try to open the door but find it locked. Try the door on the other side of the car.")
     return
     )
     (if(== (send gEgo:onControl()) ctlCYAN)
             (if(carIsParked)
             (if(not(doorOp))
             Print("Ok")
               (if(postman)
        (postCar: cel(1))
         = doorOp TRUE
        return
        )
        (postCar: cel(2))
        = doorOp TRUE
        return
             )
             Print("The car door is already open.")
             return
             )

             )
   (if(== (send gEgo:onControl()) ctlNAVY)
   Print("Ok")
   (send gRoom:newRoom(6))
   return
   )
   Print("You're too far away from the door.")
   )
   (if(Said('look>'))
           (if(Said('/house'))
            Print("This is the post office.")
            )
             (if(Said('/door'))
            Print("If you open those you can go inside the post office.")
            )
            (if(Said('/card,id'))
            (if(postman)
             Print("New Yerk Post Office: \n\n Name: Mike Haley \n\n ID: 4587B2D" #icon 778 0 5)
            return
            )
              (if(== (send gEgo:onControl()) ctlCYAN or (if(== (send gEgo:onControl()) ctlRED)))
            Print("It looks like some worker's id.")
            return
            )
            Print("You're too far away from to see it.")
            )
            (if(Said('/street'))
            Print("It's just a regular street with no traffic.")
            )
            (if(Said('/sign'))
            Print("POST OFFICE.")
            )
            (if(Said('/window'))
            Print("You can't see inside because the sun is shining onto the window .")
                )
            (if(Said('/sky'))
            Print("The sky is blue and far away. You can see a cloud too.")
                )
            (if(Said('/cloud'))
            Print("It's in the sky and it's not as soft as it seems to be.")
                            )
            (if(Said('/antenna,reciver'))
            Print("I wonder what does the post office do with that kind of  antenna?")
                                        )
            (if(Said('/knob,(door<knob)'))
            Print("This is the door knob. I hope you know what that is.")
                )
            (if(Said('/fence'))
            Print("Whose stupid idea it was to build a fence around the post office.")
                                      )
               (if(Said('/cable,line,wire,(power<cable,line,wire)'))
            Print("I don't have enough information to talk about this power cable at the moment.")
            )
               (if(Said('/sidewalk,pavement'))
            Print("What would it change if I told you something about this pavement?")
                )
               (if(Said('/seat'))
               (if(carIsParked)
    (if(== (send gEgo:onControl()) ctlCYAN or (if(== (send gEgo:onControl()) ctlRED)))
                  (if(postman)
                  Print("You look on the front seat, but don't find anything useful.")
              return
               )
               Print("You look on the front seat and see an id on the seat.")
               return
               )
               Print("You're too far away from the car.")
               return
               )
               Print("Seat? Where?")
               )
               (if(Said('/car,(post<car,van),van,vehicle'))
               (if(carIsParked)
       (if(== (send gEgo:onControl()) ctlCYAN or (if(== (send gEgo:onControl()) ctlRED)))
               (if(doorOp)
               (if(postman)
              Print("You look insde the car but don't find anything useful.")
              return
               )
            Print("You look inside the car and see an employee-id on the front seat.")
            return
            )
            Print("There's something on the front seat, but you can't see very well trough the window because of the sun.")
            return
            )
                      Print("It looks like a regular post car.")
               return
               )
            Print("Where do you see a car?")
            )
                
            (if(Said('/pole,post'))
            Print("This post looks even older than the one at your house.")
            )
            (if(Said('/'))
            Print("You're outside the post office. There's a door leading in.")
            (if(carIsParked)
            Print("A post-car is parked on the street.")
            )

        )
        )
   )
)
(instance postCar of Prop
(properties
view 364
x 221
y 183
))
/******************************************************************************/
