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

(public
	beachReg 0
)
(synonyms
	(ocean seawater ocean)
)

(local
	[local0 7]
	local7
	gEgoViewer
)
(instance beachReg of Rgn
	(properties)
	
	(method (init)
		(super init:)
		(Load rsVIEW 21)
	)
	
	(method (handleEvent pEvent)
		(if (pEvent claimed?) (return 1))
		(return
			(if (== (pEvent type?) evSAID)
				(cond 
					((Said 'look>')
						(cond 
							((Said '<in,under/ocean,water')
								(if (!= (gEgo view?) 2)
									(Print 503 0)
								else
									(Print 503 1)
								)
							)
							((Said '/ocean,water') (Print 503 2))
							((Said '/fish')
								(if (gEgo has: 24)
									((Inv at: 24) showSelf:)
								else
									(Print 503 3)
								)
							)
							((Said '/beach') (Print 503 4))
							((or (Said '/sky') (Said '<up'))
								(if (not global100)
									(Print 503 5)
								else
									(Print 503 6)
								)
							)
							((or (Said '/dirt') (Said '<down')) (Print 503 7))
							((Said '/boulder') (Print 503 8))
							((Said '/forest') (Print 503 9))
							((Said '/grass') (Print 503 10))
							((Said '/bush') (Print 503 11))
							((Said '/flora,blossom') (Print 503 12))
						)
					)
					((Said 'get/flora,blossom') (Print 503 13))
					((Said 'get/water') (Print 503 14))
					((or (Said 'drink') (Said 'get/drink'))
						(cond 
							((!= (gEgo view?) 2) (Print 503 15))
							(
								(or
									(& (= local7 (proc0_2 gEgo 12)) $0008)
									(& local7 $0800)
									(& local7 $0002)
									(& local7 $0200)
								)
								(= gGEgoScript (gEgo script?))
								(gEgo setScript: drinking)
							)
							(else (Print 800 1))
						)
					)
					((Said 'bathe,dive,wade[<enter][/ocean]>')
						(cond 
							((!= global105 4) (Print 503 16))
							((Said '<under') (Print 503 17))
							(else (Print 503 18))
						)
						(pEvent claimed: 1)
					)
					(
					(or (Said 'capture,get/fish') (Said 'fish[<enter]'))
						(cond 
							((== global105 4) (Print 503 19))
							((gEgo has: 17) (Print 503 20))
							(else (Print 503 21))
						)
					)
				)
			else
				0
			)
		)
	)
)

(instance drinking of Script
	(properties)
	
	(method (changeState newState)
		(switch (= state newState)
			(0
				(= global204 1)
				(proc0_8)
				(= gEgoViewer (gEgo viewer?))
				(gEgo viewer: 0 view: 21 cel: 0 setCycle: End self)
			)
			(1
				(Timer setReal: self 5)
				(= global120 (Print 503 22 67 -1 10 88))
			)
			(2 (gEgo setCycle: Beg self))
			(3
				(if gModelessDlg (gModelessDlg dispose:))
				(= global204 0)
				(gEgo view: 2 setCycle: Walk)
				(gEgo script: gGEgoScript viewer: gEgoViewer)
				(proc0_9)
			)
		)
	)
)
