Scriptname XingRandomeffect1Script extends activemagiceffect  

XingRandomScript Property FNISquest Auto
Message property SelectionMSG Auto
Message property SelectionMSG1 Auto
Message property Group1MSG Auto
Message property Group2MSG Auto
Message property Group3MSG Auto
Message property Group4MSG Auto
Message property Group5MSG Auto
Message property Group6MSG Auto
Message property Group7MSG Auto
Message property Group8MSG Auto
Message property Group9MSG Auto
Message property Group10MSG Auto
Message property Group11MSG Auto
Message property Group12MSG Auto

Bool OneMoreDisplay

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
	Utility.Wait(1)

	OneMoreDisplay = True
	While OneMoreDisplay
		OneMoreDisplay = DisplayMessage()
	EndWhile
ENDEVENT

Bool Function DisplayMessage()
Int i
Bool OneMore
	OneMore = false 
	if ( FNISquest.CurrentGroup == 1 )
		i = Group1MSG.Show()
		if ( i <= 8 )
			FNISquest.NextIdle = i
		else
			FNISquest.CurrentGroup = 0
			OneMore = true
		endif
	elseif ( FNISquest.CurrentGroup == 2 )
		i = Group2MSG.Show()
		if ( i <= 8 )
			FNISquest.NextIdle = i + 9
		else
			FNISquest.CurrentGroup = 0
			OneMore = true
		endif
	elseif ( FNISquest.CurrentGroup == 3 )
		i = Group3MSG.Show()
		if ( i <= 8 )
			FNISquest.NextIdle = i + 18
		else
			FNISquest.CurrentGroup = 0
			OneMore = true
		endif
	elseif ( FNISquest.CurrentGroup == 4 )
		i = Group4MSG.Show()
		if ( i <= 8 )
			FNISquest.NextIdle = i + 27
		else
			FNISquest.CurrentGroup = 0
			OneMore = true
		endif
	elseif ( FNISquest.CurrentGroup == 5 )
		i = Group5MSG.Show()
		if ( i <= 8 )
			FNISquest.NextIdle = i + 36
		else
			FNISquest.CurrentGroup = 0
			OneMore = true
		endif
	elseif ( FNISquest.CurrentGroup == 6 )
		i = Group6MSG.Show()
		if ( i <= 8 )
			FNISquest.NextIdle = i + 45
		else
			FNISquest.CurrentGroup = 0
			OneMore = true
		endif
	elseif ( FNISquest.CurrentGroup == 7 )
		i = Group7MSG.Show()
		if ( i <= 8 )
			FNISquest.NextIdle = i + 54
		else
			FNISquest.CurrentGroup = 0
			OneMore = true
		endif
	elseif ( FNISquest.CurrentGroup == 8 )
		i = Group8MSG.Show()
		if ( i <= 8 )
			FNISquest.NextIdle = i + 63
		else
			FNISquest.CurrentGroup = 0
			OneMore = true
		endif

		
	elseif ( FNISquest.CurrentGroup == 9 )
		i = Group9MSG.Show()
		if ( i <= 8 ) 
			FNISquest.NextIdle = i + 72
		else
			FNISquest.CurrentGroup = 0
			OneMore = true
		endif
	elseif ( FNISquest.CurrentGroup == 10 )
		i = Group10MSG.Show()
		if ( i <= 8 )
			FNISquest.NextIdle = i + 81
		else
			FNISquest.CurrentGroup = 0
			OneMore = true
		endif
	elseif ( FNISquest.CurrentGroup == 11 )
		i = Group11MSG.Show()
		if ( i <= 8 )
			FNISquest.NextIdle = i + 90
		else
			FNISquest.CurrentGroup = 0
			OneMore = true
		endif
	elseif ( FNISquest.CurrentGroup == 12 )
		i = Group12MSG.Show()
		if ( i <= 8 )
			FNISquest.NextIdle = i + 99
		else
			FNISquest.CurrentGroup = 0
			OneMore = true
		endif
		
	elseif ( FNISquest.CurrentGroup == 0 )
		i = SelectionMSG.Show()
		if ( i < 8 )
			FNISquest.CurrentGroup = i + 1
			OneMore = true
		elseif( i == 8 )
			i = SelectionMSG1.Show()
			FNISquest.CurrentGroup = i + 9
			OneMore = true
		else
			FNISquest.CurrentGroup = 0
		endif
		
	endif	
	return OneMore

Endfunction

