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

(public
	Room83 0
)
(synonyms
	(room cell)
)

(local
	newAct
	newView
	local2
)
(instance Room83 of Rm
	(properties
		picture 83
		style $0010
	)
	
	(method (init)
		(Load rsVIEW 649)
		(Load rsVIEW 634)
		(Load rsVIEW 512)
		(self setRegions: 604)
		(super init:)
		((View new:)
			view: 634
			loop: 1
			cel: 0
			posn: 55 78
			setPri: 4
			init:
			addToPic:
		)
		((View new:)
			view: 634
			loop: 1
			cel: 1
			posn: 267 78
			setPri: 4
			init:
			addToPic:
		)
		(if global100
			((Prop new:)
				view: 512
				loop: 0
				posn: 57 66
				setPri: 3
				init:
				setCycle: Fwd
			)
			((Prop new:)
				view: 512
				loop: 0
				posn: 267 66
				setPri: 3
				init:
				setCycle: Fwd
			)
		)
		(= global101 1)
		(if global100
			((= newView (View new:))
				view: 649
				loop: 0
				cel: 0
				posn: 162 64
				init:
				stopUpd:
			)
		)
		(if (or (== gPrevRoomNum 86) (== gPrevRoomNum 0))
			(gEgo
				posn: 156 159
				view: 4
				illegalBits: -32768
				loop: 3
				xStep: 4
				yStep: 2
				init:
			)
			(if (== global109 0)
				(Load rsVIEW 141)
				(self setScript: takeBack)
			)
		)
	)
	
	(method (doit)
		(super doit:)
		(if
		(and (== global109 99) (& (gEgo onControl: 0) $0040))
			(gRoom newRoom: 86)
		)
	)
	
	(method (handleEvent pEvent)
		(return
			(cond 
				((pEvent claimed?) (return 1))
				((== (pEvent type?) evSAID)
					(cond 
						(
							(or
								(Said 'look[<around][/!*]')
								(Said 'look/room,castle')
							)
							(Print 83 0)
						)
						((Said 'look>')
							(cond 
								((Said '/skeleton,bone') (Print 83 1))
								((Said '/machine') (Print 83 2))
								((Said '/whip') (Print 83 3))
								((Said '/chain') (Print 83 4))
								((Said '/window') (Print 83 5))
								((Said '/wall') (Print 83 6))
								((or (Said '/dirt') (Said '<down')) (Print 83 7))
							)
						)
						(
						(or (Said 'use,(turn<on)/machine') (Said 'turn/wheel')) (Print 83 8))
						((Said 'get/whip') (Print 83 9))
						((Said 'get/chain') (Print 83 4))
						((Said 'open/window') (Print 83 10))
						((Said 'break/window') (Print 83 11))
						((Said 'open/door')
							(if (< global109 5)
								(Print 83 12)
							else
								(Print 83 13)
							)
						)
						((Said 'unlatch/door')
							(if (< global109 5)
								(Print 83 14)
							else
								(Print 83 15)
							)
						)
						((Said 'call,help,save') (Print 83 16))
					)
				)
			)
		)
	)
)

(instance takeBack of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0 (= seconds 30))
			(1
				(User canControl: 0 canInput: 0)
				(gEgo setMotion: 0)
				(Print 83 17)
				(if (gEgo inRect: 123 142 193 180)
					(gEgo setMotion: MoveTo 150 130 self)
				else
					(self cue:)
				)
			)
			(2
				(gEgo loop: 2)
				((= newAct (Act new:))
					view: 141
					posn: 150 194
					illegalBits: 0
					ignoreActors: 1
					init:
					setCycle: Walk
					setMotion: MoveTo 150 160 self
				)
			)
			(3
				(= local2 (Print 83 18 67 -1 10 33 gSmallFont 88))
				(User canControl: 0 canInput: 0)
				(gEgo
					illegalBits: 0
					setMotion: MoveTo 160 (gEgo y?) self
				)
			)
			(4
				(gEgo
					illegalBits: 0
					setLoop: 2
					setMotion: Follow newAct 5
				)
				(self cue:)
			)
			(5
				(newAct setMotion: MoveTo 150 225 self)
			)
			(6
				(proc0_21)
				(gEgo setLoop: -1 setAvoider: 0)
				(gRoom newRoom: 86)
			)
		)
	)
)
