;;; Sierra Script 1.0 - (do not remove this comment)
(script# 71)
(include sci.sh)
(use Main)
(use Class_255_0)
(use Cycle)
(use Game)
(use Feature)
(use Obj)

(public
	Room71 0
)

(local
	newView
	newProp_2
	newProp
	gEgoView
)
(procedure (localproc_0438 param1)
	(if param1
		((= newView (View new:))
			view: 800
			posn: 108 132
			init:
			setPri: 15
			stopUpd:
		)
	else
		(newView dispose:)
		(= newView 0)
	)
)

(instance Room71 of Rm
	(properties
		picture 71
		style $0010
	)
	
	(method (init)
		(Load rsVIEW 800)
		(Load rsVIEW 511)
		(Load rsVIEW 940)
		(super init:)
		(= south 74)
		(self setRegions: 605)
		(= global101 1)
		((= newProp (Prop new:))
			view: 511
			loop: 0
			cel: 0
			posn: 72 121
			stopUpd:
			init:
		)
		(if (== ((gInv at: 23) owner?) 71)
			((= newProp_2 (Prop new:))
				view: 511
				ignoreActors: 1
				loop: 0
				cel: 1
				posn: 72 116
				stopUpd:
				init:
			)
		)
		(gEgo view: 904 xStep: 4 yStep: 1)
		(switch gPrevRoomNum
			(72 (gEgo posn: 208 104))
			(74 (gEgo posn: 170 183))
			(else 
				(gEgo posn: 78 112)
				(= global126 0)
				(if (not (proc0_20)) (localproc_0438 1))
			)
		)
		(gEgo priority: (CoordPri (gEgo y?)) init:)
		(if (proc0_20) (proc0_10 605 1))
	)
	
	(method (doit)
		(super doit:)
		(cond 
			((& (gEgo onControl: 0) $0040) (gRoom newRoom: 70))
			((& (gEgo onControl: 0) $0020) (gRoom newRoom: 72))
		)
		(cond 
			((and newView (proc0_20)) (localproc_0438 0))
			((and (not newView) (not (proc0_20))) (localproc_0438 1))
		)
	)
	
	(method (handleEvent pEvent)
		(if (pEvent claimed?) (return 1))
		(return
			(if (== (pEvent type?) evSAID)
				(cond 
					((Said 'look>')
						(cond 
							((or (Said '/falls') (Said '<out')) (Print 71 0))
							((Said '/heap') (Print 71 1))
							(
								(and
									(not (gEgo has: 23))
									(or (Said '/bone') (Said '/dirt') (Said '<down'))
								)
								(Print 71 1)
							)
							((or (Said '<around') (Said '/room,cave'))
								(Print
									(Format
										@global228
										71
										2
										(if (proc0_20)
											{Even the lantern does little good.}
										else
											{_}
										)
									)
								)
								(if (not (gEgo has: 23)) (Print 71 3))
							)
						)
					)
					((Said 'get/bone')
						(cond 
							((!= ((gInv at: 23) owner?) 71) (Print 71 4))
							(
								(and
									(< (gEgo distanceTo: newProp_2) 15)
									(== ((gInv at: 23) owner?) 71)
								)
								(gEgo get: 23)
								(gEgo setScript: getDown)
								(newProp_2 hide:)
								(= global182 1)
								(gGame changeScore: 2)
							)
							(else (proc0_13))
						)
					)
				)
			else
				0
			)
		)
	)
	
	(method (newRoom newRoomNumber)
		(if (== newRoomNumber 70)
			((ScriptID 605) keep: 0)
			(= global189 0)
		)
		(super newRoom: newRoomNumber)
	)
)

(instance getDown of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(proc0_8)
				(= gEgoView (gEgo view?))
				(gEgo
					setMotion: 0
					view: 940
					cel: 255
					loop: (if (< (gEgo heading?) 180) 0 else 1)
					setCycle: End self
				)
			)
			(1 (gEgo setCycle: Beg self))
			(2
				(gEgo view: gEgoView setCycle: Walk)
				(proc0_9)
			)
		)
	)
)
