Yeah good. It always screws up beginning coders, but this system is very simple.Most coders make this far more complicated than is needed, mine just uses light state. It takes a snapshot of which lights are on/off/blinking that you define using Set MemorySlot(x) and has 3 subroutines. MemorySave() takes the snapshot (like at the drain before the bonus countdown starts, MemoryLoad() will reload the lights (like at the start of a new ball) and MemoryReset() clears out all lights for each player. In my template, I just have the center targets done, they will remember the light state from the previous ball. Define each light you want to store the memory like this
Set MemorySlot(1)=LightCTarget1
Set MemorySlot(2)=LightCTarget2
Set MemorySlot(3)=LightCTarget3
Set MemorySlot(4)=LightCTarget4
Now all you have to do is add the code for what the lights do depending on their state in the new ball subroutine. (which I never did yet…oops) I’ve been using this for 16 years, once in it’s pretty much foolproof, hasn’t messed up once.
Here’s a copy of the complete code
' *******************************************************
' *** Player Memory by shiva ***
' *******************************************************
' here's where you set the lights you want for Memory feature. You can have up to 99 lights, as it's preset
' in the engine.. Will Handle both LightStateOn and LightStateFlashing as well.
Dim slot 'Purely for Looping purposes (unless you like to type a lot...)
slot=99 'should be the same number as values for KeyMemorySlot and last value in KeyMemory
'variable to set lights to memory, make sure the number matches with the last number in the Set MemorySlot code
Dim MemorySlot(99)
' variable matched to KeyMemorySlot. First value=amount of players, the second should match KeyMemorySlot
Dim Memory(4,99)
' Save Memory states
Sub MemorySave()
dim p
for p = 1 to Slot
On Error Resume Next
Select Case Player
Case 1
if MemorySlot(p).State=0 Then Memory(1,(p)) = 0
if MemorySlot(p).State=1 Then Memory(1,(p)) = 1
if MemorySlot(p).State=2 Then Memory(1,(p)) = 2
Case 2
if MemorySlot(p).State=0 Then Memory(2,(p)) = 0
if MemorySlot(p).State=1 Then Memory(2,(p)) = 1
if MemorySlot(p).State=2 Then Memory(2,(p)) = 2
Case 3
if MemorySlot(p).State=0 Then Memory(3,(p)) = 0
if MemorySlot(p).State=1 Then Memory(3,(p)) = 1
if MemorySlot(p).State=2 Then Memory(3,(p)) = 2
Case 4
if MemorySlot(p).State=0 Then Memory(4,(p)) = 0
if MemorySlot(p).State=1 Then Memory(4,(p)) = 1
if MemorySlot(p).State=2 Then Memory(4,(p)) = 2
End Select
next
end sub
' Load Memory states
sub MemoryLoad()
dim p
for p = 1 to slot
On Error Resume Next
Select Case Player
Case 1
if Memory(1,(p)) = 0 then MemorySlot(p).State=0:end if
if Memory(1,(p)) = 1 then MemorySlot(p).State=1:end if
if Memory(1,(p)) = 2 then MemorySlot(p).State=2:end if
Case 2
if Memory(2,(p)) = 0 then MemorySlot(p).State=0:end if
if Memory(2,(p)) = 1 then MemorySlot(p).State=1:end if
if Memory(2,(p)) = 2 then MemorySlot(p).State=2:end if
Case 3
if Memory(3,(p)) = 0 then MemorySlot(p).State=0:end if
if Memory(3,(p)) = 1 then MemorySlot(p).State=1:end if
if Memory(3,(p)) = 2 then MemorySlot(p).State=2:end if
Case 4
if Memory(4,(p)) = 0 then MemorySlot(p).State=0:end if
if Memory(4,(p)) = 1 then MemorySlot(p).State=1:end if
if Memory(4,(p)) = 2 then MemorySlot(p).State=2:end if
End Select
next
end sub
' Reset Memory States
Sub MemoryReset()
dim p
On Error Resume Next
for p=1 to slot:Memory(1,p)=0:Memory(2,p)=0:Memory(3,p)=0:Memory(4,p)=0:next
End Sub
Set MemorySlot(1)=LightCTarget1
Set MemorySlot(2)=LightCTarget2
Set MemorySlot(3)=LightCTarget3
Set MemorySlot(4)=LightCTarget4
' *** END ***
_____________________________________
Latest projects and rants at My Facebook Page
_____________________________________
Latest Project: fpxEngine Table Builder
_____________________________________
Latest projects and rants at My Facebook Page
_____________________________________
Latest Project: fpxEngine Table Builder
You need to login in order to like this post: click here

