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

(public
	Room94 0
)

(local
	newAct
	newProp
	newProp_2
)
(instance block1 of Blk
	(properties
		top 137
		left 58
		bottom 146
		right 152
	)
)

(instance block2 of Blk
	(properties
		top 136
		left 161
		bottom 146
		right 248
	)
)

(instance Room94 of Rm
	(properties
		picture 94
		style $0010
	)
	
	(method (init)
		(Load rsVIEW 380)
		(Load rsVIEW 386)
		(Load rsVIEW 609)
		(super init:)
		(= global101 1)
		(gEgo
			posn: 149 166
			view: 2
			setStep: 2 1
			observeBlocks: block1 block2
			init:
		)
		((= newProp (Prop new:))
			view: 609
			loop: 0
			cel: 0
			posn: 154 120
			setPri: 10
			init:
			stopUpd:
		)
		((= newProp_2 (Prop new:))
			view: 609
			loop: 1
			cel: 0
			posn: 245 120
			setPri: 10
			init:
			stopUpd:
		)
		(if (== global123 99)
			((= newAct (Act new:))
				view: 380
				loop: 0
				cel: 0
				posn: 203 144
				illegalBits: 0
				cycleSpeed: 2
				setPri: 9
				init:
				setScript: uniStuff
			)
		)
	)
	
	(method (doit)
		(super doit:)
		(if (& (gEgo onControl: 0) $0040)
			(gRoom newRoom: 80)
		)
	)
	
	(method (handleEvent pEvent)
		(return
			(cond 
				((pEvent claimed?) (return 1))
				((!= (pEvent type?) evSAID) (return 1))
				((Said 'open/gate')
					(cond 
						((!= (newProp_2 cel?) 0) (Print 94 0))
						((not (gEgo inRect: 150 144 163 158)) (Print 800 1))
						(else
							(gEgo ignoreControl: 16)
							(newProp_2 ignoreActors: 1 setCycle: End gateScript)
							(if (== global123 99)
								(uniStuff changeState: 4)
							else
								(gEgo ignoreBlocks: block2)
							)
						)
					)
				)
				((Said 'close/gate')
					(cond 
						((== (newProp_2 cel?) 0) (Print 94 1))
						((not (gEgo inRect: 232 149 248 158)) (Print 800 1))
						(else
							(gEgo observeControl: 16)
							(newProp_2 ignoreActors: 0 setCycle: Beg gateScript)
						)
					)
				)
				((Said 'converse[/unicorn,horse]')
					(if
					(or (!= global123 99) (not (gCast contains: newAct)))
						(Print 94 2)
					else
						(Print 94 3)
					)
				)
				((Said 'kiss')
					(if (== global123 99)
						(Print 94 4)
					else
						(Print 94 5)
					)
				)
				((Said '/unicorn,horse>')
					(cond 
						((!= global123 99) (Print 94 5) (pEvent claimed: 1))
						((Said 'look/*')
							(if (== global123 99)
								(Print 94 6)
								(Print 94 7)
							else
								(Print 94 8)
							)
						)
						((Said 'pat') (Print 94 9))
						((Said 'mount') (Print 94 10))
						((Said 'get,capture,guide') (Print 94 11))
						((Said 'free,help') (Print 94 12))
						(else (Print 94 13) (pEvent claimed: 1))
					)
				)
				((Said 'look>')
					(cond 
						((Said '/gate') (Print 94 14))
						((Said '/wall') (Print 94 15))
						((Said '[<around][/room,barn]')
							(Print 94 16)
							(if (== global123 99) (Print 94 17))
						)
					)
				)
			)
		)
	)
)

(instance gateScript of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(1
				(newProp_2 stopUpd:)
				(= state 0)
			)
		)
	)
)

(instance uniStuff of Script
	(properties)
	
	(method (init param1)
		(super init: param1)
	)
	
	(method (changeState newState)
		(switch (= state newState)
			(0 (newAct setCycle: End self))
			(1 (newAct setCycle: End self))
			(2
				(= state -1)
				(if (not (newProp_2 cel?)) (= seconds (Random 2 5)))
			)
			(4 (proc0_8) (= seconds 1))
			(5
				(User canControl: 0)
				(gEgo loop: 0)
				(gGame changeScore: 4)
				(newAct
					view: 386
					loop: 0
					cel: 255
					cycleSpeed: 0
					setCycle: End self
				)
				(Print 94 18 67 -1 15 70 290)
			)
			(6
				(newAct
					setLoop: 2
					illegalBits: 0
					setCycle: Fwd
					setMotion: MoveTo 150 230 self
				)
			)
			(7
				(gEgo ignoreBlocks: block2)
				(proc0_9)
				(newAct dispose:)
				(= global123 999)
				(= global124 27)
			)
		)
	)
)
