Attract Mode Routine

Code:
Rem *** Attract Mode ***
Rem Written by Chris
'To integrate it with your table, you need to do the following:
'- Create a new collection called AllLights and add all lights and bumpers to the collection
'- Add a timer called AttractTimer and set its interval to the value of your choice (I use 50).
'- Change Table1 to the actual name of your table. It appears twice near the beginning of AttractTimer_Timer().
'- Make sure you disable the attract mode by disabling the AttractTimer when the game starts, and enable the AttractTimer again when the game ends.


Dim AttractSequence
Dim AttractStep

Sub AttractTimer_Init()
AttractSequence=0
AttractStep=0
AttractTimer.Enabled=True
End Sub

Sub AttractTimer_Timer()
dim oLight
dim SegWidth
dim SegHeight
dim LightToggle
dim LightCount


SegWidth=Table1.Width/10
SegHeight=Table1.Height/10

Select Case AttractSequence
' by Chris La Mantia
Case 0,2:
' Blink lights
For Each oLight in AllLights
if Int((AttractStep Mod 4)/2)=0 then
oLight.State=LightStateOn
else
oLight.State=LightStateOff
end if
Next
AttractStep=AttractStep+1
if AttractStep>=32 then
AttractSequence=AttractSequence+1
AttractStep=0
end if
Case 1:
' Sequence lights
LightCount=Int((AttractStep mod 6)/2)
For Each oLight in AllLights
if LightCount mod 3=0 then
oLight.State=LightStateOn
else
oLight.State=LightStateOff
end if
LightCount=LightCount+1
next
AttractStep=AttractStep+1
if AttractStep>80 then
AttractSequence=AttractSequence+1
AttractStep=0
end if
Case 3,5:
' Wipe right
For Each oLight in AllLights
if oLight.X>=SegWidth*(AttractStep-1) and oLight.X	oLight.State=LightStateOn
else
oLight.State=LightStateOff
end if
next
AttractStep=AttractStep+1
if AttractStep>9 then
AttractSequence=AttractSequence+1
end if
Case 4,6:
' Wipe right
For Each oLight in AllLights
if oLight.X>=SegWidth*(AttractStep-1) and oLight.X	oLight.State=LightStateOn
else
oLight.State=LightStateOff
end if
next
AttractStep=AttractStep-1
if AttractStep<0 then
AttractSequence=AttractSequence+1
end if
Case 7,9:
' Wipe down
For Each oLight in AllLights
if oLight.Y>=SegHeight*(AttractStep-1) and oLight.Y	oLight.State=LightStateOn
else
oLight.State=LightStateOff
end if
next
AttractStep=AttractStep+1
if AttractStep>9 then
AttractSequence=AttractSequence+1
end if
Case 8,10:
' Wipe up
For Each oLight in AllLights
if oLight.Y>=SegHeight*(AttractStep-1) and oLight.Y	oLight.State=LightStateOn
else
oLight.State=LightStateOff
end if
next
AttractStep=AttractStep-1
if AttractStep<0 then
AttractSequence=AttractSequence+1
end if
Case 11:
For Each oLight in AllLights
if oLight.X+oLight.Y>=SegWidth*(AttractStep-1) and oLight.X+oLight.Y	oLight.State=LightStateOn
else
oLight.State=LightStateOff
end if
next
AttractStep=AttractStep+2
if AttractStep>22 then
AttractSequence=AttractSequence+1
end if
Case 12:
For Each oLight in AllLights
if oLight.X+oLight.Y>=SegWidth*(AttractStep-1) and oLight.X+oLight.Y	oLight.State=LightStateOn
else
oLight.State=LightStateOff
end if
next
AttractStep=AttractStep-2
if AttractStep<=0 then
AttractSequence=AttractSequence+1
end if
Case 13:
For Each oLight in AllLights
if SegWidth*10-oLight.X+oLight.Y>=SegWidth*(AttractStep-1) and SegWidth*10-oLight.X+oLight.Y	oLight.State=LightStateOn
else
oLight.State=LightStateOff
end if
next
AttractStep=AttractStep+2
if AttractStep>22 then
AttractSequence=AttractSequence+1
end if
Case 14:
For Each oLight in AllLights
if SegWidth*10-oLight.X+oLight.Y>=SegWidth*(AttractStep-1) and SegWidth*10-oLight.X+oLight.Y	oLight.State=LightStateOn
else
oLight.State=LightStateOff
end if
next
AttractStep=AttractStep-2
if AttractStep<=0 then
AttractSequence=AttractSequence+1
end if


end select


if AttractSequence>14 then
AttractSequence=0
AttractStep=0
end if
End Sub

Updated Jun 19, 2005 Written by Chris 1370 reads
 
General chit-chat
Help Users
You can interact with the ChatGPT Bot in any Chat Room and there is a dedicated room. The command is /ai followed by a space and then your ? or inquiry.
ie: /ai What is a EM Pinball Machine?
  • No one is chatting at the moment.
      Chat Bot Mibs Chat Bot Mibs: Flipper Hermann has left the room.
      Back
      Top