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

(public
	Room92 0
)

(local
	newProp_2
	newProp_3
	newProp_4
	newAct
	local4
	local5
	gInvFirst
	newProp
	local8
	local9
	local10
)
(instance theMusic of Sound
	(properties
		number 44
	)
)

(instance Room92 of Rm
	(properties
		picture 92
		style $0010
	)
	
	(method (init)
		(if (<= global109 3)
			(Load rsVIEW 82)
			(Load rsVIEW 121)
			(Load rsVIEW 132)
			(Load rsVIEW 681)
			(Load rsVIEW 81)
			(Load rsVIEW 145)
			(Load rsVIEW 141)
		)
		(Load rsVIEW 634)
		(Load rsVIEW 512)
		(self setRegions: 604)
		(super init:)
		(proc0_10 604 0)
		(= local8 0)
		((View new:)
			view: 634
			loop: 1
			cel: 0
			posn: 32 79
			setPri: 10
			init:
			startUpd:
		)
		((View new:)
			view: 634
			loop: 1
			cel: 1
			posn: 289 80
			setPri: 10
			init:
			addToPic:
		)
		((Prop new:)
			view: 512
			loop: 0
			posn: 289 68
			setPri: 10
			init:
			setCycle: Fwd
		)
		((= newProp (Prop new:))
			view: 512
			loop: 0
			posn: 34 67
			setPri: 10
			init:
			setCycle: Fwd
		)
		(= global101 1)
		(if (== gPrevRoomNum 80)
			(gEgo posn: 153 156 view: 4 xStep: 4 yStep: 2 init:)
		)
		(if (== gPrevRoomNum 91)
			(gEgo posn: 53 131 view: 4 xStep: 4 yStep: 2 init:)
		)
		(if (== gPrevRoomNum 93)
			(gEgo posn: 271 131 view: 4 xStep: 4 yStep: 2 init:)
		)
		(if (== gPrevRoomNum 86)
			((= newProp_2 (Prop new:))
				posn: 162 102
				view: 121
				cycleSpeed: 1
				setLoop: 0
				init:
				stopUpd:
				setScript: lipLooper
			)
			((= newProp_3 (Prop new:))
				posn: 210 94
				view: 132
				loop: 2
				cel: 0
				init:
				stopUpd:
			)
			(User canControl: 0 canInput: 0)
			(= global205 1)
			(gEgo
				posn: 251 131
				view: 81
				setLoop: 1
				init:
				setCycle: Walk
			)
			(lotTalk2 start: 0)
			(self setScript: lotTalk2)
		)
		(if
		(or (== gPrevRoomNum 79) (== gPrevRoomNum 0) (== gPrevRoomNum 333))
			(gEgo
				posn: 153 156
				view: 82
				xStep: 4
				yStep: 2
				setLoop: 0
				init:
				setCycle: Walk
			)
			((= newProp_2 (Prop new:))
				posn: 162 102
				view: 121
				cycleSpeed: 1
				setLoop: 0
				init:
				stopUpd:
				setScript: lipLooper
			)
			((= newProp_3 (Prop new:))
				posn: 210 94
				view: 132
				cel: 0
				loop: 2
				init:
				stopUpd:
			)
			((= newAct (Act new:))
				view: 141
				setStep: 4 2
				illegalBits: 0
				ignoreActors: 1
				posn: 350 129
				setCycle: Walk
				init:
				stopUpd:
			)
			(User canControl: 0 canInput: 0)
			(= global205 1)
			(gRoom setScript: walkIn)
		)
		(if (gCast contains: newProp_2) (theMusic play:))
	)
	
	(method (doit)
		(if (& (gEgo onControl: 0) $0040)
			(cond 
				((and (== global109 99) (== global169 0)) (gRoom newRoom: 80))
				((not local10) (Print 92 0) (= local10 1))
			)
		else
			(= local10 0)
		)
		(if
			(and
				(& (gEgo onControl: 0) $0020)
				(!= (gEgo view?) 81)
			)
			(gRoom newRoom: 91)
		)
		(if
			(and
				(& (gEgo onControl: 0) $0010)
				(!= (gEgo view?) 81)
			)
			(gRoom newRoom: 93)
		)
		(super doit:)
	)
	
	(method (handleEvent pEvent)
		(return
			(if (pEvent claimed?)
				(return 1)
			else
				(if
					(and
						local8
						(== (pEvent type?) evKEYBOARD)
						(== (pEvent message?) KEY_RETURN)
					)
					((self script?) seconds: 1)
					(= local9 0)
					(= local8 0)
				)
				(if (== (pEvent type?) evSAID)
					(cond 
						((Said 'look>')
							(cond 
								((Said '/throne') (Print 92 1))
								((Said '/stair') (Print 92 2))
								((Said '<behind,under/tapestries,painting') (Print 92 3))
								((Said '/tapestries,painting') (Print 92 4))
								((Said '/door') (Print 92 5))
								((Said '/wall') (Print 92 6))
								((or (Said '/dirt') (Said '<down')) (Print 92 7))
								((Said '/carpet') (Print 92 8))
								(
									(or
										(Said '<around')
										(Said '/room[<throne]')
										(Said '/castle')
									)
									(Print 92 9)
								)
							)
						)
						((Said 'sit/throne') (Print 92 10))
						((Said 'open/door')
							(if (and (== global109 99) (== global169 0))
								(Print 92 11)
							else
								(Print 92 12)
								(Print 92 13)
							)
						)
						((Said 'unlatch/door')
							(if (and (== global109 99) (== global169 0))
								(Print 92 14)
							else
								(Print 92 15)
							)
						)
					)
				)
			)
		)
	)
	
	(method (newRoom newRoomNumber)
		(if
		(or (== newRoomNumber 80) (== newRoomNumber 30))
			((ScriptID 604) keep: 0)
			(= global189 0)
		)
		(super newRoom: newRoomNumber)
	)
)

(instance walkIn of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(gEgo setMotion: MoveTo 153 137 self)
			)
			(1
				(gEgo cel: 1)
				(switch global109
					(0
						(= global169 1)
						(gRoom setScript: lotTalk1)
					)
					(1
						(gRoom setScript: lotTalk3)
					)
					(2
						(gRoom setScript: lotTalk4)
					)
					(3
						(gRoom setScript: lotTalk5)
					)
					(else  (Print 92 16))
				)
			)
		)
	)
)

(instance lotTalk1 of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(= local9 3)
				(= local4
					(Print 92 17 67 5 15 33 gSmallFont 70 125 83 88)
				)
				(= local8 1)
				(= seconds 7)
			)
			(1
				(= local9 0)
				(proc0_21)
				(= local4
					(Print 92 18 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 7)
			)
			(2
				(= local9 9)
				(proc0_21)
				(= local4
					(Print 92 19 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 10)
			)
			(3
				(proc0_21)
				(= local4
					(Print 92 20 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 16)
			)
			(4
				(proc0_21)
				(= local4
					(Print 92 21 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 8)
			)
			(5
				(proc0_21)
				(= local9 8)
				(= local4
					(Print 92 22 33 gSmallFont 67 5 15 70 125 88)
				)
				(= local8 1)
				(= seconds 9)
			)
			(6
				(proc0_21)
				(= local4
					(Print 92 23 33 gSmallFont 67 5 15 70 125 88)
				)
				(newProp_2 loop: 1 cel: 255 setCycle: End)
				(= local8 1)
				(= seconds 4)
			)
			(7 ; changed from duplicate (6
				(= local8 0)
				(gEgo
					view: 81
					setLoop: 0
					illegalBits: 0
					setMotion: MoveTo 325 132
				)
				(= seconds 5)
			)
			(8 ; (7 to (8 to make room for renaming duplicate (6 to (7
				(newProp setCycle: Fwd)
				(proc0_21)
				(gRoom newRoom: 86)
			)
		)
	)
)

(instance lotTalk2 of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(gEgo setMotion: MoveTo 153 137 self)
			)
			(1
				(gEgo view: 82 loop: 0 cel: 1)
				(= local9 4)
				(= local4
					(Print 92 24 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 7)
			)
			(2
				(= local9 7)
				(proc0_21)
				(= local4
					(Print 92 25 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 10)
			)
			(3
				(proc0_21)
				(= local4
					(Print 92 26 67 5 15 33 gSmallFont 70 125 88)
				)
				(newProp_3 view: 132 loop: 2 setCycle: End)
				(= local8 1)
				(= seconds 6)
			)
			(4
				(= local9 5)
				(proc0_21)
				(newProp_3 setCycle: Beg)
				(= local4
					(Print 92 27 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 6)
			)
			(5
				(= local9 5)
				(proc0_21)
				(= local4
					(Print 92 28 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 7)
			)
			(6
				(= local9 3)
				(newProp setCycle: Fwd)
				(proc0_21)
				(= local4
					(Print 92 29 33 gSmallFont 67 5 15 70 125 88)
				)
				(newProp_2 loop: 2 cel: 255 setCycle: End)
				(= local8 1)
				(= seconds 6)
			)
			(7
				(= local8 0)
				(proc0_21)
				(= global109 1)
				(User canControl: 1 canInput: 1)
				(= global205 0)
				(gRoom newRoom: 30)
			)
		)
	)
)

(instance lotTalk3 of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(= local9 6)
				(= local4
					(Print 92 30 67 5 15 33 gSmallFont 70 125 88)
				)
				(= global123 99)
				(gGame changeScore: 7)
				(newProp_3 view: 132 loop: 2 setCycle: End)
				(= local8 1)
				(= seconds 7)
			)
			(1
				(= local9 8)
				(proc0_21)
				(= local4
					(Print 92 31 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 8)
			)
			(2
				(proc0_21)
				(newProp_3 setCycle: Beg)
				(= local4 (Print 92 32 33 gSmallFont 70 125 88))
				(= local8 1)
				(= seconds 7)
			)
			(3
				(= local9 12)
				(proc0_21)
				(= local4
					(Print 92 33 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 12)
			)
			(4
				(= local9 6)
				(proc0_21)
				(= local4
					(Print 92 34 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 6)
			)
			(5
				(newProp setCycle: Fwd)
				(proc0_21)
				(= local4
					(Print 92 35 33 gSmallFont 67 5 15 70 125 88)
				)
				(newProp_2 loop: 2 cel: 255 setCycle: End)
				(= local8 1)
				(= seconds 5)
			)
			(6
				(proc0_21)
				(= global109 2)
				(User canControl: 1 canInput: 1)
				(= global205 0)
				(gRoom newRoom: 30)
			)
		)
	)
)

(instance lotTalk4 of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(= local9 8)
				(= local4
					(Print 92 36 67 5 15 33 gSmallFont 70 125 88)
				)
				(gEgo put: 33 84)
				(gGame changeScore: 7)
				(newProp_3 view: 132 loop: 2 setCycle: End)
				(= local8 1)
				(= seconds 10)
			)
			(1
				(proc0_21)
				(= local4
					(Print 92 37 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 4)
			)
			(2
				(newProp_3 setCycle: Beg)
				(= local9 6)
				(proc0_21)
				(= local4
					(Print 92 38 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 8)
			)
			(3
				(= local9 8)
				(proc0_21)
				(= local4
					(Print 92 39 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 8)
			)
			(4
				(proc0_21)
				(= local4
					(Print 92 40 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 4)
			)
			(5
				(= local9 6)
				(proc0_21)
				(= local4
					(Print 92 41 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 10)
			)
			(6
				(= local9 7)
				(proc0_21)
				(= local4
					(Print 92 42 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 10)
			)
			(7
				(proc0_21)
				(= local4
					(Print 92 43 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 6)
			)
			(8
				(proc0_21)
				(= local4
					(Print 92 44 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 8)
			)
			(9
				(= local9 8)
				(proc0_21)
				(= local4
					(Print 92 45 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 10)
			)
			(10
				(proc0_21)
				(= local4
					(Print 92 46 33 gSmallFont 67 5 15 70 125 88)
				)
				(newProp_2 loop: 2 cel: 255 setCycle: End)
				(= local8 1)
				(= seconds 6)
			)
			(11
				(newProp setCycle: Fwd)
				(proc0_21)
				(= global109 3)
				(User canControl: 1 canInput: 1)
				(= global205 0)
				(gRoom newRoom: 30)
			)
		)
	)
)

(instance lotTalk5 of Script
	(properties)
	
	(method (init param1)
		(super init: param1)
	)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(= local9 6)
				(= local4
					(Print 92 47 67 5 15 33 gSmallFont 70 125 88)
				)
				(gEgo put: 4 84)
				(gGame changeScore: 7)
				(newProp_3 view: 132 loop: 2 setCycle: End)
				(= local8 1)
				(= seconds 10)
			)
			(1
				(proc0_21)
				(= local4
					(Print 92 48 67 25 35 33 gSmallFont 70 -1 88)
				)
				(= local8 1)
				(= seconds 4)
			)
			(2
				(= local9 3)
				(proc0_21)
				(newProp_3 setCycle: Beg)
				(= local4
					(Print 92 49 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 8)
			)
			(3
				(= local9 4)
				(proc0_21)
				(= local4
					(Print 92 50 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 8)
			)
			(4
				(= local9 6)
				(proc0_21)
				(= local4
					(Print 92 51 67 5 15 33 gSmallFont 70 125 88)
				)
				(newProp_2 loop: 2 cel: 255 setCycle: End)
				(= local8 1)
				(= seconds 10)
			)
			(5
				(proc0_21)
				(= local4
					(Print 92 52 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 6)
			)
			(6 (= seconds 1))
			(7
				((= newProp_4 (Prop new:))
					view: 681
					posn: (newProp_3 x?) (- (newProp_3 y?) 35)
					cel: 255
					init:
					cycleSpeed: 1
					setCycle: End self
				)
				(newProp_2 loop: 3 cel: 255 setCycle: End)
				(= local8 0)
			)
			(8
				(newProp_4 dispose:)
				(newProp_2 loop: 3 cel: 3 setCycle: Beg)
				(= seconds 10)
			)
			(9
				(proc0_21)
				(newProp_2 loop: 2 cel: 3 setCycle: Beg self)
			)
			(10
				(newProp_2 loop: 0)
				(= local9 6)
				(= local4
					(Print 92 53 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 10)
			)
			(11
				(proc0_21)
				(newProp_2 loop: 0)
				(= local9 6)
				(= local4
					(Print 92 54 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 1)
				(= seconds 7)
			)
			(12
				(proc0_21)
				(= local9 5)
				(getShit changeState: 0)
				(= local4
					(Print 92 55 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local8 0)
				(= seconds 10)
			)
			(13
				(proc0_21)
				(= local4
					(Print 92 56 67 5 15 33 gSmallFont 70 125 88)
				)
				(= gInvFirst (gInv first:))
				(while gInvFirst
					(if
						(and
							(= local5 (NodeValue gInvFirst))
							(== (local5 owner?) gEgo)
						)
						(local5 owner: 89)
					)
					(= gInvFirst (gInv next: gInvFirst))
				)
				(= local8 0)
				(= seconds 8)
			)
			(14 (= seconds 2))
			(15
				(= local9 6)
				(newProp setCycle: Fwd)
				(proc0_21)
				(= local4
					(Print 92 57 67 5 15 33 gSmallFont 70 125 88)
				)
				(= local9 3)
				(= local8 1)
				(= seconds 6)
			)
			(16
				(gEgo
					view: 81
					illegalBits: 0
					setLoop: 1
					setMotion: MoveTo -5 132 self
				)
			)
			(17
				(proc0_21)
				(= global109 99)
				(gEgo hide: illegalBits: -32768)
				(gRoom newRoom: 81)
			)
		)
	)
)

(instance lipLooper of Script
	(properties)
	
	(method (doit)
		(if
			(and
				(> local9 0)
				(== (newProp_2 loop?) 0)
				(== (newProp_2 cycler?) 0)
			)
			(-- local9)
			(newProp_2 setCycle: End)
		)
	)
)

(instance getShit of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(newAct posn: 290 129 setMotion: MoveTo 153 129 self)
			)
			(1
				(newAct loop: 2)
				(newAct setMotion: MoveTo 320 130 self)
			)
			(2 (newAct dispose:))
		)
	)
)
