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

(public
	wearCrown 0
)

(local
	gEgoViewer
)
(instance poofSound of Sound
	(properties)
)

(instance wearCrown of Script
	(properties)
	
	(method (init)
		(= global204 1)
		(Load rsVIEW 370)
		(Load rsVIEW 687)
		(super init:)
	)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(if (== global189 1)
					(Print 301 0)
					(gEgo script: gGEgoScript)
					(DisposeScript 301)
					(return)
				else
					(proc0_8)
					(self changeState: 1)
				)
			)
			(1
				(= gEgoViewer (gEgo viewer?))
				(gSounds eachElementDo: #stop 0)
				(poofSound number: 59 play:)
				(User canControl: 0 canInput: 0)
				(= gGEgoView (gEgo view?))
				(= gNewProp (Prop new:))
				(gNewProp
					x: (gEgo x?)
					y: (gEgo y?)
					view: 687
					loop: 0
					ignoreActors:
					setPri: (+ (gEgo priority?) 1)
					cel: 0
					setCycle: CT 3 1 self
					init:
				)
			)
			(2
				(gNewProp setCycle: End self)
				(gEgo viewer: 0 view: 370 cycleSpeed: 2 setCycle: Fwd)
			)
			(3
				(Timer setReal: self 5)
				(gNewProp hide:)
				(Print 301 1)
			)
			(4
				(Print 301 2)
				(poofSound number: 59 play:)
				(gNewProp
					x: (gEgo x?)
					y: (gEgo y?)
					show:
					cel: 10
					setCycle: CT 3 -1 self
				)
			)
			(5
				(gEgo view: gGEgoView cycleSpeed: 0 setCycle: Walk)
				(gNewProp setCycle: Beg self)
			)
			(6 (= cycles 2))
			(7
				(if (== (poofSound state?) 3)
					(self changeState: 6)
				else
					(poofSound dispose:)
					(gNewProp dispose:)
					(gEgo viewer: gEgoViewer script: gGEgoScript)
					(proc0_9)
					(DisposeScript 301)
				)
			)
		)
	)
)
