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


		(switch(gPreviousRoomNumber)
			(case 3
  = jokeNum 1
                (send gTheMusic:
			prevSignal(0)
			stop()
			number(1)
			loop(-1)
			play()

		)
				(send gEgo:
					posn(162 75)
					loop(2)
				)
			)
   (case 5

				(send gEgo:
					posn(5 166)
					loop(0)
				)
			)
		)

		SetUpEgo()
		(send gEgo:init())
(if(mail)
  (aMaildoor: init() cel (1))
  )
    (aFlag: init())

(if(send gEgo:has(INV_LETTER))
    (aFlag: cel(1))
)


 )
)
/******************************************************************************/
(instance RoomScript of Script
	(properties)
   (method(doit)
   (if(== (send gEgo:onControl()) ctlBLACK)
   = yellow FALSE
   )
      (if(== (send gEgo:onControl()) ctlYELLOW)
      (if(room5)
          (send gRoom:newRoom(5))
          return
          )
          (if(send gEgo:has(INV_RECEIT))
         Print("You decide to walk down to the post office.")
          = room5 TRUE
         (send gRoom:newRoom(5))
         return
         )
         (if(yellow)
         return
         )
         = yellow TRUE
         Print("Where would you go?")

         )
         )
         (method (handleEvent pEvent)
        (super:handleEvent(pEvent))
         (if(Said('search/garbage,bin,(garbage<bin)'))
        Print("You decide not to, because you are a well known inventor, and what happens if all of the sudden, some investors decide to give you a deal and come to you personally. And find you in garbage?")
        )
        (if(Said('mow/grass,lawn'))
        Print("Your lawn mower is out of gas, oil and mowers.")
        )
        (if(Said('wash/window'))
        Print("In case you haven't noticed, we're in middle of an adventure. No time to dilly dally.")
        )
            (if(Said('close,lock/door'))
             (if(== (send gEgo:onControl()) ctlNAVY)
            (if(locked)
            Print("It's already locked.")
            return
            )
            Print("Good idea! There have been several reports of robberies.")
            = locked TRUE
            return
            )
            Print("You're too far away from the door.")
            )
             (if(Said('unlock/door'))
                (if(== (send gEgo:onControl()) ctlNAVY)
               (if(locked)

            Print("Ok")
            = locked FALSE
            return
            )
            Print("It's already unlocked.")
            return
            )
            Print("You're too far away from the door.")
            )
        (if(Said('take>'))
       (if(Said('/mailbox'))
       Print("You can't. It's stuck into the ground.")
       )
       (if(Said('/garbage'))
       Print("Eeeww! Don't touch the garbage!!")
       )
       (if(Said('/letter,mail'))
          (if(== (send gEgo:onControl()) ctlRED)
            (if(send gEgo:has(INV_LETTER))
            Print("You have already taken it.")
            return
            )
             (if(mail)
            Print("Ok")
           += gScore 2
          (send gEgo:get(INV_LETTER))

           (aFlag: cel(1))
          return
          )
          Print("The mailbox is closed.")
          return
          )
           Print("You're too far away from the mailbox.")
          ))
      (if(Said('open/mailbox'))
          (if(== (send gEgo:onControl()) ctlRED)
         (if(mail)
         Print("You already opened it.")
         return
         )
         Print("Ok")
         = mail TRUE
      (aMaildoor: cel (1))
        (if(not(send gEgo:has(INV_LETTER)))

        Print("There's a letter in the mailbox. ")

         )
         return
         )
         Print("You're not close enough.")
         )
      (if(Said('close/shutter'))
      Print("You would, but they are nailed shut to the wall. Probably some kid pranking.")
      )
      (if(Said('check,look/mail'))
      (if(mail)
      
      return
      )
      Print("You have to open your mailbox for that.")
      )
   (if(Said('close/mailbox'))
          (if(== (send gEgo:onControl()) ctlRED)
         (if(mail)
         Print("Ok")
         = mail FALSE
         (aMaildoor: cel (0))




         return
         )
          Print("It's already closed.")
          return
         )
          Print("You're not close enough.")
         )

             (if(Said('climb>'))
              (if(Said('/fence'))
              Print("The fence wouldn't hold you.")
              )
              (if(Said('/tree'))
              Print("You're not a kid, that climb trees.")
              )
              (if(Said('/pole,post'))
             Print("You can't. You're affraid of heights.")
             ))
         (if(Said('open>'))

(if(Said('/trash,bin,(trash<bin)'))
Print("It is already opened.")
)
         (if(Said('/door'))
         (if(== (send gEgo:onControl()) ctlNAVY)
         (if(locked)
         Print("You can't. The door is locked.")
         return
         )
         (if(theft)
         = theft FALSE
         Print("You open the door and see a horrible! sight. Everything is messed up. It seems that you have fallen for the ...")
         Print("... GRAND THEFT HOUSE!")
= ex (send gEgo: x)
= ey (send gEgo: y)
(send gRoom: newRoom(601))
return
         )
         (send gRoom:newRoom(3))
         return
         )
       Print("You're too far away from the door.")
))
(if(Said('look>'))
           (if(Said('/house'))
            Print("This is where you live.")
            )
             (if(Said('/door'))
            Print("This is the front door of your house.")
            )
            (if(Said('/trash,bin,(trash<bin,box)'))
            Print("Jucky!!")
            )
                  (if(Said('/letter'))
            (if(mail)
            (if(not(send gEgo: has(INV_LETTER)))
         (if(== (send gEgo:onControl()) ctlRED)
          Print("It's a white envelope.")
          return
          )
          Print("You don't see any letter nearby.")
          return
          )
          Print("It's in your inventory. Press TAB to see it.")
          return
           )
           Print("There may be a letter inside the mailbox, but as it's shut at the moment, you are not sure.")
            )
            (if(Said('/mailbox'))
            Print("This is where all your mail comes in. Check for new mails.")
            )
            (if(Said('/window'))
            Print("You can see inside. Later on, remind me to wash those windows.")
             )
             (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
            )Print("You're losing it man. :P"))
            (if(Said('/tree'))
            Print("It's been growing here since I was born.")
                )
            (if(Said('/grass'))
            Print("Remind me to mow it someday.")
                )
                (if(Said('/shutter,(window<shutter)'))
            Print("These used to protect the windows during a storm.")
                )
                (if(Said('/sky'))
            Print("Just look at that beautiful sky. Not a single cloud. This makes me happy.")
                )
            (if(Said('/fence'))
            Print("Most of the fence is on the neighbours land.")
                )
            (if(Said('/town'))
            Print("In the far background you can see the town with all its stores and stuff.")
                )
            (if(Said('/handrail'))
            Print("They are built for more secure walking on the verendah.")
                )
            (if(Said('/verandah'))
            Print("It's nice to sit on it when the sun rises.")
                )
            (if(Said('/store'))
            Print("This is the metropol. You live in the sub-urb area. And you like it.")
                )
            (if(Said('/roof'))
            Print("It's been leaking water for some time now. Remind me to fix it.")
                )
            (if(Said('/street'))
            Print("These streets are safe to walk. No dense traffic.")
                )
            (if(Said('/sidewalk,pavement'))
            Print("This pavement was built in a hurry, when the construction of this house began. So it's in a *bad* condition.")
                )
            (if(Said('/leaf'))
            Print("And what do you see?")
                          )
           (if(Said('/bush'))
            Print("You used to play hide & seek in the bushes when you were child.")
                      )
            (if(Said('/nail'))
            Print("These nails are no intrest what so ever, so try looking at other stuff.")
                          )
              (if(Said('/cable,line,wire,(power<cable,line,wire)'))
            Print("In the morning, some birds use to sit on it.")
            )
            (if(Said('/pole,post'))
            Print("This was installed about 30 years ago. Remind me to call the power company to replace it.")
            )
            (if(Said('/'))
            Print("You're outside your lovely house. There's a mailbox and a garbage can outside.")
            Print("Isn't it beautiful outside? The tree branches are moving with the air and leaves are rustling softly.")
        )
        )
)
)
(instance aMaildoor of Prop
(properties
view 5
x 90
y 148
priority 13
))
(instance aFlag of Prop
(properties
view 213
x 99
y 148
cel 0
))
/******************************************************************************/
