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

		(switch(gPreviousRoomNumber)
			(case 98
             (if(== colorN 0)
				(send gEgo:
					posn(28 175)
					loop(0))
  )
                  (if(== colorN 1)
      	(send gEgo:
					posn(261 94)
					loop(2))
			)
   )
		)

		SetUpEgo()
		(send gEgo:init())
  (aSit: init())
  (aVessel: init()setCycle(Fwd))
  (if(not(pickedLock))
  (aGrass: init())
  )
    (if(grassBurned)
  (aGrass: cel(1))
    )
	)
)
/******************************************************************************/
(instance RoomScript of Script
	(properties)
    (method (handleEvent pEvent)
(super:handleEvent(pEvent))
(if(Said('lit/grass/glasses') or (if(Said('use/glasses/grass'))))

  (if(grassBurned)
  Print("What grass are you talking about?")
  return
  )
  (if(pickedLock)
  Print("What grass are you talking about?")
  return
  )
  (if(==(send gEgo: onControl()) ctlSILVER)
  
Print("You direct the sunbeams trough the glasses and lit the grass.")
 (aGrass: cel(1))
Print("After a while, you see that some of the smoke goes right into the air ventilation hole.")
+= gScore 2
= grassBurned TRUE
ProgramControl()
= fireAlarm TRUE
Wait(30)
Print("FIRE! Everyone out!" #at 10 40)
Print("This must have been the bartender.")
PlayerControl()
return
)
Print("Move closer the grass.")
)

(if(Said('lit/grass'))
  (if(pickedLock)
  Print("What grass are you talking about?")
  return
  )
Print("With what?")
)
(if(Said('put,place/grass'))
(if(not(repaired))
Print("Why would you do that?")
return
)
(if(not(pickedLock))
Print("You don't have grass to put down.")
return
)
(if(==(send gEgo: onControl()) ctlSILVER)
(if(not(send gEgo: has(INV_GRASS)))
 Print("You don't have grass to put down.")
 return
 )
(send gEgo: put(INV_GRASS))
Print("You place down the grass, just near the wall.")
+= gScore 1
= pickedLock FALSE
(aGrass: init())
return
)
Print("There's no point of placing the grass here.")
)
(if(Said('drive,use/vessel'))
Print("It's not yours to use. It probably belongs to the sleeping guy.")
)
(if(Said('push/man'))
Print("That would probably make him fall and get hurt. You too.")
)
(if(Said('look>'))
(if(Said('/wall,(back<wall)'))
(if(send gEgo: has(INV_TOOLS))
Print("Nothing special about the wall of the back but on the side there's a small ventilation hole.")
return
)
Print("A toolbox is laying nearby the back wall and on the side there's a small ventilation hole.")
)
(if(Said('/sun'))
Print("Ahh yes ... the sun. When you were a kid you used to use the magnifying glass to burn things. A sun like this was perfect for that.")
)
(if(Said('/sign,(big<sign)'))
Print("You can only see the back of it.")
)
(if(Said('/vessel,vehicle'))
Print("This must belong to the sleeping guy.")
)
(if(Said('/vent,grate,hole,grid'))
Print("Through this fresh atmosphere particles are ventilated into the bar.")
)
(if(Said('/sky'))
Print("It sure is far away from here. Well not really, but I just wanted to make this response longer. The sun is shining too.")
)
(if(Said('/sand'))
Print("You look at the sand and it reminds you of your childhood memories.")
)
(if(Said('/stool,chair'))
Print("The bum is balancing himself on it while trying to sleep.")
)
(if(Said('/tools,toolbox,box,hammer'))
(if(send gEgo: has(INV_TOOLS))
Print("The toolbox is empty.")
return
)
Print("You can see some tools in the toolbox.")
)
(if(Said('/man,bum'))
Print("He's sleeping. Or pretending to be.")
)
(if(Said('/'))
(if(send gEgo: has(INV_TOOLS))
Print("You're at the back of the bar. A man is sleeping on his stool.")
return
)
Print("You're behind the bar. A man is sleeping on his stool and toolbox is laying near the back wall.")
        )
        )
(if(Said('make,pay,give/man,offer,money,deal'))
(if(send gEgo: has(INV_MONEY))
(if(not(== money 0))
(if(< (send gEgo:distanceTo(aSit)) 25)
(if(talkedBum)
= amount GetNumber("How much do you want to give?\n")
(if(> amount money)
Print("You don't have that much money.")
return
)
(if(>= amount 10 and (if(< amount 130)))
Print("Not enough!" #title "Bum:" #icon 778 0 8)
return
)
(if(>= amount 130 and (if(< amount 190)))
Print("Still not enough." #title "Bum:" #icon 778 0 8)
return
)
(if(>= amount 190 and (if(< amount 220)))
Print("Pretty close, but not enough." #title "Bum:" #icon 778 0 8)
return
)
(if(> amount 220 and (if(< amount 250)))
Print("Almost enough. But try some more." #title "Bum:" #icon 778 0 8)
return
)
(if(>= amount 250 and (if(< amount 265)))
Print("A bit more." #title "Bum:" #icon 778 0 8)
return
)
(if(>= amount 265)
Print("Now that's enough!" #title "Bum:" #icon 778 0 8)
Print("Finally!" #title "Dr.Jummybummy:" #icon 777 0 0)
Print("Okay, let's go!" #title "Bum:" #icon 778 0 8)

-= money amount

(if(< money 25)
    Print("Oh, here, take some money back. I'm no robber. One can never know when a little cash might come handy." #title "Bum:" #icon 778 0 8)
    += money (- 25 money)
)

+= gScore 3

(send gRoom: newRoom(93))
return
)
)
Print("Not at the moment.")
return
)
Print("You're too far away from the man.")
return
)
)
Print("You don't have any money to give.")
return
)



(if(Said('talk,wake/man,bum'))
(if(< (send gEgo:distanceTo(aSit)) 25)
(if(talkedBum)
(if(bummm)
Print("Hey, have you changed your mind?"#title"Dr.Jummybummy" #icon 777 0 0)
Print("No, and I don't plan to. Want a ride? Pay me."#title"Bum:" #icon 778 0 8)
return
)
Print("You don't have anything interesting to say. Just give him the money.")
return
)
(if(bartender)
Print("Hey man, wake up!"#title"Dr.Jummybummy" #icon 777 0 0)
Wait(37)
Print("...gfh...what?!!"#title"Bum:" #icon 778 0 8)
Print("The bartender told me you could take me to Lost Angle!"#title"Dr.Jummybummy" #icon 777 0 0)
Print("I could, but it will cost you."#title"Bum:" #icon 778 0 8)
Print("How much?"#title"Dr.Jummybummy" #icon 777 0 0)
Print("Dunno, make your offer."#title"Bum:" #icon 778 0 8)
Print("Ok!"#title"Dr.Jummybummy" #icon 777 0 0)
= talkedBum TRUE
+= gScore 2
return
)
Print("You probably have other things to do before that.")
return
)
Print("You're too far away from the man.")
return
)

(if(Said('take>'))
(if(Said('/tools'))
(if(send gEgo: has(INV_TOOLS))
Print("You already have the tools.")
return
)
Print("Extreme close up!!!")
Print("You can now take the tools if you want.")
(send gRoom: newRoom(94))
return
)
(if(Said('/toolbox'))
 (if(==(send gEgo: onControl()) ctlCYAN)
(if(send gEgo: has(INV_TOOLS))
Print("There's no point of taking it.")
return
)
Print("You can't take the whole toolbox. But you can take some tools from it.")
(send gRoom: newRoom(94))
return
)
Print("You're not close enough.")
return
)
(if(Said('/vessel'))
Print("It's too heavy to take.")
return
)
(if(Said('/man,chair'))
Print("It's a good idea...")
Wait(30)
Print("...NOT!!")
return
)
)
)
 (method(doit)
 (if(==(send gEgo: onControl()) ctlRED)
 = colorN 0
 (send gRoom: newRoom(98))
 )
  (if(==(send gEgo: onControl()) ctlYELLOW)
  = colorN 1
  (send gRoom: newRoom(98))
 )
 )
)

(instance aSit of Act
(properties
view 116
x 199
y 129
))
(instance aVessel of Prop
(properties
view 115
x 302
y 164
))

(instance aGrass of Prop
(properties
view 709
x 45
y 162
))
/******************************************************************************/
