ScriptVersion = "2_0"
'Xenon v2.0
'VPMame Conversion by
'Kurt Herman
'kurt@scapinosvpins.com
'First Release Version 2.0
'May 1, 2005
'Xenon - Bally - 1980
'Thanks to plumb for his previous version.
'Thanks to Gains for good info about the real table.
'Thanks to Inkochnito for his nice standard dip adjustment menu, and schematics.

 
 
'***********************************************************************************
'****				Initialize Table				****
'***********************************************************************************
const cGameName		= "xenon" ' PinMAME short game name
const UseSolenoids	= True
const UseLamps		= False
const UseGI		= False 'Only WPC games have special GI circuit.

Dim GameStarted
Dim DipAdjustMode
Dim AdjustMode
Dim FadeLightsEnabled
Dim InfintyEnabled
Dim FlashBumpersEnabled
Dim LightOnSpeed
Dim LightOffSpeed
Dim PlayerActive
Dim myBall
Dim BallsPerGame
Dim MatchFeature
Dim GameMode
Dim MaxCredits
Dim NumberOfPlayers

Sub Xenon_Init()
 	HideTheDips
 	AllReelsOff
 	FadeLightsEnabled = 1
 	InfintyEnabled = 0
 	FlashBumpersEnabled = 0
	Reset = 0
 	LightOnSpeed = 8
 	LightOffSpeed =45
 	Cursor = 1
	GameStarted = 0
	DipAdjustMode = 0
	AdjustMode = 0
	AttractCount = 1
	Wall41.IsDropped = False
 	PlayerActive = 0
 	Drain.CreateBall
 	SecondBall.CreateBall
	BallInDrain = True
	BallOut = 0
	BallTwoActive = 0
	LoadInfo
	vpmInit Me

 	With Controller
		
		.GameName="xenon"   ' PinMAME short name
		.SplashInfoLine="Xenon Visual PinMame table by Kurt Herman 'scapino'"
		.HandleKeyboard = false
		.ShowTitle=0
		.ShowDMDOnly=1
		.ShowFrame=0
		
		.Games("xenon").Settings.SetDisplayPosition 450, 800 ',GetPlayerHwnd
		.Games("xenon").Settings.Value("synclevel")=30
		On Error Resume Next
			.Run GetPlayerHwnd
			If Err Then MsgBox Err.Description
		On Error Goto 0

		.Hidden=True
	End With
 
	PinMAMETimer.Interval = 50
	PinMAMETimer.Enabled = True
	PulseTimer.Interval = 50
	PulseTimer.Enabled = True
	
	Set MyPlayerDigs(28) = CDigit2
	Set MyPlayerDigs(29) = CDigit1
	Set MyPlayerDigs(30) = BDigit2
	Set MyPlayerDigs(31) = BDigit1

	DisplayTimer.Enabled = True
	
	' Nudging  
	vpmNudge.TiltSwitch = 7
	vpmNudge.Sensitivity = 5
	vpmNudge.TiltObj = Array(Bumper1,Bumper2,Bumper3,Bumper4,LeftSlingshot,RightSlingshot)


	SolCallback(sUpperSaucer) = "TopSaucerKick"
	SolCallback(sSideSaucer) = "SideSaucerKick"
 	SolCallback(sOutHoleKicker) = "OutHoleKick"
	
 	Controller.Switch(28) = True
 	Controller.Switch(2) = True
	
	DIPInits
 
End Sub

Sub DIPInits
	GetDips
End Sub

Sub AllReelsOff()
	dim obj
 	For Each obj in AllReels
 		obj.SetValue(0)
 		obj.UserValue = 0
 	Next
End Sub

Sub AllReelsOn()
	dim obj
 	For Each obj in AllReels
 		obj.SetValue(1)
 		obj.UserValue = 1
 	Next
End Sub

Sub RestoreLights()
	dim obj
 	For Each obj in AllReels
 		obj.SetValue(obj.UserValue)
 	Next
End Sub

'Bally Xenon
'Thanks to Inkochnito
Sub editDips
 	Dim vpmDips : Set vpmDips = New cvpmDips
 	With vpmDips
 		.AddForm 700,400,"Xenon - DIP switches"
 		.AddChk 7,10,180,Array("Match feature",&H08000000)'dip 28
 		.AddChk 205,10,115,Array("Credits display",&H04000000)'dip 27
 		.AddFrame 2,30,190,"Maximum credits",&H03000000,Array("10 credits",0,"15 credits",&H01000000,"25 credits",&H02000000,"40 credits",&H03000000)'dip 25&26
 		.AddFrame 2,106,190,"Drop target 2X lite adjustment",&H00000020,Array("2X is off at start game",0,"2X is on at start game",&H00000020)'dip 6
 		.AddFrame 2,152,190,"Drop target tube exit value",&H00000040,Array("exit value does not step",0,"exit value steps up 1",&H00000040)'dip 7
 		.AddFrame 2,198,190,"Drop target special lite",&H00000080,Array("lite steps to 25000",0,"lite stays lit",&H00000080)'dip 8
 		.AddFrame 2,248,190,"Outlanes and flipper feed lanes",&H00002000,Array("1 lite comes on then alternates",0,"both lites come on",&H00002000)'dip 14
 		.AddFrame 2,298,190,"Top saucer scoring and Xenon lite",49152,Array ("scores 5,000 and no lite advances",0,"scores 10,000 and 1 lite advance",&H00004000,"scores 10,000 and 2 lite advances",49152)'dip 15&16
 		.AddFrame 205,30,190,"Balls per game",&HC0000000,Array ("2 balls",&HC0000000,"3 balls",0,"4 balls",&H80000000,"5 balls",&H40000000)'dip 31&32
 		.AddFrame 205,106,190,"Side saucer mota special lite",&H00100000,Array("special resets with the score",0,"special will alternate",&H00100000)'dip 21
 		.AddFrame 205,152,190,"Side saucer mota score lites",&H00200000,Array("any lite will reset to 5,000",0,"any lite will come on for next ball",&H00200000)'dip 22
 		.AddFrame 205,198,190,"Side saucer mota lite advance",&H00400000,Array("mota lites advance 1 at a time",0,"mota lites advance 2 times",&H00400000)'dip 23
 		.AddFrame 205,248,190,"Side saucer mota 50K, 90K lite",&H00800000,Array("lites step to 50K only",0,"lites step to 90K",&H00800000)'dip 24
 		.AddFrame 205,298,190,"Game over attract",&H10000000,Array("no voice",0,"voice says: try me again",&H10000000)'dip 29
 		.AddFrame 205,348,190,"Top saucer first 2X lites adjust",&H20000000,Array("not in memory",0,"in memory",&H20000000)'dip 30
 		.AddLabel 50,400,300,20,"Set selftest position 17,18 and 19 to 03 for the best gameplay."
 		.AddLabel 50,420,300,20,"After hitting OK, press F3 to reset game with new settings."
 		.ViewDips
 	End With
End Sub

Set vpmShowDips = GetRef("editDips")

'***********************************************************************************
'****				Keyboard Handler				****
'***********************************************************************************
Dim Reset

Sub Xenon_KeyDown(ByVal keycode)

 	If keycode = 2 then
		If GameStarted = 1 and BallOut = 1 then
			CheckNumberOfPlayers
		end if
	end if
	
	If vpmKeyDown(keycode) Then Exit Sub
	
	If keycode = PlungerKey Then
 		If PlungerForce < 0 then
 			Playsound "PLUNGER"
 			If BallPresent = True then
 				PlungerForce = Int(((PlungerForce+4) - (PlungerForce-4) + 1) * Rnd + (PlungerForce-4))
 				myBall.VelY = PlungerForce
 				PlaySound "balllaunch"
 			end if
 			If Controller.Lamp(101) = False then
 				PlungerReel.SetValue(0)
 				PlungerReel.UserValue =0
 			else
 				PlungerReel.SetValue(16)
 				PlungerReel.UserValue = 16
 			end if
 		end if
 		PlungerForce = 0
 	End If

	If keycode = LeftTiltKey Then
		Nudge 90, 2
	End If
    
	If keycode = RightTiltKey Then
		Nudge 270, 2
	End If
    
	If keycode = CenterTiltKey Then
		Nudge 0, 2
	End If
 	
 	If keycode = 19 then
		DisplayRuleCard
	End If

	If keycode = 30 and GameStarted = 0 and AdjustMode = 0 then 'A
		AdjustMode = 1
		DisplaySecondMenu
	End If

	If keycode = 33 and GameStarted = 0 and AdjustMode = 1 then 'F
		If FadeLightsEnabled = 0 then
			FadeLightsEnabled = 1
			FadeLitesOn
		else
			FadeLightsEnabled = 0
			FadeLitesOff
		end if
		SaveInfo
		Controller.Switch(16) = False
	End If
	
	If keycode = 38 and GameStarted = 0 and AdjustMode = 1 then 'L
		If InfintyEnabled = 0 then
			InfintyEnabled = 1
			InfinityLitesOn
		else
			For each obj in InfinityLights
 				obj.SetValue(1)
 			Next
			For each obj in RingLights
 				obj.SetValue(1)
 			Next
			InfintyEnabled = 0
			InfinityLitesOff
		end if
		SaveInfo
		Controller.Switch(16) = False
	End If
	
	If keycode = 25 and GameStarted = 0 and AdjustMode = 1 then 'P
		If FlashBumpersEnabled = 0 then
			FlashBumpersEnabled = 1
			PopFlashOn
		else
			FlashBumpersEnabled = 0
			PopFlashOff
		end if
		SaveInfo
		Controller.Switch(16) = False
	End If

	If keycode = 32 and GameStarted = 0 and DipAdjustMode = 0 and AdjustMode = 1 then 'D
		PlaySound "BallInSaucer"
		DipAdjustMode = 1
		AdjustMode = 2
		DisplayDipMenu
		Controller.Switch(16) = False
		DipAdjust
	End If

 	If keycode = 200 and DipAdjustMode = 0 then 'Up
 		KeyRepeatUp.Enabled = True
 	End If
 	
 	If keycode = 208 and DipAdjustMode = 0 then 'Down
 		KeyRepeatDown.Enabled = True
 	End If
 
	If keycode = 200 and GameStarted = 0 and DipAdjustMode = 1 then 'Up
		PlaySound "BallInSaucer"
		SwitchUp
	End If

	If keycode = 208 and GameStarted = 0 and DipAdjustMode = 1 then 'Down
		PlaySound "BallInSaucer"
		SwitchDown
	End If

	If keycode = 203 and GameStarted = 0 and DipAdjustMode = 1 then 'Left
		PlaySound "BallInSaucer"
		DecCursor
	End If

	If keycode = 205 and GameStarted = 0 and DipAdjustMode = 1 then 'Right
		PlaySound "BallInSaucer"
		IncCursor
	End If

	If keycode = 156 and GameStarted = 0 and DipAdjustMode = 1 then 'Enter
 		PlaySound "BallInSaucer"
		DipAdjustMode = 0
		AdjustMode = 0
		Reset = 1
		HideTheDips
		DIPInits
		AllReelsOff
		Controller.Switch(16) = True
	End If
	
	If keycode = 156 and GameStarted = 0 and AdjustMode = 1 and DipAdjustMode = 0 then 'Enter
		AdjustMode = 0
		DisplayFirstMenu
	End If
 
End Sub

Sub Xenon_KeyUp(ByVal keycode)
 
	If vpmKeyUp(keycode) Then Exit Sub
 
  	if keycode = 30 then
 		Controller.Switch(34) = False
 	end if

 	If keycode = 200 Then 'Up
 		KeyRepeatUp.Enabled = False
 	End If
 
 	If keycode = 208 Then 'Down
 		KeyRepeatDown.Enabled = False
 	End If
 	
End Sub

Sub DisplayRuleCard()
	Dim rulestxt, rboxstyle, droptxt
	rboxstyle = vbInformation
	rulestxt = "                                        XENON" & vbNewLine & vbNewLine
	rulestxt = rulestxt & "BALL IN TOP SAUCER ADVANCES X IN CENTER OF PLAYFIELD." & vbNewLine & vbNewLine
	rulestxt = rulestxt & "MAKING 3X:" & vbNewLine
	rulestxt = rulestxt & "        1ST TIME, BALL PASSING THRU TUBE REMAINS CAPTIVE IN HOLE." & vbNewLine
	rulestxt = rulestxt & "        2ND TIME, EJECTS CAPTIVEBALL ONTO PLAYFIELD PUTTING 2 BALLS" & vbNewLine
	rulestxt = rulestxt & "        IN ACTION FOR MULTIBALL PLAY." & vbNewLine & vbNewLine
	rulestxt = rulestxt & "MULTIBALLPLAY:" & vbNewLine
	rulestxt = rulestxt & "        MAKING 3X 1ST TIME LITES OUTLANE SPECIALS AND SPINNER FOR 1,000 POINTS." & vbNewLine
	rulestxt = rulestxt & "        BALL THRU OUTLANES WHEN LIT FOR SPECIAL SCORES EXTRA BALL OR 50,000." & vbNewLine & vbNewLine
	rulestxt = rulestxt & "        MAKING 3X 2ND TIME SCORES EXTRA BALL OR 50,000 POINTS." & vbNewLine & vbNewLine
	rulestxt = rulestxt & "LIT TOP ROLLOVER BUTTON DROPS LIT TARGET." & vbNewLine
	rulestxt = rulestxt & "DROPPING ALL TARGETS SCORES AND ADVANCES LIT VALUE AND LITES" & vbNewLine
	rulestxt = rulestxt & "RETURN LANES FOR 10,000 POINTS." & vbNewLine & vbNewLine
	rulestxt = rulestxt & "BALL PASSING THRU TUBE SCORES AND ADVANCES LIT EXIT VALUE." & vbNewLine & vbNewLine
	rulestxt = rulestxt & "MAXIMUM 1 EXTRA BALL PER BALL IN PLAY." & vbNewLine
	rulestxt = rulestxt & "TILT PENALTY BALL IN PLAY."
	MsgBox	rulestxt, rboxstyle, "Xenon"
end sub


'***********************************************************************************
'****				Plunger Code					****
'***********************************************************************************

Dim PlungerForce
Sub PlungerReel_Init()
 	PlungerForce = 0
 	PlungerReel.SetValue(0)
 	PlungerReel.UserValue = 0
End Sub

'PLUNGER KEY UP
Sub KeyRepeatUp_Timer()
 		PlungerForce = PlungerForce + 4
 		If PlungerForce > 0 then 
 			PlungerForce = 0
 			If Controller.Lamp(101) = False then
 				PlungerReel.SetValue(0)
 				PlungerReel.UserValue = 0
 			else
 				PlungerReel.SetValue(16)
 				PlungerReel.UserValue = 16
 			End If
 		else
 			PlungerReel.UserValue = PlungerReel.UserValue - 1
 			PlungerReel.SetValue(PlungerReel.UserValue)
			If PlungerReel.UserValue < 2 then
				Wall41.IsDropped = False
			end if
 		end if
End Sub

'PLUNGER KEY DOWN
Sub KeyRepeatDown_Timer()
 		PlungerForce = PlungerForce - 4
 		If PlungerForce < -50 then 
 			PlungerForce = -60
 			If Controller.Lamp(101) = False then
 				PlungerReel.SetValue(15)
 				PlungerReel.UserValue = 15
 			else
 				PlungerReel.SetValue(31)
 				PlungerReel.UserValue = 31
 			End If
 		else
 			PlungerReel.UserValue = PlungerReel.UserValue + 1
 			PlungerReel.SetValue(PlungerReel.UserValue)
			If PlungerReel.UserValue > 1 then
				Wall41.IsDropped = True
			end if
 		end if
End Sub


'***********************************************************************************
'****				Solenoid Handlers				****
'***********************************************************************************
const sResTargets	=  1
const sReset1		=  2
const sReset2		=  3
const sReset3		=  4
const sReset4		=  5
const sKnocker		=  6
const sOutHoleKicker	=  7
const sBallRelease	=  8
const sSideSaucer	=  9
const sBumper1		= 10
const sBumper2		= 11
const sBumper3		= 12
const sBumper4		= 13
const sLSling		= 14
const sRSling		= 15
const sGameOn		= 16
const sUpperSaucer	= 17
const sK1Relay		= 19
const sPowerOn		= 20

'Solenoid Callbacks
SolCallback(sLSling)		= "DoLeftSling"
SolCallback(sRSling)		= "DoRightSling"
SolCallback(sKnocker)		= "DoKnocker"
SolCallback(sResTargets) 	= "BankReset"
SolCallback(sReset1)		= "ResetDrop1"
SolCallback(sReset2)		= "ResetDrop2"
SolCallback(sReset3)		= "ResetDrop3"
SolCallback(sReset4)		= "ResetDrop4"
SolCallback(sPowerOn) 		= "GIOn"
SolCallback(sK1Relay)		= "powerGame"
SolCallback(sBallRelease) 	= "ReleaseBall"
SolCallback(sLRFlipper) 	= "SolFlip RightFlipper,Nothing,"
SolCallback(sLLFlipper) 	= "SolFlip LeftFlipper,Nothing,"

Sub powerGame(enabled)
	vpmNudge.SolGameOn enabled
 	If enabled = true then
 		RestoreLights
 		UpdateMultipleLamps.Enabled = True
 	end if
End Sub

Sub GIOn(enabled)
	dim obj
	If enabled = true then
		AllReelsOn
		UpdateMultipleLamps.Enabled = True
		DisplayTitleMenu
	end if
End Sub

Sub OutHoleKick(enabled)
 	Drain.Kick 90,1
 	Controller.Switch(8) = False
 	Controller.Switch(28) = False
End Sub

Dim BallTwoActive
Sub ReleaseBall(enabled)
	if enabled then
		BallPresent = True
		PlaySound "ballrelease"
 		SecondBall.Kick 67,12
		Controller.Switch(2) = False
 		Drain.Kick 90,1
 		Controller.Switch(28) = False
 		Digit1.SetValue(0)
		Digit2.SetValue(0)
		Digit3.SetValue(0)
		Digit4.SetValue(0)
		Digit5.SetValue(0)
		Digit6.SetValue(0)
		Digit7.SetValue(0)

	end if
End Sub

Sub SideSaucerKick(enabled)
 	if enabled then
		If Controller.Switch(33) = True then
			PlaySound "saucerkick"
		Else
			PlaySound "saucerkickempty"
		end if
 		LowerKicker.Kick 100,7
 		Controller.Switch(33) = False
 	end if
End Sub

Sub TopSaucerKick(enabled)
 	if enabled then
		If Controller.Switch(34) = True then
			PlaySound "saucerkick"
		Else
			PlaySound "saucerkickempty"
		end if
 		UpperKicker.Kick 160,3
 		Controller.Switch(34) = False
 	end if
End Sub

Sub DoLeftSling(enabled)
	If enabled then
		StopSound "Sling"
		PlaySound "Sling"
	End If
End Sub

Sub DoRightSling(enabled)
	If enabled then
		StopSound "Sling"
		PlaySound "Sling"
	End If
End Sub

Sub DoKnocker(enabled)
	If enabled then
		StopSound "KNOCK"
		PlaySound "KNOCK"
	end if
End Sub

Sub SolFlip(aFlip1, aFlip2, aEnabled)  ' Ball Through Flipper Fix
	Dim oldSpeed
 
 	If aEnabled Then
 		PlaySound "FlipperUp" : aFlip1.RotateToEnd : If Not aFlip2 Is Nothing Then  aFlip2.RotateToEnd
 
 		If aFlip1.Name = "LeftFlipper" then
 			LeftFlipperState = True
 			UpdateLeftFlipper
 		else
 			RightFlipperState = True
 			UpdateRightFlipper
 		end if
 
 	Else
 
 		PlaySound "FlipperDown"
 		oldSpeed = aFlip1.Speed : aFlip1.Speed = 0.15
 		aFlip1.RotateToStart : aFlip1.Speed = oldSpeed
 		If Not aFlip2 Is Nothing Then
 			oldSpeed = aFlip2.Speed : aFlip2.Speed = 10
 			aFlip2.RotateToStart : aFlip2.Speed = oldSpeed
 		End If
 		If aFlip1.Name = "LeftFlipper" then
 			LeftFlipperState = False
 			UpdateLeftFlipper
 		else
 			RightFlipperState = False
 			UpdateRightFlipper
 		end if
 
 	End If
 
End Sub

Dim LeftFlipperState
Sub UpdateLeftFlipper
	If XenonYellowELiteState = 0 then
 		If LeftFlipperState = True then
 			LeftFlipperReel.SetValue(1)
 			LeftFlipperReel.AddValue(6)
 			LeftFlipperReel.UserValue = 7
 		else
 			LeftFlipperReel.SetValue(7)
 			LeftFlipperReel.AddValue(-6)
 			LeftFlipperReel.UserValue = 1
 		end if
 	else
 		If LeftFlipperState = True then
 			LeftFlipperReel.SetValue(8)
 			LeftFlipperReel.AddValue(6)
 			LeftFlipperReel.UserValue = 14
 		else
 			LeftFlipperReel.SetValue(14)
 			LeftFlipperReel.AddValue(-6)
 			LeftFlipperReel.UserValue = 8
 		end if
 	end if
End Sub

Dim RightFlipperState
Sub UpdateRightFlipper
 	If XenonYellowOLiteState = 0 then
 		If RightFlipperState = True then
 			RightFlipperReel.SetValue(1)
 			RightFlipperReel.AddValue(6)
 			RightFlipperReel.UserValue = 7
 		else
 			RightFlipperReel.SetValue(7)
 			RightFlipperReel.AddValue(-6)
 			RightFlipperReel.UserValue = 1
 		end if
 	else
 		If RightFlipperState = True then
 			RightFlipperReel.SetValue(8)
 			RightFlipperReel.AddValue(6)
 			RightFlipperReel.UserValue = 14
 		else
 			RightFlipperReel.SetValue(14)
 			RightFlipperReel.AddValue(-6)
 			RightFlipperReel.UserValue = 8
 		end if
 	end if
End Sub

Dim ShooterBall,BallPresent
Sub ShooterLane_Hit()
	If  BallPresent = True then
 	set myBall = ActiveBall
	If BAllInPlay < (DigStorage(31)-1) then
		PlayerActive = 1
	else
		If SATiltLightReel.UserValue <> 2 then
			If BallTwoActive = 0 then
				PlayerActive = PlayerActive + 1
			end if
		end if
	End If
		
	If PlayerActive = 1 then 
		DisplayPlayer1
	End If

	If PlayerActive = 2 then
		DisplayPlayer2		
	End If
	
	If PlayerActive = 3 then
		DisplayPlayer3
	End If
	
	If PlayerActive = 4 then
		DisplayPlayer4		
	End If
	End If
End Sub

DIm BallInPlay
'SHOOTERLANE SW UNHIT
Sub ShooterLane_UnHit()
	BallOut = 0
	BallPresent = False
	BAllInPlay = (DigStorage(31)-1)
	BallTwoActive = 0
End Sub

'***********************************************************************************
'****				Light Handlers					****
'***********************************************************************************
Dim TheLites(200)

Set TheLites(1)=	DummyLiteReel			'
Set TheLites(2)=	XenonBlueXLiteReel		'XenonBlueXLite
Set TheLites(3)=	XenonBlueNTwoLiteReel		'XenonBlueNTwoLite
Set TheLites(4)=	DummyLiteReel			'XenonYellowOLite
Set TheLites(5)=	DummyLiteReel			'DropTarget4Lite
Set TheLites(6)=	LeftOutlaneLightReel		'LeftOutlaneLightReel
Set TheLites(7)=	Mota5LiteReel			'mota5lite
Set TheLites(8)=	Mota25LiteReel			'mota25lite
Set TheLites(9)=	Mota50LiteReel			'mota50lite
Set TheLites(10)=	DummyLiteReel			'TubeLights 9 and 10
Set TheLites(11)=	DummyLiteReel			'Shoot Again
Set TheLites(12)=	CenterX1LiteReel		'CenterX1Lite
Set TheLites(13)=	DummyLiteReel			'BallInPlay
Set TheLites(14)=	DummyLiteReel			'TubeLights 2 and 1
Set TheLites(15)=	Target2XLiteReel		'Target2XLite
Set TheLites(16)=	DummyLiteReel			'
Set TheLites(17)=	TargetSpecialLiteReel		'DropTargetSpecialLite
Set TheLites(18)=	XenonBlueEOneLiteReel		'XenonBlueEOneLite
Set TheLites(19)=	XenonYellowXLiteReel		'XenonYellowXLite
Set TheLites(20)=	XenonYellowNTwoLiteReel		'XenonYellowNTwoLite
Set TheLites(21)=	DummyLiteReel			'Top3LightReel
Set TheLites(22)=	LeftInlaneLightReel		'LeftInlaneLightReel
Set TheLites(23)=	Mota10LiteReel			'mota10lite
Set TheLites(24)=	Mota30LiteReel			'mota30lite
Set TheLites(25)=	TopArrowReel			'TopArrowReel
Set TheLites(26)=	RampCaptureLiteReel		'RampCaptureLiteReel
Set TheLites(27)=	DummyLiteReel			'
Set TheLites(28)=	CenterX2LiteReel		'CenterX2Lite
Set TheLites(29)=	DummyLiteReel			'HighScoreReel
Set TheLites(30)=	DummyLiteReel			'TubeLights 4 and 3
Set TheLites(31)=	Target4XLiteReel		'Target4XLite
Set TheLites(32)=	DummyLiteReel			'
Set TheLites(33)=	Xenon2XLiteReel			'Xenon2XLite
Set TheLites(34)=	XenonBlueNOneLiteReel		'XenonBlueNOneLite
Set TheLites(35)=	DummyLiteReel			'XenonYellowELite
Set TheLites(36)=	Xenon20KliteReel		'Xenon20Klite
Set TheLites(37)=	DummyLiteReel			'Top2LightReel
Set TheLites(38)=	RightInlaneLightReel		'RightInlaneLightReel
Set TheLites(39)=	Mota15LiteReel			'mota15lite
Set TheLites(40)=	Mota35LiteReel			'mota35lite
Set TheLites(41)=	TargetArrowLiteReel		'TargetArrowLite
Set TheLites(42)=	MotaSpecialLiteReel		'MotaSpecialLite
Set TheLites(43)=	XenonShootAgainLiteReel		'XenonShootAgainLite
Set TheLites(44)=	CenterX3LiteReel		'CenterX3Lite
Set TheLites(45)=	DummyLiteReel			'GameOverLite
Set TheLites(46)=	DummyLiteReel			'TubeLights 6 and 5
Set TheLites(47)=	Target25KLiteReel		'Target25KLite
Set TheLites(48)=	DummyLiteReel			'
Set TheLites(49)=	Xenon4XLiteReel			'Xenon4XLite
Set TheLites(50)=	XenonBlueOLiteReel		'XenonBlueOLite
Set TheLites(51)=	XenonYellowNOneLiteReel		'XenonYellowNOneLite
Set TheLites(52)=	Xenon40KLiteReel		'Xenon40KLite
Set TheLites(53)=	DummyLiteReel			'DropTarget1Lite
Set TheLites(54)=	RightOutlaneLightReel		'RightOutlaneLightReel
Set TheLites(55)=	Mota20LiteReel			'mota20lite
Set TheLites(56)=	Mota40LiteReel			'mota40lite
Set TheLites(57)=	BottomArrowReel			'BottomArrowReel
Set TheLites(58)=	Spinner10kLiteReel		'Spinner10kLiteReel
Set TheLites(59)=	DummyLiteReel			'Credit Light
Set TheLites(60)=	CenterWhenLitLiteReel		'CenterWhenLitLite
Set TheLites(61)=	DummyLiteReel			'Tilt Light
Set TheLites(62)=	DummyLiteReel			'TubeLights 8 and 7
Set TheLites(63)=	TargetExtraBallLiteReel		'TargetExtraBallLite
Set TheLites(64)=	DummyLiteReel			'
Set TheLites(65)=	InfinityLite17Reel		'InfinityLite17Reel
Set TheLites(66)=	InfinityLite14Reel		'InfinityLite14Reel
Set TheLites(67)=	InfinityLite9Reel		'InfinityLite9Reel
Set TheLites(68)=	InfinityLite6Reel		'InfinityLite6Reel
Set TheLites(69)=	DummyLiteReel			'
Set TheLites(70)=	DummyLiteReel			'RingLite5
Set TheLites(71)=	DummyLiteReel			'
Set TheLites(72)=	DummyLiteReel			'
Set TheLites(73)=	DummyLiteReel			'
Set TheLites(74)=	DummyLiteReel			'
Set TheLites(75)=	DummyLiteReel			'
Set TheLites(76)=	DummyLiteReel			'
Set TheLites(77)=	DummyLiteReel			'
Set TheLites(78)=	DummyLiteReel			'
Set TheLites(79)=	DummyLiteReel			'
Set TheLites(80)=	DummyLiteReel			'
Set TheLites(81)=	InfinityLite11Reel		'InfinityLite11Reel
Set TheLites(82)=	InfinityLite15Reel		'InfinityLite15Reel
Set TheLites(83)=	InfinityLite3Reel		'InfinityLite3Reel
Set TheLites(84)=	InfinityLite7Reel		'InfinityLite7Reel
Set TheLites(85)=	DummyLiteReel			'
Set TheLites(86)=	DummyLiteReel			'RingLite6
Set TheLites(87)=	DummyLiteReel			'RingLite4
Set TheLites(88)=	DummyLiteReel			'
Set TheLites(89)=	DummyLiteReel			'
Set TheLites(90)=	DummyLiteReel			'
Set TheLites(91)=	DummyLiteReel			'
Set TheLites(92)=	DummyLiteReel			'
Set TheLites(93)=	DummyLiteReel			'
Set TheLites(94)=	DummyLiteReel			'
Set TheLites(95)=	DummyLiteReel			'
Set TheLites(96)=	DummyLiteReel			'
Set TheLites(97)=	InfinityLite12Reel		'InfinityLite12Reel
Set TheLites(98)=	InfinityLite1Reel		'InfinityLite1Reel
Set TheLites(99)=	DummyLiteReel			'InfinityLite4Reel
Set TheLites(100)=	InfinityLite8Reel		'InfinityLite8Reel
Set TheLites(101)=	DummyLiteReel			'Plunger Light
Set TheLites(102)=	DummyLiteReel			'RingLite7
Set TheLites(103)=	DummyLiteReel			'RingLite2
Set TheLites(104)=	DummyLiteReel			'
Set TheLites(105)=	DummyLiteReel			'
Set TheLites(106)=	DummyLiteReel			'
Set TheLites(107)=	DummyLiteReel			'
Set TheLites(108)=	DummyLiteReel			'
Set TheLites(109)=	DummyLiteReel			'
Set TheLites(110)=	DummyLiteReel			'
Set TheLites(111)=	DummyLiteReel			'
Set TheLites(112)=	DummyLiteReel			'
Set TheLites(113)=	InfinityLite13Reel		'InfinityLite13Reel
Set TheLites(114)=	InfinityLite2Reel		'InfinityLite2Reel
Set TheLites(115)=	DummyLiteReel			'InfinityLite5Reel
Set TheLites(116)=	InfinityLite10Reel		'InfinityLite10Reel
Set TheLites(117)=	DummyLiteReel			'
Set TheLites(118)=	DummyLiteReel			'
Set TheLites(119)=	DummyLiteReel			'RingLite1
Set TheLites(120)=	DummyLiteReel			'
Set TheLites(121)=	DummyLiteReel			'
Set TheLites(122)=	DummyLiteReel			'
Set TheLites(123)=	DummyLiteReel			'
Set TheLites(124)=	DummyLiteReel			'
Set TheLites(125)=	DummyLiteReel			'
Set TheLites(126)=	DummyLiteReel			'
Set TheLites(127)=	DummyLiteReel			'
Set TheLites(128)=	DummyLiteReel			'
Set TheLites(129)=	DummyLiteReel			'
Set TheLites(130)=	DummyLiteReel			'
Set TheLites(131)=	DummyLiteReel			'
Set TheLites(132)=	DummyLiteReel			'
Set TheLites(133)=	DummyLiteReel			'
Set TheLites(134)=	DummyLiteReel			'
Set TheLites(135)=	DummyLiteReel			'
Set TheLites(136)=	DummyLiteReel			'
Set TheLites(137)=	DummyLiteReel			'
Set TheLites(138)=	DummyLiteReel			'
Set TheLites(139)=	DummyLiteReel			'
Set TheLites(140)=	DummyLiteReel			'
Set TheLites(141)=	DummyLiteReel			'
Set TheLites(142)=	DummyLiteReel			'
Set TheLites(143)=	DummyLiteReel			'
Set TheLites(144)=	DummyLiteReel			'
Set TheLites(145)=	DummyLiteReel			'
Set TheLites(146)=	DummyLiteReel			'
Set TheLites(147)=	DummyLiteReel			'
Set TheLites(148)=	DummyLiteReel			'
Set TheLites(149)=	DummyLiteReel			'
Set TheLites(150)=	DummyLiteReel			'
Set TheLites(151)=	DummyLiteReel			'
Set TheLites(152)=	DummyLiteReel			'
Set TheLites(153)=	DummyLiteReel			'
Set TheLites(154)=	DummyLiteReel			'
Set TheLites(155)=	DummyLiteReel			'
Set TheLites(156)=	DummyLiteReel			'
Set TheLites(157)=	DummyLiteReel			'
Set TheLites(158)=	DummyLiteReel			'
Set TheLites(159)=	DummyLiteReel			'
Set TheLites(160)=	DummyLiteReel			'
Set TheLites(161)=	DummyLiteReel			'
Set TheLites(162)=	DummyLiteReel			'
Set TheLites(163)=	DummyLiteReel			'
Set TheLites(164)=	DummyLiteReel			'
Set TheLites(165)=	DummyLiteReel			'
Set TheLites(166)=	DummyLiteReel			'
Set TheLites(167)=	DummyLiteReel			'
Set TheLites(168)=	DummyLiteReel			'
Set TheLites(169)=	DummyLiteReel			'
Set TheLites(170)=	DummyLiteReel			'
Set TheLites(171)=	DummyLiteReel			'
Set TheLites(172)=	DummyLiteReel			'
Set TheLites(173)=	DummyLiteReel			'
Set TheLites(174)=	DummyLiteReel			'
Set TheLites(175)=	DummyLiteReel			'
Set TheLites(176)=	DummyLiteReel			'
Set TheLites(177)=	DummyLiteReel			'
Set TheLites(178)=	DummyLiteReel			'
Set TheLites(179)=	DummyLiteReel			'
Set TheLites(180)=	DummyLiteReel			'
Set TheLites(181)=	DummyLiteReel			'
Set TheLites(182)=	DummyLiteReel			'
Set TheLites(183)=	DummyLiteReel			'
Set TheLites(184)=	DummyLiteReel			'
Set TheLites(185)=	DummyLiteReel			'
Set TheLites(186)=	DummyLiteReel			'
Set TheLites(187)=	DummyLiteReel			'
Set TheLites(188)=	DummyLiteReel			'
Set TheLites(189)=	DummyLiteReel			'
Set TheLites(190)=	DummyLiteReel			'
Set TheLites(191)=	DummyLiteReel			'
Set TheLites(192)=	DummyLiteReel			'
Set TheLites(193)=	DummyLiteReel			'
Set TheLites(194)=	DummyLiteReel			'
Set TheLites(195)=	DummyLiteReel			'
Set TheLites(196)=	DummyLiteReel			'
Set TheLites(197)=	DummyLiteReel			'
Set TheLites(198)=	DummyLiteReel			'
Set TheLites(199)=	DummyLiteReel			'

'UPDATE MULTIPLE LAMPS
Dim changedL
Dim tempL,temp2L
Dim XenonYellowELiteState
Dim XenonYellowOLiteState

Sub UpdateMultipleLamps_Timer()
 dim obj

 	changedL = Controller.ChangedLamps
	
 	If IsEmpty(changedL) Then Exit Sub

 	tempL = UBound(changedL)
 
 	For temp2L = 0 to tempL
 		UpDateALight
 	next
 
End Sub

'UPDATE A LIGHT
Sub UpDateALight
 	If changedL(temp2L,0) = 61 then
 		If changedL(temp2L,1) = 1 then
 			UpdateMultipleLamps.Enabled = False
 			For each obj in AllReels
 				obj.SetValue(0)
 			Next
 		end if
 		exit sub
 	end if
 	If changedL(temp2L,0) > 64 and changedL(temp2L,0) < 69 then
 		UpDateInfinity
 		exit sub
 	end if
 	If changedL(temp2L,0) > 80 and changedL(temp2L,0) < 85 then
 		UpDateInfinity
 		exit sub
 	end if
 	If changedL(temp2L,0) > 96 and changedL(temp2L,0) < 101 then
 		UpDateInfinity
 		exit sub
 	end if
 	If changedL(temp2L,0) > 112 and changedL(temp2L,0) < 117 then
 		UpDateInfinity
 		exit sub
 	end if
 	If changedL(temp2L,1) = 0 then 'light goes off
 		SpecialCaseOff
 	else 'Light goes on
 		SpecialCaseOn
 	End IF
End Sub

Sub UpDateInfinity
	If InfintyEnabled = 0 and GameStarted = 1 then exit sub
 	If changedL(temp2L,1) = 0 then 'light goes off
 		TheLites(changedL(temp2L,0)).SetValue(4)
 		If FadeLightsEnabled = 1 then
 			TheLites(changedL(temp2L,0)).UpDateInterval = LightOffSpeed
 			TheLites(changedL(temp2L,0)).AddValue(-3)
 		Else
 			TheLites(changedL(temp2L,0)).UpDateInterval = 5
 			TheLites(changedL(temp2L,0)).SetValue(1)
 		End If
 		TheLites(changedL(temp2L,0)).UserValue = 1
 		If changedL(temp2L,0) = 98 then '1
 			InfinityLite16Reel.SetValue(4)
 			InfinityLite16Reel.UpDateInterval = LightOffSpeed
 			InfinityLite16Reel.AddValue(-3)
 		end if
 		If changedL(temp2L,0) = 81 then '11
 			InfinityLite18Reel.SetValue(4)
 			InfinityLite18Reel.UpDateInterval = LightOffSpeed
 			InfinityLite18Reel.AddValue(-3)
 		end if
 	else 'Light goes on
 		TheLites(changedL(temp2L,0)).SetValue(1)
 		If FadeLightsEnabled = 1 then
 			TheLites(changedL(temp2L,0)).UpDateInterval = LightOnSpeed
 			TheLites(changedL(temp2L,0)).AddValue(3)
 		Else
 			TheLites(changedL(temp2L,0)).UpDateInterval = 5
 			TheLites(changedL(temp2L,0)).SetValue(4)
 		End If
 		TheLites(changedL(temp2L,0)).UserValue = 4
		If changedL(temp2L,0) = 98 then '1
 			InfinityLite16Reel.SetValue(1)
 			InfinityLite16Reel.UpDateInterval = LightOnSpeed
 			InfinityLite16Reel.AddValue(3)
		end if
 		If changedL(temp2L,0) = 81 then '11
 			InfinityLite18Reel.SetValue(1)
 			InfinityLite18Reel.UpDateInterval = LightOnSpeed
 			InfinityLite18Reel.AddValue(3)
		end if
 	End IF
End Sub

Dim AttractCount
Dim CountLock

Sub SpecialCaseOn()
	dim obj
 	If FadeLightsEnabled = 1 then
 		select case changedL(temp2L,0)
		case 13 GI27Reel.SetValue(2)
			exit sub
		case 27 GI27Reel.SetValue(3)
			exit sub
		case 52
 			XenonXenonLiteReel.SetValue(1)
			Xenon40KLiteReel.SetValue(1)
 			XenonXenonLiteReel.UpDateInterval = LightOffSpeed
			Xenon40KLiteReel.UpDateInterval = LightOffSpeed
			XenonXenonLiteReel.AddValue(3)
			Xenon40KLiteReel.AddValue(3)
 			exit sub
 		case 35
 			XenonYellowELiteState = 1
 			If LeftFlipperReel.UserValue = 1 then
 				LeftFlipperReel.SetValue(8)
 				LeftFlipperReel.UserValue = 8
 			end if
 			If LeftFlipperReel.UserValue = 7 then
 				LeftFlipperReel.SetValue(14)
 				LeftFlipperReel.UserValue = 14
 			end if
 			exit sub
 		case 4
 			XenonYellowOLiteState = 1
 			If RightFlipperReel.UserValue = 1 then
 				RightFlipperReel.SetValue(8)
 				RightFlipperReel.UserValue = 8
 			end if
 			If RightFlipperReel.UserValue = 7 then
 				RightFlipperReel.SetValue(14)
 				RightFlipperReel.UserValue = 14
 			end if
 			exit sub
 		case 119
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing1AReel.UpDateInterval = 5
 			NewRing1BReel.UpDateInterval = 5
 			NewRing1AReel.SetValue(1)
 			NewRing1BReel.SetValue(1)
 			exit sub
 		case 103
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing2Reel.UpDateInterval = 5
 			NewRing2Reel.SetValue(1)
 			exit sub
 		case 118
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing3AReel.UpDateInterval = 5
 			NewRing3BReel.UpDateInterval = 5
 			NewRing3AReel.SetValue(1)
 			NewRing3BReel.SetValue(1)
 			exit sub
 		case 87
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing4Reel.UpDateInterval = 5
 			If Controller.Lamp(115) = False then
 				NewRing4Reel.SetValue(2)
 			else
 				NewRing4Reel.SetValue(3)
 			end if
 			exit sub
 		case 115
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			If Controller.Lamp(87) = False then
 				NewRing4Reel.SetValue(1)
 			else
 				NewRing4Reel.SetValue(3)
 			end if
 			exit sub
 		case 70
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing5AReel.UpDateInterval = 5
 			NewRing5BReel.UpDateInterval = 5
 			NewRing5AReel.SetValue(2)
 			NewRing5BReel.SetValue(1)
 			exit sub
 		case 86
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing6AReel.UpDateInterval = 5
 			NewRing6BReel.UpDateInterval = 5
 			NewRing6AReel.SetValue(1)
 			NewRing6BReel.SetValue(1)
 			exit sub
 		case 102
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing7AReel.UpDateInterval = 5
 			NewRing7BReel.UpDateInterval = 5
 			NewRing7AReel.SetValue(1)
 			If Controller.Lamp(99) = False then
 				NewRing7BReel.SetValue(2)
 			else
 				NewRing7BReel.SetValue(3)
 			end if
 			exit sub
 		case 99
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			If Controller.Lamp(102) = False then
 				NewRing7BReel.SetValue(1)
 			else
 				NewRing7BReel.SetValue(3)
 			end if
 			exit sub
 
 		case 29
			If GameStarted = 0 then
				If CountLock = 0 then
					AttractCount = AttractCount + 1
					If AttractCount > 4 then
						AttractCount = 1
					End If
				End IF
				CountLock = 1
				PlayerUpReel.SetValue(1)
				HighScoreReel.UpDateInterval = 5
				HighScoreReel.SetValue(2)
			End If
 			exit sub
 		case 59
 			CreditLightReel.UpDateInterval = 5
 			CreditLightReel.SetValue(2)
 			exit sub
 		case 11
 			SATiltLightReel.UpDateInterval = 5
 			SATiltLightReel.SetValue(2)
			SATiltLightReel.UserValue = 2
 			exit sub
 		case 61
 			SATiltLightReel.UpDateInterval = 5
 			SATiltLightReel.SetValue(3)
			SATiltLightReel.UserValue = 3
 			exit sub
 		case 101
			BallTwoActive = 1
			TroughLightReel.SetValue(1)
 			If PlungerReel.UserValue < 16 then
 				PlungerReel.SetValue(PlungerReel.UserValue+16)
 				PlungerReel.UserValue = PlungerReel.UserValue + 16
 			else
 				PlungerReel.SetValue(PlungerReel.UserValue)
 			end if
 			exit sub
 		case 14
 			TubeLight1Reel.SetValue(2)
 			TubeLight2Reel.SetValue(2)
 			exit sub
 		case 30
 			TubeLight3Reel.SetValue(2)
 			TubeLight4Reel.SetValue(2)
 			exit sub
 		case 46
 			TubeLight5Reel.SetValue(2)
 			TubeLight6Reel.SetValue(2)
 			exit sub
 		case 62
 			TubeLight8Reel.SetValue(2)
 			exit sub
 		case 10
 			TubeLight9Reel.SetValue(2)
 			TubeLight10Reel.SetValue(2)
 			exit sub
		case 5
			If TargetLightsAReel.UserValue = 1 then
				TargetLightsAReel.SetValue(2)
				TargetLightsBReel.SetValue(2)
				TargetLightsAReel.UserValue = 2
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				TargetLightsAReel.SetValue(4)
				TargetLightsBReel.SetValue(4)
				TargetLightsAReel.UserValue = 4
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				TargetLightsAReel.SetValue(6)
				TargetLightsBReel.SetValue(6)
				TargetLightsAReel.UserValue = 6
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				TargetLightsAReel.SetValue(8)
				TargetLightsBReel.SetValue(8)
				TargetLightsAReel.UserValue = 8
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				TargetLightsAReel.SetValue(10)
				TargetLightsBReel.SetValue(10)
				TargetLightsAReel.UserValue = 10
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				TargetLightsAReel.SetValue(12)
				TargetLightsBReel.SetValue(12)
				TargetLightsAReel.UserValue = 12
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				TargetLightsAReel.SetValue(14)
				TargetLightsBReel.SetValue(14)
				TargetLightsAReel.UserValue = 14
				exit sub
			end if
			If TargetLightsAReel.UserValue > 15 then
				exit sub
			end if
		case 21
			Top3LightReel.SetValue(1)
			Top3LightReel.AddValue(3)
			If TargetLightsAReel.UserValue = 1 then
				TargetLightsAReel.SetValue(3)
				TargetLightsBReel.SetValue(3)
				TargetLightsAReel.UserValue = 3
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				TargetLightsAReel.SetValue(4)
				TargetLightsBReel.SetValue(4)
				TargetLightsAReel.UserValue = 4
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				TargetLightsAReel.SetValue(7)
				TargetLightsBReel.SetValue(7)
				TargetLightsAReel.UserValue = 7
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				TargetLightsAReel.SetValue(8)
				TargetLightsBReel.SetValue(8)
				TargetLightsAReel.UserValue = 8
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				TargetLightsAReel.SetValue(11)
				TargetLightsBReel.SetValue(11)
				TargetLightsAReel.UserValue = 11
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				TargetLightsAReel.SetValue(12)
				TargetLightsBReel.SetValue(12)
				TargetLightsAReel.UserValue = 12
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				TargetLightsAReel.SetValue(15)
				TargetLightsBReel.SetValue(15)
				TargetLightsAReel.UserValue = 15
				exit sub
			end if
			If TargetLightsAReel.UserValue = 14 then
				TargetLightsAReel.SetValue(15)
				TargetLightsBReel.SetValue(15)
				TargetLightsAReel.UserValue = 15
				exit sub
			end if
			If TargetLightsAReel.UserValue > 14 then
				TargetLightsAReel.SetValue(15)
				TargetLightsBReel.SetValue(15)
				TargetLightsAReel.UserValue = 15
				exit sub
			end if
		case 37
			Top2LightReel.SetValue(1)
			Top2LightReel.AddValue(3)
			If TargetLightsAReel.UserValue = 1 then
				TargetLightsAReel.SetValue(5)
				TargetLightsBReel.SetValue(5)
				TargetLightsAReel.UserValue = 5
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				TargetLightsAReel.SetValue(6)
				TargetLightsBReel.SetValue(6)
				TargetLightsAReel.UserValue = 6
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				TargetLightsAReel.SetValue(7)
				TargetLightsBReel.SetValue(7)
				TargetLightsAReel.UserValue = 7
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				TargetLightsAReel.SetValue(8)
				TargetLightsBReel.SetValue(8)
				TargetLightsAReel.UserValue = 8
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				TargetLightsAReel.SetValue(13)
				TargetLightsBReel.SetValue(13)
				TargetLightsAReel.UserValue = 13
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				TargetLightsAReel.SetValue(14)
				TargetLightsBReel.SetValue(14)
				TargetLightsAReel.UserValue = 14
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				TargetLightsAReel.SetValue(15)
				TargetLightsBReel.SetValue(15)
				TargetLightsAReel.UserValue = 15
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				TargetLightsAReel.SetValue(15)
				TargetLightsBReel.SetValue(15)
				TargetLightsAReel.UserValue = 15
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 14 then
				exit sub
			end if
			If TargetLightsAReel.UserValue > 14 then
				exit sub
			end if
		case 53
			Top1LightReel.SetValue(1)
			Top1LightReel.AddValue(3)
			If TargetLightsAReel.UserValue = 1 then
				TargetLightsAReel.SetValue(9)
				TargetLightsBReel.SetValue(9)
				TargetLightsAReel.UserValue = 9
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				TargetLightsAReel.SetValue(10)
				TargetLightsBReel.SetValue(10)
				TargetLightsAReel.UserValue = 10
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				TargetLightsAReel.SetValue(11)
				TargetLightsBReel.SetValue(11)
				TargetLightsAReel.UserValue = 11
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				TargetLightsAReel.SetValue(12)
				TargetLightsBReel.SetValue(12)
				TargetLightsAReel.UserValue = 12
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				TargetLightsAReel.SetValue(13)
				TargetLightsBReel.SetValue(13)
				TargetLightsAReel.UserValue = 13
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				TargetLightsAReel.SetValue(14)
				TargetLightsBReel.SetValue(14)
				TargetLightsAReel.UserValue = 14
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				TargetLightsAReel.SetValue(15)
				TargetLightsBReel.SetValue(15)
				TargetLightsAReel.UserValue = 15
				exit sub
			end if
			If TargetLightsAReel.UserValue > 7 then
				exit sub
			end if
		case 45
			GameStarted = 0
			Wall81.IsDropped = False
			Wall82.IsDropped = False
			DisplayFirstMenu
			DisplayPlayer1
			If TheDips(26) = 1 then
				GI24Reel.SetValue(2)
			Else
				GI24Reel.SetValue(1)
			End If
			exit sub
 		end select
 	else
 		select case changedL(temp2L,0)
		case 13 GI27Reel.SetValue(2)
			exit sub
		case 27 GI27Reel.SetValue(3)
			exit sub
 		case 52
 			XenonXenonLiteReel.UpDateInterval = 5
			Xenon40KLiteReel.UpDateInterval = 5
			XenonXenonLiteReel.SetValue(4)
			Xenon40KLiteReel.SetValue(4)
 			exit sub
 		case 35
 			XenonYellowELiteState = 1
 			If LeftFlipperReel.UserValue = 1 then
 				LeftFlipperReel.SetValue(8)
 				LeftFlipperReel.UserValue = 8
 			end if
 			If LeftFlipperReel.UserValue = 7 then
 				LeftFlipperReel.SetValue(14)
 				LeftFlipperReel.UserValue = 14
 			end if
 			exit sub
 		case 4
 			XenonYellowOLiteState = 1
 			If RightFlipperReel.UserValue = 1 then
 				RightFlipperReel.SetValue(8)
 				RightFlipperReel.UserValue = 8
 			end if
 			If RightFlipperReel.UserValue = 7 then
 				RightFlipperReel.SetValue(14)
 				RightFlipperReel.UserValue = 14
 			end if
 			exit sub
 		case 119
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing1AReel.UpDateInterval = 5
 			NewRing1BReel.UpDateInterval = 5
 			NewRing1AReel.SetValue(1)
 			NewRing1BReel.SetValue(1)
 			exit sub
 		case 103
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing2Reel.UpDateInterval = 5
 			NewRing2Reel.SetValue(1)
 			exit sub
 		case 118
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing3AReel.UpDateInterval = 5
 			NewRing3BReel.UpDateInterval = 5
 			NewRing3AReel.SetValue(1)
 			NewRing3BReel.SetValue(1)
 			exit sub
 		case 87
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing4Reel.UpDateInterval = 5
 			If Controller.Lamp(115) = False then
 				NewRing4Reel.SetValue(2)
 			else
 				NewRing4Reel.SetValue(3)
 			end if
 			exit sub
 		case 115
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			If Controller.Lamp(87) = False then
 				NewRing4Reel.SetValue(1)
 			else
 				NewRing4Reel.SetValue(3)
 			end if
 			exit sub
 		case 70
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing5AReel.UpDateInterval = 5
 			NewRing5BReel.UpDateInterval = 5
 			NewRing5AReel.SetValue(2)
 			NewRing5BReel.SetValue(1)
 			exit sub
 		case 86
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing6AReel.UpDateInterval = 5
 			NewRing6BReel.UpDateInterval = 5
 			NewRing6AReel.SetValue(1)
 			NewRing6BReel.SetValue(1)
 			exit sub
 		case 102
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing7AReel.UpDateInterval = 5
 			NewRing7BReel.UpDateInterval = 5
 			NewRing7AReel.SetValue(1)
 			If Controller.Lamp(99) = False then
 				NewRing7BReel.SetValue(2)
 			else
 				NewRing7BReel.SetValue(3)
 			end if
 			exit sub
 		case 99
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			If Controller.Lamp(102) = False then
 				NewRing7BReel.SetValue(1)
 			else
 				NewRing7BReel.SetValue(3)
 			end if
 			exit sub
 		case 29
 			If GameStarted = 0 then
				If CountLock = 0 then
					AttractCount = AttractCount + 1
					If AttractCount > 4 then
						AttractCount = 1
					End If
				End IF
				CountLock = 1
				PlayerUpReel.SetValue(1)
				HighScoreReel.UpDateInterval = 5
				HighScoreReel.SetValue(2)
			End If
 			exit sub
 		case 59
 			CreditLightReel.UpDateInterval = 5
 			CreditLightReel.SetValue(2)
 			exit sub
 		case 11
 			SATiltLightReel.UpDateInterval = 5
 			SATiltLightReel.SetValue(2)
			SATiltLightReel.UserValue = 2
 			exit sub
 		case 61
 			SATiltLightReel.UpDateInterval = 5
 			SATiltLightReel.SetValue(3)
			SATiltLightReel.UserValue = 3
 			exit sub
 		case 101
			BallTwoActive = 1
			TroughLightReel.SetValue(1)
 			If PlungerReel.UserValue < 16 then
 				PlungerReel.SetValue(PlungerReel.UserValue+16)
 				PlungerReel.UserValue = PlungerReel.UserValue + 16
 			else
 				PlungerReel.SetValue(PlungerReel.UserValue)
 			end if
 			exit sub
 		case 14
 			TubeLight1Reel.SetValue(2)
 			TubeLight2Reel.SetValue(2)
 			exit sub
 		case 30
 			TubeLight3Reel.SetValue(2)
 			TubeLight4Reel.SetValue(2)
 			exit sub
 		case 46
 			TubeLight5Reel.SetValue(2)
 			TubeLight6Reel.SetValue(2)
 			exit sub
 		case 62
 			TubeLight8Reel.SetValue(2)
 			exit sub
 		case 10
 			TubeLight9Reel.SetValue(2)
 			TubeLight10Reel.SetValue(2)
 			exit sub
		case 5
			If TargetLightsAReel.UserValue = 1 then
				TargetLightsAReel.SetValue(2)
				TargetLightsBReel.SetValue(2)
				TargetLightsAReel.UserValue = 2
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				TargetLightsAReel.SetValue(4)
				TargetLightsBReel.SetValue(4)
				TargetLightsAReel.UserValue = 4
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				TargetLightsAReel.SetValue(6)
				TargetLightsBReel.SetValue(6)
				TargetLightsAReel.UserValue = 6
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				TargetLightsAReel.SetValue(8)
				TargetLightsBReel.SetValue(8)
				TargetLightsAReel.UserValue = 8
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				TargetLightsAReel.SetValue(10)
				TargetLightsBReel.SetValue(10)
				TargetLightsAReel.UserValue = 10
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				TargetLightsAReel.SetValue(12)
				TargetLightsBReel.SetValue(12)
				TargetLightsAReel.UserValue = 12
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				TargetLightsAReel.SetValue(14)
				TargetLightsBReel.SetValue(14)
				TargetLightsAReel.UserValue = 14
				exit sub
			end if
			If TargetLightsAReel.UserValue > 15 then
				exit sub
			end if
		case 21
			Top3LightReel.SetValue(4)
			If TargetLightsAReel.UserValue = 1 then
				TargetLightsAReel.SetValue(3)
				TargetLightsBReel.SetValue(3)
				TargetLightsAReel.UserValue = 3
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				TargetLightsAReel.SetValue(4)
				TargetLightsBReel.SetValue(4)
				TargetLightsAReel.UserValue = 4
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				TargetLightsAReel.SetValue(7)
				TargetLightsBReel.SetValue(7)
				TargetLightsAReel.UserValue = 7
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				TargetLightsAReel.SetValue(8)
				TargetLightsBReel.SetValue(8)
				TargetLightsAReel.UserValue = 8
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				TargetLightsAReel.SetValue(11)
				TargetLightsBReel.SetValue(11)
				TargetLightsAReel.UserValue = 11
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				TargetLightsAReel.SetValue(12)
				TargetLightsBReel.SetValue(12)
				TargetLightsAReel.UserValue = 12
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				TargetLightsAReel.SetValue(15)
				TargetLightsBReel.SetValue(15)
				TargetLightsAReel.UserValue = 15
				exit sub
			end if
			If TargetLightsAReel.UserValue = 14 then
				TargetLightsAReel.SetValue(15)
				TargetLightsBReel.SetValue(15)
				TargetLightsAReel.UserValue = 15
				exit sub
			end if
			If TargetLightsAReel.UserValue > 14 then
				TargetLightsAReel.SetValue(15)
				TargetLightsBReel.SetValue(15)
				TargetLightsAReel.UserValue = 15
				exit sub
			end if
		case 37
			Top2LightReel.SetValue(4)
			If TargetLightsAReel.UserValue = 1 then
				TargetLightsAReel.SetValue(5)
				TargetLightsBReel.SetValue(5)
				TargetLightsAReel.UserValue = 5
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				TargetLightsAReel.SetValue(6)
				TargetLightsBReel.SetValue(6)
				TargetLightsAReel.UserValue = 6
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				TargetLightsAReel.SetValue(7)
				TargetLightsBReel.SetValue(7)
				TargetLightsAReel.UserValue = 7
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				TargetLightsAReel.SetValue(8)
				TargetLightsBReel.SetValue(8)
				TargetLightsAReel.UserValue = 8
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				TargetLightsAReel.SetValue(13)
				TargetLightsBReel.SetValue(13)
				TargetLightsAReel.UserValue = 13
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				TargetLightsAReel.SetValue(14)
				TargetLightsBReel.SetValue(14)
				TargetLightsAReel.UserValue = 14
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				TargetLightsAReel.SetValue(15)
				TargetLightsBReel.SetValue(15)
				TargetLightsAReel.UserValue = 15
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				TargetLightsAReel.SetValue(15)
				TargetLightsBReel.SetValue(15)
				TargetLightsAReel.UserValue = 15
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 14 then
				exit sub
			end if
			If TargetLightsAReel.UserValue > 14 then
				exit sub
			end if
		case 53
			Top1LightReel.SetValue(4)
			If TargetLightsAReel.UserValue = 1 then
				TargetLightsAReel.SetValue(9)
				TargetLightsBReel.SetValue(9)
				TargetLightsAReel.UserValue = 9
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				TargetLightsAReel.SetValue(10)
				TargetLightsBReel.SetValue(10)
				TargetLightsAReel.UserValue = 10
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				TargetLightsAReel.SetValue(11)
				TargetLightsBReel.SetValue(11)
				TargetLightsAReel.UserValue = 11
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				TargetLightsAReel.SetValue(12)
				TargetLightsBReel.SetValue(12)
				TargetLightsAReel.UserValue = 12
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				TargetLightsAReel.SetValue(13)
				TargetLightsBReel.SetValue(13)
				TargetLightsAReel.UserValue = 13
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				TargetLightsAReel.SetValue(14)
				TargetLightsBReel.SetValue(14)
				TargetLightsAReel.UserValue = 14
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				TargetLightsAReel.SetValue(15)
				TargetLightsBReel.SetValue(15)
				TargetLightsAReel.UserValue = 15
				exit sub
			end if
			If TargetLightsAReel.UserValue > 7 then
				exit sub
			end if
		case 45
			GameStarted = 0
			Wall81.IsDropped = False
			Wall82.IsDropped = False
			DisplayFirstMenu
			DisplayPlayer1
			If TheDips(26) = 1 then
				GI24Reel.SetValue(2)
			Else
				GI24Reel.SetValue(1)
			End If
			exit sub
 		end select
 	end if
 	TheLites(changedL(temp2L,0)).SetValue(1)
	If FadeLightsEnabled = 1 then
		TheLites(changedL(temp2L,0)).UpDateInterval = LightOnSpeed
		TheLites(changedL(temp2L,0)).AddValue(3)
	Else
		TheLites(changedL(temp2L,0)).UpDateInterval = 5
		TheLites(changedL(temp2L,0)).SetValue(4)
	End If
	TheLites(changedL(temp2L,0)).UserValue = 4
End Sub

Sub SpecialCaseOff()
	dim obj
 	If FadeLightsEnabled = 1 then
 		select case changedL(temp2L,0)
		case 13 GI27Reel.SetValue(1)
			exit sub
		case 27 GI27Reel.SetValue(1)
			exit sub
		case 52
 			XenonXenonLiteReel.SetValue(4)
			Xenon40KLiteReel.SetValue(4)
 			XenonXenonLiteReel.UpDateInterval = LightOffSpeed
			Xenon40KLiteReel.UpDateInterval = LightOffSpeed
			XenonXenonLiteReel.AddValue(-3)
			Xenon40KLiteReel.AddValue(-3)
 			exit sub
 		case 35
 			XenonYellowELiteState = 0
 			If LeftFlipperReel.UserValue = 8 then
 				LeftFlipperReel.SetValue(1)
 				LeftFlipperReel.UserValue = 1
 			end if
 			If LeftFlipperReel.UserValue = 14 then
 				LeftFlipperReel.SetValue(7)
 				LeftFlipperReel.UserValue = 7
 			end if
 			exit sub
 		case 4
 			XenonYellowOLiteState = 0
 			If RightFlipperReel.UserValue = 8 then
 				RightFlipperReel.SetValue(1)
 				RightFlipperReel.UserValue = 1
 			end if
 			If RightFlipperReel.UserValue = 14 then
 				RightFlipperReel.SetValue(7)
 				RightFlipperReel.UserValue = 7
 			end if
 			exit sub
 		case 119
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing1AReel.UpDateInterval = 5
 			NewRing1BReel.UpDateInterval = 5
 			NewRing1AReel.SetValue(0)
 			NewRing1BReel.SetValue(0)
 			exit sub
 		case 103
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing2Reel.UpDateInterval = 5
 			NewRing2Reel.SetValue(0)
 			exit sub
 		case 118
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing3AReel.UpDateInterval = 5
 			NewRing3BReel.UpDateInterval = 5
 			NewRing3AReel.SetValue(0)
 			NewRing3BReel.SetValue(0)
 			exit sub
 		case 87
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing4Reel.UpDateInterval = 5
 			If Controller.Lamp(115) = False then
 				NewRing4Reel.SetValue(0)
 			else
 				NewRing4Reel.SetValue(1)
 			end if
 			exit sub
 		case 115
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			If Controller.Lamp(87) = False then
 				NewRing4Reel.SetValue(0)
 			else
 				NewRing4Reel.SetValue(2)
 			end if
 			exit sub
 		case 70
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing5AReel.UpDateInterval = 5
 			NewRing5BReel.UpDateInterval = 5
 			NewRing5AReel.SetValue(1)
 			NewRing5BReel.SetValue(0)
 			exit sub
 		case 86
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing6AReel.UpDateInterval = 5
 			NewRing6BReel.UpDateInterval = 5
 			NewRing6AReel.SetValue(0)
 			NewRing6BReel.SetValue(0)
 			exit sub
 		case 102
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing7AReel.UpDateInterval = 5
 			NewRing7BReel.UpDateInterval = 5
 			NewRing7AReel.SetValue(0)
 			If Controller.Lamp(99) = False then
 				NewRing7BReel.SetValue(0)
 			else
 				NewRing7BReel.SetValue(1)
 			end if
 			exit sub
 		case 99
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			If Controller.Lamp(102) = False then
 				NewRing7BReel.SetValue(0)
 			else
 				NewRing7BReel.SetValue(2)
 			end if
 			exit sub
 		case 29
 			If GameStarted = 0 then
				CountLock = 0
				If AttractCount = 1 then
					DisplayPlayer1
				End If
				If AttractCount = 2 then
					DisplayPlayer2
				End If
				If AttractCount = 3 then
					DisplayPlayer3
				End If
				If AttractCount = 4 then
					DisplayPlayer4
				End If
				HighScoreReel.UpDateInterval = 5
				HighScoreReel.SetValue(1)
			End If
			exit sub
 		case 59
 			If GameStarted = 0 then
				CountLock = 0
				If AttractCount = 1 then
					DisplayPlayer1
				End If
				If AttractCount = 2 then
					DisplayPlayer2
				End If
				If AttractCount = 3 then
					DisplayPlayer3
				End If
				If AttractCount = 4 then
					DisplayPlayer4
				End If
				HighScoreReel.UpDateInterval = 5
				HighScoreReel.SetValue(1)
			End If
 		case 11
 			SATiltLightReel.UpDateInterval = 5
 			SATiltLightReel.SetValue(1)
			SATiltLightReel.UserValue = 1
 			exit sub
 		case 61
 			SATiltLightReel.UpDateInterval = 5
 			SATiltLightReel.SetValue(1)
			SATiltLightReel.UserValue = 1
 			exit sub
 		case 101
			TroughLightReel.SetValue(0)
 			If PlungerReel.UserValue > 15 then
 				PlungerReel.SetValue(PlungerReel.UserValue-16)
 				PlungerReel.UserValue = PlungerReel.UserValue - 16
 			else
 				PlungerReel.SetValue(PlungerReel.UserValue)
 			end if
 			exit sub
 		case 14
 			TubeLight1Reel.SetValue(1)
 			TubeLight2Reel.SetValue(1)
 			exit sub
 		case 30
 			TubeLight3Reel.SetValue(1)
 			TubeLight4Reel.SetValue(1)
 			exit sub
 		case 46
 			TubeLight5Reel.SetValue(1)
 			TubeLight6Reel.SetValue(1)
 			exit sub
 		case 62
 			TubeLight8Reel.SetValue(1)
 			exit sub
 		case 10
 			TubeLight9Reel.SetValue(1)
 			TubeLight10Reel.SetValue(1)
 			exit sub
		case 5
			If TargetLightsAReel.UserValue = 1 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				TargetLightsAReel.SetValue(1)
				TargetLightsBReel.SetValue(1)
				TargetLightsAReel.UserValue = 1
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				TargetLightsAReel.SetValue(3)
				TargetLightsBReel.SetValue(3)
				TargetLightsAReel.UserValue = 3
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				TargetLightsAReel.SetValue(5)
				TargetLightsBReel.SetValue(5)
				TargetLightsAReel.UserValue = 5
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				TargetLightsAReel.SetValue(7)
				TargetLightsBReel.SetValue(7)
				TargetLightsAReel.UserValue = 7
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				TargetLightsAReel.SetValue(9)
				TargetLightsBReel.SetValue(9)
				TargetLightsAReel.UserValue = 9
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				TargetLightsAReel.SetValue(11)
				TargetLightsBReel.SetValue(11)
				TargetLightsAReel.UserValue = 11
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 14 then
				TargetLightsAReel.SetValue(13)
				TargetLightsBReel.SetValue(13)
				TargetLightsAReel.UserValue = 13
				exit sub
			end if
			If TargetLightsAReel.UserValue > 14 then
				exit sub
			end if
			
		case 21
			Top3LightReel.SetValue(4)
			Top3LightReel.AddValue(-3)
			If TargetLightsAReel.UserValue = 1 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				TargetLightsAReel.SetValue(1)
				TargetLightsBReel.SetValue(1)
				TargetLightsAReel.UserValue = 1
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				TargetLightsAReel.SetValue(2)
				TargetLightsBReel.SetValue(2)
				TargetLightsAReel.UserValue = 2
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				TargetLightsAReel.SetValue(5)
				TargetLightsBReel.SetValue(5)
				TargetLightsAReel.UserValue = 5
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				TargetLightsAReel.SetValue(6)
				TargetLightsBReel.SetValue(6)
				TargetLightsAReel.UserValue = 6
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				TargetLightsAReel.SetValue(9)
				TargetLightsBReel.SetValue(9)
				TargetLightsAReel.UserValue = 9
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				TargetLightsAReel.SetValue(10)
				TargetLightsBReel.SetValue(10)
				TargetLightsAReel.UserValue = 10
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 14 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 15 then
				TargetLightsAReel.SetValue(13)
				TargetLightsBReel.SetValue(13)
				TargetLightsAReel.UserValue = 13
				exit sub
			end if
			If TargetLightsAReel.UserValue > 15 then
				TargetLightsAReel.SetValue(14)
				TargetLightsBReel.SetValue(14)
				TargetLightsAReel.UserValue = 14
				exit sub
			end if
		case 37
			Top2LightReel.SetValue(4)
			Top2LightReel.AddValue(-3)
			If TargetLightsAReel.UserValue = 1 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				TargetLightsAReel.SetValue(1)
				TargetLightsBReel.SetValue(1)
				TargetLightsAReel.UserValue = 1
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				TargetLightsAReel.SetValue(2)
				TargetLightsBReel.SetValue(2)
				TargetLightsAReel.UserValue = 2
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				TargetLightsAReel.SetValue(3)
				TargetLightsBReel.SetValue(3)
				TargetLightsAReel.UserValue = 3
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				TargetLightsAReel.SetValue(4)
				TargetLightsBReel.SetValue(4)
				TargetLightsAReel.UserValue = 4
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				TargetLightsAReel.SetValue(9)
				TargetLightsBReel.SetValue(9)
				TargetLightsAReel.UserValue = 9
				exit sub
			end if
			If TargetLightsAReel.UserValue = 14 then
				TargetLightsAReel.SetValue(10)
				TargetLightsBReel.SetValue(10)
				TargetLightsAReel.UserValue = 10
				exit sub
			end if
			If TargetLightsAReel.UserValue = 15 then
				TargetLightsAReel.SetValue(11)
				TargetLightsBReel.SetValue(11)
				TargetLightsAReel.UserValue = 11
				exit sub
			end if
		case 53
			Top1LightReel.SetValue(4)
			Top1LightReel.AddValue(-3)
			If TargetLightsAReel.UserValue = 1 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				TargetLightsAReel.SetValue(1)
				TargetLightsBReel.SetValue(1)
				TargetLightsAReel.UserValue = 1
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				TargetLightsAReel.SetValue(2)
				TargetLightsBReel.SetValue(2)
				TargetLightsAReel.UserValue = 2
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				TargetLightsAReel.SetValue(3)
				TargetLightsBReel.SetValue(3)
				TargetLightsAReel.UserValue = 3
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				TargetLightsAReel.SetValue(4)
				TargetLightsBReel.SetValue(4)
				TargetLightsAReel.UserValue = 4
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				TargetLightsAReel.SetValue(5)
				TargetLightsBReel.SetValue(5)
				TargetLightsAReel.UserValue = 5
				exit sub
			end if
			If TargetLightsAReel.UserValue = 14 then
				TargetLightsAReel.SetValue(6)
				TargetLightsBReel.SetValue(6)
				TargetLightsAReel.UserValue = 6
				exit sub
			end if
			If TargetLightsAReel.UserValue = 15 then
				TargetLightsAReel.SetValue(7)
				TargetLightsBReel.SetValue(7)
				TargetLightsAReel.UserValue = 7
				exit sub
			end if
		case 45
			If InfintyEnabled = 0 then
				For Each obj in InfinityLights
					obj.SetValue(1)
				Next
			end if
			If Reset = 1 then 
				Reset = 0
				exit sub
			end if
			GameStarted = 1
			Wall81.IsDropped = True
			Wall82.IsDropped = True
			HideMenu
			AttractCount = 1
			PlayerActive = 0
			NumberOfPlayers = 1
			DisplayPlayer1
			exit sub
 		end select
 	else
 		select case changedL(temp2L,0)
		case 13 GI27Reel.SetValue(1)
			exit sub
		case 27 GI27Reel.SetValue(1)
			exit sub
 		case 52
 			XenonXenonLiteReel.UpDateInterval = 5
			Xenon40KLiteReel.UpDateInterval = 5
			XenonXenonLiteReel.SetValue(1)
			Xenon40KLiteReel.SetValue(1)
 			exit sub
 		case 35
 			XenonYellowELiteState = 0
 			If LeftFlipperReel.UserValue = 8 then
 				LeftFlipperReel.SetValue(1)
 				LeftFlipperReel.UserValue = 1
 			end if
 			If LeftFlipperReel.UserValue = 14 then
 				LeftFlipperReel.SetValue(7)
 				LeftFlipperReel.UserValue = 7
 			end if
 			exit sub
 		case 4
 			XenonYellowOLiteState = 0
 			If RightFlipperReel.UserValue = 8 then
 				RightFlipperReel.SetValue(1)
 				RightFlipperReel.UserValue = 1
 			end if
 			If RightFlipperReel.UserValue = 14 then
 				RightFlipperReel.SetValue(7)
 				RightFlipperReel.UserValue = 7
 			end if
 			exit sub
 		case 119
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing1AReel.UpDateInterval = 5
 			NewRing1BReel.UpDateInterval = 5
 			NewRing1AReel.SetValue(0)
 			NewRing1BReel.SetValue(0)
 			exit sub
 		case 103
			If InfintyEnabled = 0  and GameStarted = 1 then exit sub
 			NewRing2Reel.UpDateInterval = 5
 			NewRing2Reel.SetValue(0)
 			exit sub
 		case 118
			If InfintyEnabled = 0   and GameStarted = 1 then exit sub
 			NewRing3AReel.UpDateInterval = 5
 			NewRing3BReel.UpDateInterval = 5
 			NewRing3AReel.SetValue(0)
 			NewRing3BReel.SetValue(0)
 			exit sub
 		case 87
			If InfintyEnabled = 0   and GameStarted = 1 then exit sub
 			NewRing4Reel.UpDateInterval = 5
 			If Controller.Lamp(115) = False then
 				NewRing4Reel.SetValue(0)
 			else
 				NewRing4Reel.SetValue(1)
 			end if
 			exit sub
 		case 115
			If InfintyEnabled = 0   and GameStarted = 1 then exit sub
 			If Controller.Lamp(87) = False then
 				NewRing4Reel.SetValue(0)
 			else
 				NewRing4Reel.SetValue(2)
 			end if
 			exit sub
 		case 70
			If InfintyEnabled = 0   and GameStarted = 1 then exit sub
 			NewRing5AReel.UpDateInterval = 5
 			NewRing5BReel.UpDateInterval = 5
 			NewRing5AReel.SetValue(1)
 			NewRing5BReel.SetValue(0)
 			exit sub
 		case 86
			If InfintyEnabled = 0   and GameStarted = 1 then exit sub
 			NewRing6AReel.UpDateInterval = 5
 			NewRing6BReel.UpDateInterval = 5
 			NewRing6AReel.SetValue(0)
 			NewRing6BReel.SetValue(0)
 			exit sub
 		case 102
			If InfintyEnabled = 0   and GameStarted = 1 then exit sub
 			NewRing7AReel.UpDateInterval = 5
 			NewRing7BReel.UpDateInterval = 5
 			NewRing7AReel.SetValue(0)
 			If Controller.Lamp(99) = False then
 				NewRing7BReel.SetValue(0)
 			else
 				NewRing7BReel.SetValue(1)
 			end if
 			exit sub
 		case 99
			If InfintyEnabled = 0   and GameStarted = 1 then exit sub
 			If Controller.Lamp(102) = False then
 				NewRing7BReel.SetValue(0)
 			else
 				NewRing7BReel.SetValue(2)
 			end if
 			exit sub
 
 		case 29
 			If GameStarted = 0 then
				CountLock = 0
				If AttractCount = 1 then
					DisplayPlayer1
				End If
				If AttractCount = 2 then
					DisplayPlayer2
				End If
				If AttractCount = 3 then
					DisplayPlayer3
				End If
				If AttractCount = 4 then
					DisplayPlayer4
				End If
				HighScoreReel.UpDateInterval = 5
				HighScoreReel.SetValue(1)
			End If
			exit sub
 		case 59
 			CreditLightReel.UpDateInterval = 5
 			CreditLightReel.SetValue(1)
 			exit sub
 		case 11
 			SATiltLightReel.UpDateInterval = 5
 			SATiltLightReel.SetValue(1)
			SATiltLightReel.UserValue = 1
 			exit sub
 		case 61
 			SATiltLightReel.UpDateInterval = 5
 			SATiltLightReel.SetValue(1)
			SATiltLightReel.UserValue = 1
 			exit sub
 		case 101
			TroughLightReel.SetValue(0)
 			If PlungerReel.UserValue > 15 then
 				PlungerReel.SetValue(PlungerReel.UserValue-16)
 				PlungerReel.UserValue = PlungerReel.UserValue - 16
 			else
 				PlungerReel.SetValue(PlungerReel.UserValue)
 			end if
 			exit sub
 		case 14
 			TubeLight1Reel.SetValue(1)
 			TubeLight2Reel.SetValue(1)
 			exit sub
 		case 30
 			TubeLight3Reel.SetValue(1)
 			TubeLight4Reel.SetValue(1)
 			exit sub
 		case 46
 			TubeLight5Reel.SetValue(1)
 			TubeLight6Reel.SetValue(1)
 			exit sub
 		case 62
 			TubeLight8Reel.SetValue(1)
 			exit sub
 		case 10
 			TubeLight9Reel.SetValue(1)
 			TubeLight10Reel.SetValue(1)
 			exit sub
		case 5
			If TargetLightsAReel.UserValue = 1 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				TargetLightsAReel.SetValue(1)
				TargetLightsBReel.SetValue(1)
				TargetLightsAReel.UserValue = 1
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				TargetLightsAReel.SetValue(3)
				TargetLightsBReel.SetValue(3)
				TargetLightsAReel.UserValue = 3
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				TargetLightsAReel.SetValue(5)
				TargetLightsBReel.SetValue(5)
				TargetLightsAReel.UserValue = 5
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				TargetLightsAReel.SetValue(7)
				TargetLightsBReel.SetValue(7)
				TargetLightsAReel.UserValue = 7
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				TargetLightsAReel.SetValue(9)
				TargetLightsBReel.SetValue(9)
				TargetLightsAReel.UserValue = 9
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				TargetLightsAReel.SetValue(11)
				TargetLightsBReel.SetValue(11)
				TargetLightsAReel.UserValue = 11
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 14 then
				TargetLightsAReel.SetValue(13)
				TargetLightsBReel.SetValue(13)
				TargetLightsAReel.UserValue = 13
				exit sub
			end if
			If TargetLightsAReel.UserValue > 14 then
				exit sub
			end if
			
		case 21
			Top3LightReel.SetValue(1)
			If TargetLightsAReel.UserValue = 1 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				TargetLightsAReel.SetValue(1)
				TargetLightsBReel.SetValue(1)
				TargetLightsAReel.UserValue = 1
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				TargetLightsAReel.SetValue(2)
				TargetLightsBReel.SetValue(2)
				TargetLightsAReel.UserValue = 2
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				TargetLightsAReel.SetValue(5)
				TargetLightsBReel.SetValue(5)
				TargetLightsAReel.UserValue = 5
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				TargetLightsAReel.SetValue(6)
				TargetLightsBReel.SetValue(6)
				TargetLightsAReel.UserValue = 6
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				TargetLightsAReel.SetValue(9)
				TargetLightsBReel.SetValue(9)
				TargetLightsAReel.UserValue = 9
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				TargetLightsAReel.SetValue(10)
				TargetLightsBReel.SetValue(10)
				TargetLightsAReel.UserValue = 10
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 14 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 15 then
				TargetLightsAReel.SetValue(13)
				TargetLightsBReel.SetValue(13)
				TargetLightsAReel.UserValue = 13
				exit sub
			end if
			If TargetLightsAReel.UserValue > 15 then
				TargetLightsAReel.SetValue(14)
				TargetLightsBReel.SetValue(14)
				TargetLightsAReel.UserValue = 14
				exit sub
			end if
		case 37
			Top2LightReel.SetValue(1)
			If TargetLightsAReel.UserValue = 1 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				TargetLightsAReel.SetValue(1)
				TargetLightsBReel.SetValue(1)
				TargetLightsAReel.UserValue = 1
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				TargetLightsAReel.SetValue(2)
				TargetLightsBReel.SetValue(2)
				TargetLightsAReel.UserValue = 2
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				TargetLightsAReel.SetValue(3)
				TargetLightsBReel.SetValue(3)
				TargetLightsAReel.UserValue = 3
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				TargetLightsAReel.SetValue(4)
				TargetLightsBReel.SetValue(4)
				TargetLightsAReel.UserValue = 4
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				TargetLightsAReel.SetValue(9)
				TargetLightsBReel.SetValue(9)
				TargetLightsAReel.UserValue = 9
				exit sub
			end if
			If TargetLightsAReel.UserValue = 14 then
				TargetLightsAReel.SetValue(10)
				TargetLightsBReel.SetValue(10)
				TargetLightsAReel.UserValue = 10
				exit sub
			end if
			If TargetLightsAReel.UserValue = 15 then
				TargetLightsAReel.SetValue(11)
				TargetLightsBReel.SetValue(11)
				TargetLightsAReel.UserValue = 11
				exit sub
			end if
		case 53
			Top1LightReel.SetValue(1)
			If TargetLightsAReel.UserValue = 1 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 2 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 3 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 4 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 5 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 6 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 7 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 8 then
				exit sub
			end if
			If TargetLightsAReel.UserValue = 9 then
				TargetLightsAReel.SetValue(1)
				TargetLightsBReel.SetValue(1)
				TargetLightsAReel.UserValue = 1
				exit sub
			end if
			If TargetLightsAReel.UserValue = 10 then
				TargetLightsAReel.SetValue(2)
				TargetLightsBReel.SetValue(2)
				TargetLightsAReel.UserValue = 2
				exit sub
			end if
			If TargetLightsAReel.UserValue = 11 then
				TargetLightsAReel.SetValue(3)
				TargetLightsBReel.SetValue(3)
				TargetLightsAReel.UserValue = 3
				exit sub
			end if
			If TargetLightsAReel.UserValue = 12 then
				TargetLightsAReel.SetValue(4)
				TargetLightsBReel.SetValue(4)
				TargetLightsAReel.UserValue = 4
				exit sub
			end if
			If TargetLightsAReel.UserValue = 13 then
				TargetLightsAReel.SetValue(5)
				TargetLightsBReel.SetValue(5)
				TargetLightsAReel.UserValue = 5
				exit sub
			end if
			If TargetLightsAReel.UserValue = 14 then
				TargetLightsAReel.SetValue(6)
				TargetLightsBReel.SetValue(6)
				TargetLightsAReel.UserValue = 6
				exit sub
			end if
			If TargetLightsAReel.UserValue = 15 then
				TargetLightsAReel.SetValue(7)
				TargetLightsBReel.SetValue(7)
				TargetLightsAReel.UserValue = 7
				exit sub
			end if
		case 45
			If InfintyEnabled = 0 then
				For Each obj in InfinityLights
					obj.SetValue(1)
				Next
			end if
			If Reset = 1 then 
				Reset = 0
				exit sub
			end if
			GameStarted = 1
			Wall81.IsDropped = True
			Wall82.IsDropped = True
			HideMenu
			AttractCount = 1
			PlayerActive = 0
			NumberOfPlayers = 1
			DisplayPlayer1
			exit sub
 		end select
 	end if
 	TheLites(changedL(temp2L,0)).SetValue(4)
	If FadeLightsEnabled = 1 then
		TheLites(changedL(temp2L,0)).UpDateInterval = LightOffSpeed
		TheLites(changedL(temp2L,0)).AddValue(-3)
	Else
		TheLites(changedL(temp2L,0)).UpDateInterval = 5
		TheLites(changedL(temp2L,0)).SetValue(1)
	End If
	TheLites(changedL(temp2L,0)).UserValue = 1
End Sub

'***********************************************************************************
'****				Big Bally Display Code				****
'***********************************************************************************
Dim MyPlayerDigs(32)
Dim AdjustDigs(32)
Dim DigStorage(32)
Dim DisplayPatterns(11)

DisplayPatterns(0)	= 0		'0000000 Blank
DisplayPatterns(1)	= 63		'0111111 zero
DisplayPatterns(2)	= 6		'0000110 one
DisplayPatterns(3)	= 91		'1011011 two
DisplayPatterns(4)	= 79		'1001111 three
DisplayPatterns(5)	= 102		'1100110 four
DisplayPatterns(6)	= 109		'1101101 five
DisplayPatterns(7)	= 125		'1111101 six
DisplayPatterns(8)	= 7		'0000111 seven
DisplayPatterns(9)	= 127		'1111111 eight
DisplayPatterns(10)	= 111		'1101111 nine


Set MyPlayerDigs(0)	= DummyDisplay
Set MyPlayerDigs(1)	= DummyDisplay
Set MyPlayerDigs(2)	= DummyDisplay
Set MyPlayerDigs(3)	= DummyDisplay
Set MyPlayerDigs(4)	= DummyDisplay
Set MyPlayerDigs(5)	= DummyDisplay
Set MyPlayerDigs(6)	= DummyDisplay

Set MyPlayerDigs(7)	= DummyDisplay
Set MyPlayerDigs(8)	= DummyDisplay
Set MyPlayerDigs(9)	= DummyDisplay
Set MyPlayerDigs(10)	= DummyDisplay
Set MyPlayerDigs(11)	= DummyDisplay
Set MyPlayerDigs(12)	= DummyDisplay
Set MyPlayerDigs(13)	= DummyDisplay

Set MyPlayerDigs(14)	= DummyDisplay
Set MyPlayerDigs(15) 	= DummyDisplay
Set MyPlayerDigs(16)	= DummyDisplay
Set MyPlayerDigs(17)	= DummyDisplay
Set MyPlayerDigs(18)	= DummyDisplay
Set MyPlayerDigs(19)	= DummyDisplay
Set MyPlayerDigs(20)	= DummyDisplay

Set MyPlayerDigs(21)	= DummyDisplay
Set MyPlayerDigs(22)	= DummyDisplay
Set MyPlayerDigs(23)	= DummyDisplay
Set MyPlayerDigs(24)	= DummyDisplay
Set MyPlayerDigs(25)	= DummyDisplay
Set MyPlayerDigs(26)	= DummyDisplay
Set MyPlayerDigs(27)	= DummyDisplay

Set MyPlayerDigs(28)	= CDigit2
Set MyPlayerDigs(29)	= CDigit1
Set MyPlayerDigs(30)	= BDigit2
Set MyPlayerDigs(31)	= BDigit1

Sub DisplayTimer_Timer()

	Dim ChgLED,ii,chg,stat,obj,TempCount,temptext,adj

	ChgLED = Controller.ChangedLEDs(&HFF, &HFFFF) 'hex of binary (display 111111, or first 6 digits)

	If Not IsEmpty(ChgLED) Then
		For ii = 0 To UBound(ChgLED)
			chg = chgLED(ii, 1) : stat = chgLED(ii, 2)
			For TempCount = 0 to 10
				If stat = DisplayPatterns(TempCount) then
					MyPlayerDigs(chgLED(ii, 0)).SetValue(TempCount)
					DigStorage(chgLED(ii, 0)) = TempCount
				End If
				If stat = (DisplayPatterns(TempCount) + 128) then
					MyPlayerDigs(chgLED(ii, 0)).SetValue(TempCount+11)
					DigStorage(chgLED(ii, 0)) = TempCount+11
				End If
			Next
		Next
	End IF

	If AdjustMode = 3 then
		CheckRegisterNumber
	End If

End Sub

Dim BallInDrain

Sub CheckNumberOfPlayers
	If DigStorage(13) = 1 then
		NumberOfPlayers = 2
	End If
	If DigStorage(20) = 1 then
		NumberOfPlayers = 3
	End If
	If DigStorage(27) = 1 then
		NumberOfPlayers = 4
	End If
End Sub

Sub DisplayPlayer1
		PlayerUpReel.SetValue(2)
		Set MyPlayerDigs(0) = Digit7
		Set MyPlayerDigs(1) = Digit6
		Set MyPlayerDigs(2) = Digit5
		Set MyPlayerDigs(3) = Digit4
		Set MyPlayerDigs(4) = Digit3
		Set MyPlayerDigs(5) = Digit2
		Set MyPlayerDigs(6) = Digit1
		
		Set MyPlayerDigs(7) = DummyDisplay
		Set MyPlayerDigs(8) = DummyDisplay
		Set MyPlayerDigs(9) = DummyDisplay
		Set MyPlayerDigs(10) = DummyDisplay
		Set MyPlayerDigs(11) = DummyDisplay
		Set MyPlayerDigs(12) = DummyDisplay
		Set MyPlayerDigs(13) = DummyDisplay
		
		Set MyPlayerDigs(14) = DummyDisplay
		Set MyPlayerDigs(15) = DummyDisplay
		Set MyPlayerDigs(16) = DummyDisplay
		Set MyPlayerDigs(17) = DummyDisplay
		Set MyPlayerDigs(18) = DummyDisplay
		Set MyPlayerDigs(19) = DummyDisplay
		Set MyPlayerDigs(20) = DummyDisplay
		
		Set MyPlayerDigs(21) = DummyDisplay
		Set MyPlayerDigs(22) = DummyDisplay
		Set MyPlayerDigs(23) = DummyDisplay
		Set MyPlayerDigs(24) = DummyDisplay
		Set MyPlayerDigs(25) = DummyDisplay
		Set MyPlayerDigs(26) = DummyDisplay
		Set MyPlayerDigs(27) = DummyDisplay
		
		Digit7.SetValue(DigStorage(0))
		Digit6.SetValue(DigStorage(1))
		Digit5.SetValue(DigStorage(2))
		Digit4.SetValue(DigStorage(3))
		Digit3.SetValue(DigStorage(4))
		Digit2.SetValue(DigStorage(5))
		Digit1.SetValue(DigStorage(6))
End Sub

Sub DisplayPlayer2
		PlayerUpReel.SetValue(3)
		Set MyPlayerDigs(0) = DummyDisplay
		Set MyPlayerDigs(1) = DummyDisplay
		Set MyPlayerDigs(2) = DummyDisplay
		Set MyPlayerDigs(3) = DummyDisplay
		Set MyPlayerDigs(4) = DummyDisplay
		Set MyPlayerDigs(5) = DummyDisplay
		Set MyPlayerDigs(6) = DummyDisplay
		
		Set MyPlayerDigs(7) = Digit7
		Set MyPlayerDigs(8) = Digit6
		Set MyPlayerDigs(9) = Digit5
		Set MyPlayerDigs(10) = Digit4
		Set MyPlayerDigs(11) = Digit3
		Set MyPlayerDigs(12) = Digit2
		Set MyPlayerDigs(13) = Digit1
		
		Set MyPlayerDigs(14) = DummyDisplay
		Set MyPlayerDigs(15) = DummyDisplay
		Set MyPlayerDigs(16) = DummyDisplay
		Set MyPlayerDigs(17) = DummyDisplay
		Set MyPlayerDigs(18) = DummyDisplay
		Set MyPlayerDigs(19) = DummyDisplay
		Set MyPlayerDigs(20) = DummyDisplay
		
		Set MyPlayerDigs(21) = DummyDisplay
		Set MyPlayerDigs(22) = DummyDisplay
		Set MyPlayerDigs(23) = DummyDisplay
		Set MyPlayerDigs(24) = DummyDisplay
		Set MyPlayerDigs(25) = DummyDisplay
		Set MyPlayerDigs(26) = DummyDisplay
		Set MyPlayerDigs(27) = DummyDisplay
		
		Digit7.SetValue(DigStorage(7))
		Digit6.SetValue(DigStorage(8))
		Digit5.SetValue(DigStorage(9))
		Digit4.SetValue(DigStorage(10))
		Digit3.SetValue(DigStorage(11))
		Digit2.SetValue(DigStorage(12))
		Digit1.SetValue(DigStorage(13))
End Sub

Sub DisplayPlayer3
		PlayerUpReel.SetValue(4)
		Set MyPlayerDigs(0) = DummyDisplay
		Set MyPlayerDigs(1) = DummyDisplay
		Set MyPlayerDigs(2) = DummyDisplay
		Set MyPlayerDigs(3) = DummyDisplay
		Set MyPlayerDigs(4) = DummyDisplay
		Set MyPlayerDigs(5) = DummyDisplay
		Set MyPlayerDigs(6) = DummyDisplay
		
		Set MyPlayerDigs(7) = DummyDisplay
		Set MyPlayerDigs(8) = DummyDisplay
		Set MyPlayerDigs(9) = DummyDisplay
		Set MyPlayerDigs(10) = DummyDisplay
		Set MyPlayerDigs(11) = DummyDisplay
		Set MyPlayerDigs(12) = DummyDisplay
		Set MyPlayerDigs(13) = DummyDisplay
		
		Set MyPlayerDigs(14) = Digit7
		Set MyPlayerDigs(15) = Digit6
		Set MyPlayerDigs(16) = Digit5
		Set MyPlayerDigs(17) = Digit4
		Set MyPlayerDigs(18) = Digit3
		Set MyPlayerDigs(19) = Digit2
		Set MyPlayerDigs(20) = Digit1
		
		Set MyPlayerDigs(21) = DummyDisplay
		Set MyPlayerDigs(22) = DummyDisplay
		Set MyPlayerDigs(23) = DummyDisplay
		Set MyPlayerDigs(24) = DummyDisplay
		Set MyPlayerDigs(25) = DummyDisplay
		Set MyPlayerDigs(26) = DummyDisplay
		Set MyPlayerDigs(27) = DummyDisplay
		
		Digit7.SetValue(DigStorage(14))
		Digit6.SetValue(DigStorage(15))
		Digit5.SetValue(DigStorage(16))
		Digit4.SetValue(DigStorage(17))
		Digit3.SetValue(DigStorage(18))
		Digit2.SetValue(DigStorage(19))
		Digit1.SetValue(DigStorage(20))
End Sub

Sub DisplayPlayer4
		PlayerUpReel.SetValue(5)
		Set MyPlayerDigs(0) = DummyDisplay
		Set MyPlayerDigs(1) = DummyDisplay
		Set MyPlayerDigs(2) = DummyDisplay
		Set MyPlayerDigs(3) = DummyDisplay
		Set MyPlayerDigs(4) = DummyDisplay
		Set MyPlayerDigs(5) = DummyDisplay
		Set MyPlayerDigs(6) = DummyDisplay
		
		Set MyPlayerDigs(7) = DummyDisplay
		Set MyPlayerDigs(8) = DummyDisplay
		Set MyPlayerDigs(9) = DummyDisplay
		Set MyPlayerDigs(10) = DummyDisplay
		Set MyPlayerDigs(11) = DummyDisplay
		Set MyPlayerDigs(12) = DummyDisplay
		Set MyPlayerDigs(13) = DummyDisplay
		
		Set MyPlayerDigs(14) = DummyDisplay
		Set MyPlayerDigs(15) = DummyDisplay
		Set MyPlayerDigs(16) = DummyDisplay
		Set MyPlayerDigs(17) = DummyDisplay
		Set MyPlayerDigs(18) = DummyDisplay
		Set MyPlayerDigs(19) = DummyDisplay
		Set MyPlayerDigs(20) = DummyDisplay
		
		Set MyPlayerDigs(21) = Digit7
		Set MyPlayerDigs(22) = Digit6
		Set MyPlayerDigs(23) = Digit5
		Set MyPlayerDigs(24) = Digit4
		Set MyPlayerDigs(25) = Digit3
		Set MyPlayerDigs(26) = Digit2
		Set MyPlayerDigs(27) = Digit1
		
		Digit7.SetValue(DigStorage(21))
		Digit6.SetValue(DigStorage(22))
		Digit5.SetValue(DigStorage(23))
		Digit4.SetValue(DigStorage(24))
		Digit3.SetValue(DigStorage(25))
		Digit2.SetValue(DigStorage(26))
		Digit1.SetValue(DigStorage(27))
End Sub


'***********************************************************************************
'****				Switch Handlers					****
'***********************************************************************************
Sub UpperKicker_Hit()
	PlaySound "BallInSaucer"
	Controller.Switch(34) = True
End Sub

Sub SecondBall_Hit()
 	Controller.Switch(2) = True
	
	BallOut = 0
End Sub

Sub LowerKicker_Hit()
	PlaySound "BallInSaucer"
 	Controller.Switch(33) = True
End Sub

Sub Drain_Hit
 	Controller.Switch(8) = True
 	Controller.Switch(28) = True
	BallInDrain = True
	CheckNumberOfPlayers
End Sub

Sub sw1_Hit
	Controller.Switch(20) = True
 	sw1.TimerInterval = 50
 	sw1.TimerEnabled = True
End Sub

Sub sw1_Timer()
 	Controller.Switch(20) = False
 	sw1.TimerEnabled = False
End Sub

Sub sw2_Hit
	Controller.Switch(19) = True
 	sw2.TimerInterval = 50
 	sw2.TimerEnabled = True
End Sub

Sub sw2_Timer()
 	Controller.Switch(19) = False
 	sw2.TimerEnabled = False
End Sub

Sub sw3_Hit
	Controller.Switch(18) = True
 	sw3.TimerInterval = 50
 	sw3.TimerEnabled = True
End Sub

Sub sw3_Timer()
 	Controller.Switch(18) = False
 	sw3.TimerEnabled = False
End Sub

Sub sw4_Hit
	Controller.Switch(17) = True
 	sw4.TimerInterval = 50
 	sw4.TimerEnabled = True
End Sub

Sub sw4_Timer()
 	Controller.Switch(17) = False
 	sw4.TimerEnabled = False
End Sub

Sub LeftSlingshot_Slingshot()
	vpmTimer.PulseSw 36
End Sub

Sub RightSlingshot_Slingshot()
	vpmTimer.PulseSw 35
End Sub

Sub Bumper1_Hit()
	vpmTimer.PulseSw 37
 	If FlashBumpersEnabled = 1 then
 		BotCenterPopperReel.SetValue(2)
 	else
 		BotCenterPopperReel.SetValue(4)
 	end if
 	Bumper1.TimerInterval = 150
 	Bumper1.TimerEnabled = True
	PlaySound "popdown"
End Sub

Sub Bumper1_Timer()
 	BotCenterPopperReel.SetValue(1)
 	StopSound "popdown"
 	PlaySound "popup"
 	Bumper1.TimerEnabled = False
End Sub

Sub Bumper2_Hit()
	vpmTimer.PulseSw 38
 	If FlashBumpersEnabled = 1 then
 		TopCenterPopperReel.SetValue(2)
 	else
 		TopCenterPopperReel.SetValue(4)
 	end if
	Bumper2.TimerInterval = 150
 	Bumper2.TimerEnabled = True
	PlaySound "popdown"
End Sub

Sub Bumper2_Timer()
 	TopCenterPopperReel.SetValue(1)
 	StopSound "popdown"
 	PlaySound "popup"
 	Bumper2.TimerEnabled = False
End Sub

Sub Bumper3_Hit()
	vpmTimer.PulseSw 39
	If FlashBumpersEnabled = 1 then
 		TopRightPopperReel.SetValue(2)
 	else
 		TopRightPopperReel.SetValue(4)
 	end if
	Bumper3.TimerInterval = 150
 	Bumper3.TimerEnabled = True
	PlaySound "popdown"
End Sub

Sub Bumper3_Timer()
	TopRightPopperReel.SetValue(1)
 	StopSound "popdown"
 	PlaySound "popup"
 	Bumper3.TimerEnabled = False
End Sub

Sub Bumper4_Hit()
	vpmTimer.PulseSw 40
	Bumper4.TimerInterval = 150
 	Bumper4.TimerEnabled = True
	PlaySound "popdown"
End Sub

Sub Bumper4_Timer()
 '	BotCenterPopperReel.SetValue(1)
 	StopSound "popdown"
 	PlaySound "popup"
 	Bumper4.TimerEnabled = False
End Sub

Sub sw30ptL_Hit()
	vpmTimer.PulseSw 26	
End Sub

Sub sw30ptR_Hit()
	vpmTimer.PulseSw 26	
End Sub

Sub UpperSideTarget_Hit()
	vpmTimer.PulseSw 3	
	'3
End Sub

Sub LowerSideTarget_Hit()
	vpmTimer.PulseSw 4	
	'4
End Sub


'********************************************************************************************
'**** 						Spinner Code						   ****
'********************************************************************************************
Dim TCount,TSpeed,TRots,T2Speed,BallSpeed
Sub SpinTrig_Hit()
	If Tilted = True then exit sub
	BallSpeed = ActiveBall.VelY
	If BallSpeed > 0 AND BallSpeed < 6 then
		MaxMove = 6
		SpinAnimCount = 2
		FinishSpin.Interval = 80
		FinishSpin.Enabled = True
		exit sub
	end if
	If BallSpeed < 0 then BallSpeed = NOT BallSpeed
	TCount = 1
	TSpeed =Int(BallSpeed/8)'TSpeed = 5
	TRots = Int(BallSpeed/3)'TRots = 10
	T2Speed = 9 * TSpeed
	Timer1.Interval = TSpeed
	Timer2.Interval = T2Speed
	Timer2.Enabled = True
End sub

Sub Timer1_Timer()
	TCount = TCount + 1
	If TCount > 17 then
		TCount = 1
		Timer1.Enabled = False
	end if
	TheSpinnerReel.SetValue(TCount)
End Sub

Sub Timer2_Timer()
	TRots = TRots - 1
	TSpeed = TSpeed + 1
	T2Speed = 9 * TSpeed
	Timer2.Interval = T2Speed
	If TRots < 0 then
		MaxMove = 5
		SpinAnimCount = 1
		FinishSpin.Interval = 80
		FinishSpin.Enabled = True
		Timer2.Enabled = False
	end if
	TCount = 1
	Timer1.Interval = TSpeed
	Timer1.Enabled = True
End Sub

Dim SpinAnimCount,MaxMove
Sub FinishSpin_Timer()
	If SpinAnimCount = 1 then
		TheSpinnerReel.SetValue(1)
		TheSpinnerReel.AddValue(MaxMove)
		SpinAnimCount = SpinAnimCount + 1
		exit sub
	end if
	If SpinAnimCount = 2 then
		TheSpinnerReel.SetValue(MaxMove+2)
		TheSpinnerReel.AddValue(Not MaxMove)
		SpinAnimCount = SpinAnimCount + 1
		exit sub
	end if
	If SpinAnimCount = 3 then
		TheSpinnerReel.SetValue(17)
		TheSpinnerReel.AddValue(Not MaxMove)
		SpinAnimCount = SpinAnimCount + 1
		exit sub
	end if
	If SpinAnimCount = 4 then
		TheSpinnerReel.SetValue(17-(MaxMove+2))
		TheSpinnerReel.AddValue(MaxMove)
		MaxMove = MaxMove - 1
		If MaxMove < 1 then
			TheSpinnerReel.SetValue(1)
			FinishSpin.Enabled = False
		end if
		SpinAnimCount = 1
	end if
End Sub

Sub Spinner_Spin()
	vpmTimer.PulseSw 5
End Sub

Sub swShooterLane_Hit()
	Controller.Switch(25) = True
	TroughSwitchReel.SetValue(1)
 	TroughSwitchReel.AddValue(3)
 	swShooterLane.TimerInterval = 50
 	swShooterLane.TimerEnabled = True
End Sub

Sub swShooterLane_Timer()
 	Controller.Switch(25) = False
	TroughSwitchReel.SetValue(4)
 	TroughSwitchReel.AddValue(-3)
 	swShooterLane.TimerEnabled = False
End Sub

Sub swLIn_Hit()
	Controller.Switch(30) = True
 	LeftInlaneLaneSwitchReel.SetValue(1)
 	LeftInlaneLaneSwitchReel.AddValue(3)
 	swLIn.TimerInterval = 50
 	swLIn.TimerEnabled = True
End Sub

Sub swLIn_UnHit()
 	LeftInlaneLaneSwitchReel.SetValue(4)
 	LeftInlaneLaneSwitchReel.AddValue(-3)
End Sub

Sub swLIn_Timer()
	Controller.Switch(30) = False
 	swLIn.TimerEnabled = False
End Sub

Sub swLOut_Hit()
	Controller.Switch(29) = True
 	LeftOutlaneLaneSwitchReel.SetValue(1)
 	LeftOutlaneLaneSwitchReel.AddValue(3)
 	swLOut.TimerInterval = 50
 	swLOut.TimerEnabled = True
End Sub

Sub swLOut_UnHit()
 	LeftOutlaneLaneSwitchReel.SetValue(4)
 	LeftOutlaneLaneSwitchReel.AddValue(-3)
End Sub

Sub swLOut_Timer()
	Controller.Switch(29) = False
 	swLOut.TimerEnabled = False
End Sub

Sub swRIn_Hit()
	Controller.Switch(31) = True
	RightInlaneSwitchReel.SetValue(1)
 	RightInlaneSwitchReel.AddValue(3)
 	swRIn.TimerInterval = 50
 	swRIn.TimerEnabled = True
End Sub

Sub swRIn_Timer()
	Controller.Switch(31) = False
	RightInlaneSwitchReel.SetValue(4)
 	RightInlaneSwitchReel.AddValue(-3)
 	swRIn.TimerEnabled = False
End Sub

Sub swROut_Hit()
	Controller.Switch(32) = True
	RightOutlaneSwitchReel.SetValue(1)
 	RightOutlaneSwitchReel.AddValue(3)
 	swROut.TimerInterval = 50
 	swROut.TimerEnabled = True
End Sub

Sub swROut_Timer()
	Controller.Switch(32) = False
	RightOutlaneSwitchReel.SetValue(4)
 	RightOutlaneSwitchReel.AddValue(-3)
 	swROut.TimerEnabled = False
End Sub

Sub EOT_Hit()
 	Controller.Switch(1) = True
 	CaptureLaneSwitchReel.SetValue(1)
 	CaptureLaneSwitchReel.AddValue(3)
 	EOT.TimerInterval = 50
 	EOT.TimerEnabled = True
End Sub

Sub EOT_UnHit()
 	CaptureLaneSwitchReel.SetValue(4)
 	CaptureLaneSwitchReel.AddValue(-3)
End Sub

Sub EOT_Timer()
 	Controller.Switch(1) = False
 	EOT.TimerEnabled = False
End Sub

Sub RampSlow_Hit()
	ActiveBall.VelZ = 0
	If ActiveBall.VelY < 0 then
		ActiveBall.VelY = (ActiveBall.VelY/2)
	end if
End Sub

Sub TubeSwitch_Hit()
 	Controller.Switch(27) = True
 	TubeSwitch.TimerInterval = 50
 	TubeSwitch.TimerEnabled = True
End Sub

Sub TubeSwitch_Timer()
 	Controller.Switch(27) = False
 	TubeSwitch.TimerEnabled = False
End Sub

Sub BallChange_Hit()
 	ActiveBall.Image = "Tubeball"
End Sub

Sub BallChange_UnHit()
 	ActiveBall.Image = "Liteball"
End Sub

Sub GateHitTrigger_Hit
	Playsound "wiregatesnd"
 	WireGateReel.UpdateInterval = 20
	WireGateReel.SetValue(1)
	WireGateReel.AddValue(3)
 	GateHitTrigger.TimerInterval = 200
 	GateHitTrigger.TimerEnabled = True
End Sub

Sub GateHitTrigger_Timer()
 	WireGateReel.UpdateInterval = 5
 	WireGateReel.SetValue(4)
	WireGateReel.AddValue(-3)
 	GateHitTrigger.TimerEnabled = False
End Sub

'*******************************************************************************************
'****					Spinner Code					****
'*******************************************************************************************
Dim TestCount,TestSpeed,TestFrame
Sub AnimationTest
 	TestSpeed = 6
 	TestFrame = 1
 	TestCount = 1
 	TheSpinnerReel.TimerInterval = 5
 	TheSpinnerReel.TimerEnabled = True
End Sub

Sub TheSpinnerReel_Timer()
 	TheSpinnerReel.SetValue(TestFrame)
 	TestFrame = Int(TestFrame + TestSpeed)
 	TestCount = TestCount + 1
 	TestSpeed = TestSpeed -1
 	If TestFrame > 17 then TestFrame = 1
 '	TheSpinnerReel.TimerInterval = TestSpeed
 	If TestCount = 500 then TheSpinnerReel.TimerEnabled = False
End Sub

'*******************************************************************************************
'****					Dip Switch Code					****
'*******************************************************************************************
Dim Cursor
Dim TheDips(32)

Sub DipAdjust
	Cursor = 0
	GetDips
	DisplayDips
End Sub

Sub GetDips
	Dim TheNumber
	TheNumber = Controller.Dip(0)
	TheDips(8) = Int(TheNumber/128)
	If TheDips(8) = 1 then TheNumber = TheNumber - 128 end if
	TheDips(7) = Int(TheNumber/64)
	If TheDips(7) = 1 then TheNumber = TheNumber - 64 end if
	TheDips(6) = Int(TheNumber/32)
	If TheDips(6) = 1 then TheNumber = TheNumber - 32 end if
	TheDips(5) = Int(TheNumber/16)
	If TheDips(5) = 1 then TheNumber = TheNumber - 16 end if
	TheDips(4) = Int(TheNumber/8)
	If TheDips(4) = 1 then TheNumber = TheNumber - 8 end if
	TheDips(3) = Int(TheNumber/4)
	If TheDips(3) = 1 then TheNumber = TheNumber - 4 end if
	TheDips(2) = Int(TheNumber/2)
	If TheDips(2) = 1 then TheNumber = TheNumber - 2 end if
	TheDips(1) = Int(TheNumber)

	TheNumber = Controller.Dip(1)
	TheDips(16) = Int(TheNumber/128)
	If TheDips(16) = 1 then TheNumber = TheNumber - 128 end if
	TheDips(15) = Int(TheNumber/64)
	If TheDips(15) = 1 then TheNumber = TheNumber - 64 end if
	TheDips(14) = Int(TheNumber/32)
	If TheDips(14) = 1 then TheNumber = TheNumber - 32 end if
	TheDips(13) = Int(TheNumber/16)
	If TheDips(13) = 1 then TheNumber = TheNumber - 16 end if
	TheDips(12) = Int(TheNumber/8)
	If TheDips(12) = 1 then TheNumber = TheNumber - 8 end if
	TheDips(11) = Int(TheNumber/4)
	If TheDips(11) = 1 then TheNumber = TheNumber - 4 end if
	TheDips(10) = Int(TheNumber/2)
	If TheDips(10) = 1 then TheNumber = TheNumber - 2 end if
	TheDips(9) = Int(TheNumber)

	TheNumber = Controller.Dip(2)
	TheDips(24) = Int(TheNumber/128)
	If TheDips(24) = 1 then TheNumber = TheNumber - 128 end if
	TheDips(23) = Int(TheNumber/64)
	If TheDips(23) = 1 then TheNumber = TheNumber - 64 end if
	TheDips(22) = Int(TheNumber/32)
	If TheDips(22) = 1 then TheNumber = TheNumber - 32 end if
	TheDips(21) = Int(TheNumber/16)
	If TheDips(21) = 1 then TheNumber = TheNumber - 16 end if
	TheDips(20) = Int(TheNumber/8)
	If TheDips(20) = 1 then TheNumber = TheNumber - 8 end if
	TheDips(19) = Int(TheNumber/4)
	If TheDips(19) = 1 then TheNumber = TheNumber - 4 end if
	TheDips(18) = Int(TheNumber/2)
	If TheDips(18) = 1 then TheNumber = TheNumber - 2 end if
	TheDips(17) = Int(TheNumber)

	TheNumber = Controller.Dip(3)
	TheDips(32) = Int(TheNumber/128)
	If TheDips(32) = 1 then TheNumber = TheNumber - 128 end if
	TheDips(31) = Int(TheNumber/64)
	If TheDips(31) = 1 then TheNumber = TheNumber - 64 end if
	TheDips(30) = Int(TheNumber/32)
	If TheDips(30) = 1 then TheNumber = TheNumber - 32 end if
	TheDips(29) = Int(TheNumber/16)
	If TheDips(29) = 1 then TheNumber = TheNumber - 16 end if
	TheDips(28) = Int(TheNumber/8)
	If TheDips(28) = 1 then TheNumber = TheNumber - 8 end if
	TheDips(27) = Int(TheNumber/4)
	If TheDips(27) = 1 then TheNumber = TheNumber - 4 end if
	TheDips(26) = Int(TheNumber/2)
	If TheDips(26) = 1 then TheNumber = TheNumber - 2 end if
	TheDips(25) = Int(TheNumber)

End Sub

Sub DipsToVariables
End Sub

Sub DisplayDips
	Dim obj
	GetDips
 	For obj = 0 to 31
 		MyLeds(obj).SetValue(TheDips(obj+1))
 		MyDips(obj).SetValue(TheDips(obj+1))
 	next
 	For each obj in MyCursors
 		obj.SetValue(0)
 	next
 	For each obj in MyEdges
 		obj.SetValue(0)
 	next
 	
	MyCursors(0).SetValue(1)
	Matrix.SetValue(1)
	Matrix.UserValue = 1

	CheckCursor
End Sub

Sub HideTheDips
	Dim obj
 
 	For each obj in MyLeds
 		obj.SetValue(2)
 	next
 	For each obj in MyDips
 		obj.SetValue(2)
 	next
 	For each obj in MyCursors
 		obj.SetValue(2)
 	next
 	For each obj in MyEdges
 		obj.SetValue(1)
 	next
 	
	Matrix.SetValue(0)
	Matrix.UserValue = 0
End Sub

Sub DecCursor
	MyCursors(Cursor).SetValue(0)
	Cursor = Cursor - 1
	If Cursor < 0 then Cursor = 31 End If
	MyCursors(Cursor).SetValue(1)
	CheckCursor
End Sub

Sub IncCursor
	MyCursors(Cursor).SetValue(0)
	Cursor = Cursor + 1
	If Cursor > 31 then Cursor = 0 End If
	MyCursors(Cursor).SetValue(1)
	CheckCursor
End Sub

Sub SwitchUp
	MyLeds(Cursor).SetValue(1)
	MyDips(Cursor).SetValue(1)
	TheDips(Cursor+1) = 1
	SaveTheDips
End Sub

Sub SwitchDown
	MyLeds(Cursor).SetValue(0)
	MyDips(Cursor).SetValue(0)
	TheDips(Cursor+1) = 0
	SaveTheDips
End Sub

Sub SaveTheDips
	Dim TheNumber

	TheNumber = 0
	If TheDips(1) = 1 then TheNumber = 1 End If
	If TheDips(2) = 1 then TheNumber = TheNumber + 2 End If
	If TheDips(3) = 1 then TheNumber = TheNumber + 4 End If
	If TheDips(4) = 1 then TheNumber = TheNumber + 8 End If
	If TheDips(5) = 1 then TheNumber = TheNumber + 16 End If
	If TheDips(6) = 1 then TheNumber = TheNumber + 32 End If
	If TheDips(7) = 1 then TheNumber = TheNumber + 64 End If
	If TheDips(8) = 1 then TheNumber = TheNumber + 128 End If
	Controller.Dip(0) = TheNumber

	TheNumber = 0
	If TheDips(9) = 1 then TheNumber = 1 End If
	If TheDips(10) = 1 then TheNumber = TheNumber + 2 End If
	If TheDips(11) = 1 then TheNumber = TheNumber + 4 End If
	If TheDips(12) = 1 then TheNumber = TheNumber + 8 End If
	If TheDips(13) = 1 then TheNumber = TheNumber + 16 End If
	If TheDips(14) = 1 then TheNumber = TheNumber + 32 End If
	If TheDips(15) = 1 then TheNumber = TheNumber + 64 End If
	If TheDips(16) = 1 then TheNumber = TheNumber + 128 End If
	Controller.Dip(1) = TheNumber

	TheNumber = 0
	If TheDips(17) = 1 then TheNumber = 1 End If
	If TheDips(18) = 1 then TheNumber = TheNumber + 2 End If
	If TheDips(19) = 1 then TheNumber = TheNumber + 4 End If
	If TheDips(20) = 1 then TheNumber = TheNumber + 8 End If
	If TheDips(21) = 1 then TheNumber = TheNumber + 16 End If
	If TheDips(22) = 1 then TheNumber = TheNumber + 32 End If
	If TheDips(23) = 1 then TheNumber = TheNumber + 64 End If
	If TheDips(24) = 1 then TheNumber = TheNumber + 128 End If
	Controller.Dip(2) = TheNumber

	TheNumber = 0
	If TheDips(25) = 1 then TheNumber = 1 End If
	If TheDips(26) = 1 then TheNumber = TheNumber + 2 End If
	If TheDips(27) = 1 then TheNumber = TheNumber + 4 End If
	If TheDips(28) = 1 then TheNumber = TheNumber + 8 End If
	If TheDips(29) = 1 then TheNumber = TheNumber + 16 End If
	If TheDips(30) = 1 then TheNumber = TheNumber + 32 End If
	If TheDips(31) = 1 then TheNumber = TheNumber + 64 End If
	If TheDips(32) = 1 then TheNumber = TheNumber + 128 End If
	Controller.Dip(3) = TheNumber

End Sub

Sub CheckCursor
	select case Cursor
		case 0
			Matrix.SetValue(1)
 		case 1
			Matrix.SetValue(1)
 		case 2
			Matrix.SetValue(1)
 		case 3
			Matrix.SetValue(1)
 		case 4
			Matrix.SetValue(1)
 		case 5
			Matrix.SetValue(2)
 		case 6
			Matrix.SetValue(16)
 		case 7
			Matrix.SetValue(3)
 		case 8
			Matrix.SetValue(4)
 		case 9
			Matrix.SetValue(4)
 		case 10
			Matrix.SetValue(4)
 		case 11
			Matrix.SetValue(4)
 		case 12
			Matrix.SetValue(4)
 		case 13
			Matrix.SetValue(15)
 		case 14
			Matrix.SetValue(5)
 		case 15
			Matrix.SetValue(5)
 		case 16
			Matrix.SetValue(14)
 		case 17
			Matrix.SetValue(14)
 		case 18
			Matrix.SetValue(14)
 		case 19
			Matrix.SetValue(14)
 		case 20
			Matrix.SetValue(10)
 		case 21
			Matrix.SetValue(11)
 		case 22
			Matrix.SetValue(13)
 		case 23
			Matrix.SetValue(18)
 		case 24
			Matrix.SetValue(7)
 		case 25
			Matrix.SetValue(7)
 		case 26
			Matrix.SetValue(8)
 		case 27
			Matrix.SetValue(9)
 		case 28
			Matrix.SetValue(17)
 		case 29
			Matrix.SetValue(19)
 		case 30
			Matrix.SetValue(6)
 		case 31
			Matrix.SetValue(6)
 	end select
End Sub

Sub HideMenu()
	dim obj
	for each obj in MenuReels
		obj.SetValue(1)
		obj.UserValue = 1
	next
End Sub

Sub DisplayTitleMenu()
	dim obj
	for each obj in MenuReels
		obj.SetValue(3)
		obj.UserValue = 3
	next
	PlaySound "femalewelcometoxenon"
End Sub

Sub DisplayFirstMenu()
	Menu1Reel.SetValue(4)
	Menu2Reel.SetValue(4)
	Menu3Reel.SetValue(4)
	Menu4Reel.SetValue(4)
	Menu5Reel.SetValue(4)
	Menu6Reel.SetValue(4)
	Menu7Reel.SetValue(4)
	Menu8Reel.SetValue(3)
	Menu1Reel.UserValue = 4
	Menu2Reel.UserValue = 4
	Menu3Reel.UserValue = 4
	Menu4Reel.UserValue = 4
	Menu5Reel.UserValue = 4
	Menu6Reel.UserValue = 4
	Menu7Reel.UserValue = 4
	Menu8Reel.UserValue = 3
	PlaySound "malexenon"
End Sub

Sub DisplaySecondMenu()
	Menu1Reel.SetValue(5)
	Menu2Reel.SetValue(5)
	Menu3Reel.SetValue(5)
	Menu4Reel.SetValue(5)
	Menu5Reel.SetValue(5)
	Menu6Reel.SetValue(5)
	Menu7Reel.SetValue(5)
	Menu8Reel.SetValue(3)
	Menu1Reel.UserValue = 5
	Menu2Reel.UserValue = 5
	Menu3Reel.UserValue = 5
	Menu4Reel.UserValue = 5
	Menu5Reel.UserValue = 5
	Menu6Reel.UserValue = 5
	Menu7Reel.UserValue = 5
	Menu8Reel.UserValue = 3
	PlaySound "BallInSaucer"
End Sub

Sub DisplayDipMenu()
	Menu1Reel.SetValue(5)
	Menu2Reel.SetValue(6)
	Menu3Reel.SetValue(6)
	Menu4Reel.SetValue(6)
	Menu5Reel.SetValue(6)
	Menu6Reel.SetValue(5)
	Menu7Reel.SetValue(5)
	Menu8Reel.SetValue(3)
	Menu1Reel.UserValue = 5
	Menu2Reel.UserValue = 6
	Menu3Reel.UserValue = 6
	Menu4Reel.UserValue = 6
	Menu5Reel.UserValue = 6
	Menu6Reel.UserValue = 5
	Menu7Reel.UserValue = 5
	Menu8Reel.UserValue = 3
	PlaySound "BallInSaucer"
End Sub

Sub FadeLitesOff()
	Menu3Reel.SetValue(8)
	Menu3Reel.UserValue = 8
	PlaySound "BallInSaucer"
	Menu3Reel.TimerInterval = 2000
	Menu3Reel.TimerEnabled = True
End Sub

Sub FadeLitesOn()
	Menu3Reel.SetValue(7)
	Menu3Reel.UserValue = 7
	PlaySound "BallInSaucer"
	Menu3Reel.TimerInterval = 2000
	Menu3Reel.TimerEnabled = True
End Sub

Sub Menu3Reel_Timer()
	Menu3Reel.SetValue(5)
	Menu3Reel.UserValue = 5
	Menu3Reel.TimerEnabled = False
End Sub

Sub InfinityLitesOff()
	Menu4Reel.SetValue(8)
	Menu4Reel.UserValue = 8
	PlaySound "BallInSaucer"
	Menu4Reel.TimerInterval = 2000
	Menu4Reel.TimerEnabled = True
End Sub

Sub InfinityLitesOn()
	Menu4Reel.SetValue(7)
	Menu4Reel.UserValue = 7
	PlaySound "BallInSaucer"
	Menu4Reel.TimerInterval = 2000
	Menu4Reel.TimerEnabled = True
End Sub

Sub Menu4Reel_Timer()
	Menu4Reel.SetValue(5)
	Menu4Reel.UserValue = 5
	Menu4Reel.TimerEnabled = False
End Sub

Sub PopFlashOff()
	Menu5Reel.SetValue(8)
	Menu5Reel.UserValue = 8
	PlaySound "BallInSaucer"
	Menu5Reel.TimerInterval = 2000
	Menu5Reel.TimerEnabled = True
End Sub

Sub PopFlashOn()
	Menu5Reel.SetValue(7)
	Menu5Reel.UserValue = 7
	PlaySound "BallInSaucer"
	Menu5Reel.TimerInterval = 2000
	Menu5Reel.TimerEnabled = True
End Sub

Sub Menu5Reel_Timer()
	Menu5Reel.SetValue(5)
	Menu5Reel.UserValue = 5
	Menu5Reel.TimerEnabled = False
End Sub

Sub Trigger1_Hit()
	StopSound "topbounce"
	PlaySound "topbounce"
	BallPresent = False
End Sub

Sub Trigger2_Hit()
	StopSound "ballindrain"
	PlaySound "ballindrain"
End Sub

Sub Trigger3_Hit()
	StopSound "ballindrain"
	PlaySound "ballindrain"
End Sub

Sub Trigger4_Hit()
	StopSound "ballindrain"
	StopSound "drain2"
	PlaySound "drain2"
End Sub

Sub Drop1_Hit()
	PlaySound "droptargethit"
	dt1.IsDropped = True
	Drop1.IsDropped = True
	Controller.Switch(24) = True
End Sub

Sub Drop2_Hit()
	PlaySound "droptargethit"
	dt2.IsDropped = True
	Drop2.IsDropped = True
	Controller.Switch(23) = True
End Sub

Sub Drop3_Hit()
	PlaySound "droptargethit"
	dt3.IsDropped = True
	Drop3.IsDropped = True
	Controller.Switch(22) = True
End Sub

Sub Drop4_Hit()
	PlaySound "droptargethit"
	dt4.IsDropped = True
	Drop4.IsDropped = True
	Controller.Switch(21) = True
End Sub

Sub ResetDrop1(enabled)
	If enabled then
		PlaySound "droptargethit"
		dt1.IsDropped = True
		Drop1.IsDropped = True
		Controller.Switch(24) = True
	end if
End Sub

Sub ResetDrop2(enabled)
	If enabled then
		PlaySound "droptargethit"
		dt2.IsDropped = True
		Drop2.IsDropped = True
		Controller.Switch(23) = True
	end if
End Sub

Sub ResetDrop3(enabled)
	If enabled then
		PlaySound "droptargethit"
		dt3.IsDropped = True
		Drop3.IsDropped = True
		Controller.Switch(22) = True
	end if
End Sub

Sub ResetDrop4(enabled)
	If enabled then
		PlaySound "droptargethit"
		dt4.IsDropped = True
		Drop4.IsDropped = True
		Controller.Switch(21) = True
	end if
End Sub

Sub BankReset(enabled)
	If enabled then
		PlaySound "droptargetreset"
		dt1.IsDropped = False
		Drop1.IsDropped = False
		dt2.IsDropped = False
		Drop2.IsDropped = False
		dt3.IsDropped = False
		Drop3.IsDropped = False
		dt4.IsDropped = False
		Drop4.IsDropped = False
		Controller.Switch(24) = False
		Controller.Switch(23) = False
		Controller.Switch(22) = False
		Controller.Switch(21) = False
	end if
End Sub

Sub SaveInfo()
	SaveValue "Xenon", "FadeLightsEnabled", FadeLightsEnabled
	SaveValue "Xenon", "InfintyEnabled", InfintyEnabled
	SaveValue "Xenon", "FlashBumpersEnabled", FlashBumpersEnabled
End Sub

Sub LoadInfo()
	Dim Value
	Value		= LoadValue ("Xenon", "FadeLightsEnabled")
	If (Value <> "") Then FadeLightsEnabled = CDbl(Value) Else FadeLightsEnabled = 1 End If
	Value		= LoadValue ("Xenon", "InfintyEnabled")
	If (Value <> "") Then InfintyEnabled = CDbl(Value) Else InfintyEnabled = 0 End If
	Value		= LoadValue ("Xenon", "FlashBumpersEnabled")
	If (Value <> "") Then FlashBumpersEnabled = CDbl(Value) Else FlashBumpersEnabled = 0 End If
End Sub


