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

(public
	Room47 0
)
(synonyms
	(room room castle)
)

(local
	newAct
	newAct_2
	newAct_3
	newAct_4
)
(instance theMusic of Sound
	(properties
		number 33
	)
)

(instance Room47 of Rm
	(properties
		picture 47
		style $0010
	)
	
	(method (init)
		(Load rsVIEW 632)
		(Load rsVIEW 111)
		(Load rsVIEW 113)
		(super init:)
		(proc0_9)
		(= global205 0)
		(if (or (== gPrevRoomNum 37) (== gPrevRoomNum 0))
			(gEgo posn: 156 176 view: 4 xStep: 4 yStep: 2 init:)
		)
		(if (== gPrevRoomNum 46)
			(gEgo
				posn: 72 141
				view: 4
				illegalBits: -32768
				xStep: 4
				yStep: 2
				init:
			)
		)
		((View new:)
			view: 632
			loop: 0
			cel: 3
			posn: 38 105
			setPri: 14
			addToPic:
		)
		((View new:)
			view: 632
			loop: 0
			cel: 4
			posn: 281 106
			setPri: 14
			addToPic:
		)
		((= newAct (Act new:))
			view: 632
			loop: 2
			cel: 2
			illegalBits: 0
			setPri: 14
			posn: 41 97
			setCycle: Fwd
			init:
		)
		((= newAct_2 (Act new:))
			view: 632
			loop: 2
			cel: 2
			illegalBits: 0
			setPri: 14
			setCycle: Fwd
			posn: 278 98
			init:
		)
		((= newAct_3 (Act new:))
			view: 111
			posn: 250 79
			illegalBits: 8192
			setPri: 14
			xStep: 1
			yStep: 3
			setMotion: Wander 5
			setCycle: Fwd
			init:
		)
		((= newAct_4 (Act new:))
			view: 113
			posn: 65 74
			illegalBits: 8192
			setPri: 14
			xStep: 1
			yStep: 3
			setMotion: Wander 5
			setCycle: Fwd
			init:
		)
		(theMusic play:)
	)
	
	(method (doit)
		(super doit:)
		(if (& (gEgo onControl: 0) $0040)
			(gRoom newRoom: 37)
		)
		(if (& (gEgo onControl: 0) $0020)
			(gRoom newRoom: 46)
		)
	)
	
	(method (handleEvent pEvent)
		(if (pEvent claimed?) (return 1))
		(return
			(if (== (pEvent type?) evSAID)
				(cond 
					(
						(or
							(Said 'look[<around][/!*]')
							(Said 'look[<around]/room')
						)
						(Print 47 0)
					)
					((Said 'look>')
						(cond 
							(
								(or
									(Said '<around')
									(Said '[<around]/room,room,hall,entry')
								)
								(Print 47 0)
							)
							((Said '/door') (Print 47 1))
							((Said '/flora,blossom') (Print 47 2))
							((Said '/wall') (Print 47 3))
							((Said '[<down]/dirt') (Print 47 4))
							((Said '/fairies[<little]') (Print 47 5))
						)
					)
					((Said 'open/door')
						(if
							(or
								(gEgo inRect: 146 127 176 131)
								(gEgo inRect: 238 141 260 153)
							)
							(Print 47 6)
						else
							(Print 800 1)
						)
					)
					((Said 'unlatch/door')
						(if
							(or
								(gEgo inRect: 146 127 176 131)
								(gEgo inRect: 238 141 260 153)
							)
							(if (or (gEgo has: 32) (gEgo has: 20))
								(Print 47 7)
							else
								(Print 47 8)
							)
						else
							(Print 800 1)
						)
					)
					((Said 'bang/door')
						(if
							(or
								(gEgo inRect: 146 127 176 131)
								(gEgo inRect: 238 141 260 153)
							)
							(Print 47 9)
						else
							(Print 800 1)
						)
					)
					((Said 'break/door')
						(if
							(or
								(gEgo inRect: 146 127 176 131)
								(gEgo inRect: 238 141 260 153)
							)
							(Print 47 10)
						else
							(Print 800 1)
						)
					)
					((Said 'use/key')
						(if
							(or
								(gEgo inRect: 146 127 176 131)
								(gEgo inRect: 238 141 260 153)
							)
							(if (or (gEgo has: 20) (gEgo has: 32))
								(Print 47 11)
							else
								(Print 47 12)
							)
						else
							(Print 47 13)
						)
					)
					(
						(or
							(Said 'converse/fairies[<little]')
							(Said 'converse[/!*]')
						)
						(Print 47 14)
					)
					((Said 'kill/fairies[<little]') (Print 47 15))
					((Said 'get/fairies[<little]') (Print 47 16))
					((Said 'capture/fairies[<little]') (Print 47 16))
					(
					(or (Said 'kiss/fairies[<little]') (Said 'kiss[/!*]')) (Print 47 17))
					((Said 'help/fairies[<little]') (Print 47 18))
					((Said 'deliver/*/fairies') (Print 47 19))
				)
			else
				0
			)
		)
	)
)
