/******************************************************************************/
(include "sci.sh")
(include "game.sh")
/******************************************************************************/
(script 46)
/******************************************************************************/
(use "controls")
(use "cycle")
(use "autoDoor")
(use "feature")
(use "game")
(use "inv")
(use "main")
(use "obj")
/******************************************************************************/
(instance public rm046 of Rm
	(properties
		picture scriptNumber
		north 0
		east 0
		south 48
		west 45
	)
	(method (init)
		(super:init())
		(self:setScript(RoomScript))

		(switch(gPreviousRoomNumber)
			(case 45
				(send gEgo:
					posn(4 129)
					loop(0)
				)
			)
    (case 48
				(send gEgo:
					posn(145 180)
					loop(3)
				)
			)
    (case 47

				(send gEgo:
					posn(174 83)
					loop(2)
				)
			)
		)

		SetUpEgo()
		(send gEgo:init())
  (sign: init())
  (aDoor: init())
  (aSalesman: init())
  (airTank: init())
	)
)
/******************************************************************************/
(instance RoomScript of Script
	(properties)
         (method (handleEvent pEvent)
   (super:handleEvent(pEvent))
   (if(Said('look>'))
(if(Said('/salesman,man'))
Print("He's selling something. But what? Go and talk to him.")
)
(if(Said('/bar'))
Print("It's the 'Rebel Bar', probable hideout of the rebels.")
)
(if(Said('/wall'))
Print("It surrounds the city. You need to get in.")
)
             (if(Said('/sky'))
            Print("There's not much to see up there.")
            )
            (if(Said('/trunk'))
            Print("Judging by the size of the trunk, the tree seems to be about 2 years old.")
            )
             (if(Said('/leaves'))
            Print("These palm-tree like leaves don't look interesting.")
            )
             (if(Said('/sand'))
            Print("1 grain of sand, 2 grains of sand, 3 ... Never mind!")
            )
(if(Said('/tank'))
Print("I wonder what does it contain?")
)
(if(Said('/tree'))
Print("This tree sure is tall.")
)
(if(Said('/sign'))
Print("'Rebel Bar'")
)
(if(Said('/stand'))
Print("I wonder what is sold there?")
)
(if(Said('/'))
Print("You're outside the 'Rebel Bar'. There's also a stand near the wall.")
        )
        )
   (if(Said('give>'))
      (if(Said('/money'))
   (if(==(send gEgo: onControl()) ctlRED)
   Print("You don't have any money to give. And even if you do have it, then don't give it!")
   return
   )
   Print("You're not close enough to the man.")
   )
     (if(Said('/glasses'))
    Print("You can't give those. You need them.")
     )
  (if(Said('/you'))
   (if(==(send gEgo: onControl()) ctlRED)
   Print("How would that look?")
   return
   )
   Print("You're not close enough to the man.")
   )
     (if(Said('/spacesuit'))
   (if(==(send gEgo: onControl()) ctlRED)
   Print("You can't give the spacesuit to the man. You need it.")
   return
   )
   Print("You're not close enough to the man.")
   )
  (if(Said('/water,bottle'))
   (if(==(send gEgo: onControl()) ctlRED)
   Print("Better not give the bottle of water to the man. You may need it else where.")
   return
   )
   Print("You're not close enough to the man.")
   )
   (if(Said('/diamond'))
   (if(talkkk)
   (if(==(send gEgo: onControl()) ctlRED)
   (if(filledTank)
   Print("You already gave it to him.")
   return
   )
   Print("Here, take this diamond." #title"Dr Jummybummy:" #icon 777 0 0)
   Print("Thanks, your air tank is now filled." #title"Salesman:" #icon 778 0 1)
   = oxygen 140
   = filledTank TRUE
   += gScore 3
   = showAir TRUE
   (send gEgo: put(INV_DIAMOND))
   return
   )
   Print("You're not close enough to the man.")
   return
   )
   Print("Why should you do that?")
   )
     (if(Said('/'))
     Print("He wouldn't be interested in it.")
     )
   )
   (if(Said('open/door'))
   Print("This door should open automatically.")
   )
   (if(Said('talk/man,alien,salesman'))
   (if(==(send gEgo: onControl()) ctlRED)
   (if(filledTank)
   Print("I don't have to talk to him anymore.")
   return
   )
   (if(talkkk)
   Print("I already told you. If you want your air-tank filled, give me something in exchange." #title"Salesman:" #icon 778 0 1)
   return
   )
   = talkkk TRUE
   Print("Hi. What's this tank for?" #title "Dr.Jummybummy:" #icon 777 0 0)
   Print("Filling air-tanks like the one you're carrying." #title"Salesman:" #icon 778 0 1)
   Print("Could you fill mine?" #title "Dr.Jummybummy:" #icon 777 0 0)
   Print("Give me something in exchange." #title"Salesman:" #icon 778 0 1)
   Print("Ok" #title "Dr.Jummybummy:" #icon 777 0 0)
   += gScore 1
   return
   )
   
   Print("You're not close enough to the man.")
   )
   )
)
(instance sign of Prop
(properties
view 56
x 172
y 25
))
(instance aDoor of AutoDoor
(properties
view 57
x 174
y 80
entranceTo 47
))
(instance aSalesman of Act
(properties
view 65
x 309
y 140
))
(instance airTank of Act
(properties
view 66
x 290
y 143
))
/******************************************************************************/
