Visual Pinball > VP Tools
Rosve's Fading Lights System
rosve:
--- Quote from: 'faralos' pid='107' dateline='1351081178' ---
Here is a question, is it possible to have a lamp light up like one in a lighthouse?
I want a flasher bulb to flash brilliance then fade out slowly like a capacitor does with electricity
like a strobe I guess
--- End quote ---
Yes, but it will take a little extra coding to do that.
unclewilly:
If its only a single light. I would just use a timer and a case select statement outside of the fading light script
rosve:
--- Quote from: 'unclewilly' pid='117' dateline='1351085189' ---
If its only a single light. I would just use a timer and a case select statement outside of the fading light script
--- End quote ---
same here, I would only use my system to activate the timer so that the "lighthouse" is controlled the same way as all other lights in the table script.
unclewilly:
Dumb request. I dont have access to my pc for a few days. Could someone copy rosev light script from the demo table into a text editor and upload it. Id like to be able to look at the script on my phone while im at work.
Still trying to get a grasp on it and make sure i can use it in my badcats update.
In this table i have some fading lights that are also dropwalls and id like to have the alpha flashers fade as well
Just havent had time to work with it so id like to take a look at it.
Thanks for the help
rosve:
OK, here is the script from the demo table.
--- Code: ---
Sub Table1_Init()
FLFlash 1, FLMaxLight, 0, 1, 4, 0
End Sub
Sub Table1_KeyDown(ByVal keycode)
FLFlash 1, 1, 10, 1, 32, 0
FLFlash 2, 2, 10, 1, 32, 4
FLFlash 3, 3, 10, 1, 32, 8
FLFlash 4, 4, 10, 1, 32, 12
FLFlash 5, 6, 10, 1, 32, 16
FLFlash 7, 8, 10, 1, 32, 20
FLFlash 9, 10, 10, 1, 32, 24
FLFlash 11, 12, 10, 1, 32, 28
FLFlash 13, 14, 10, 1, 32, 32
'Flasher
FLFlash 15, 15, 2, 0, 1, 14
End Sub
'*********************************************************************************************
'***************** FADING LIGHTS CODE ***************************
'***************** ROSVE ***************************
'*********************************************************************************************
Dim FLData(100,8)
Dim FLMaxLight
FLMaxLight=15
' 1=command --> 0=set off 1=set on 2=flash 99=no change
' 2=state
' 3=repeats 999=continous
' 4=on duration
' 5=off duration
' 6=on dur mem
' 7=off dur mem
' 8=start delay
Sub FLSetOn(ByVal FLlight1, ByVal FLlight2, ByVal FLdelay)
For i=FLlight1 to FLlight2
FLData(i,1)=1
FLData(i,2)=0
FLData(i,3)=0
FLData(i,4)=0
FLData(i,5)=0
FLData(i,8)=FLdelay
Next
End Sub
Sub FLSetOff(ByVal FLlight1, ByVal FLlight2, ByVal FLdelay)
For i=FLlight1 to FLlight2
FLData(i,1)=0
FLData(i,2)=4
FLData(i,3)=0
FLData(i,4)=0
FLData(i,5)=0
FLData(i,8)=FLdelay
Next
End Sub
Sub FLFlash(ByVal FLlight1, ByVal FLlight2, ByVal FLrepeat, ByVal FLondur, ByVal FLoffdur, ByVal FLdelay)
For i=FLlight1 to FLlight2
FLData(i,1)=2
FLData(i,2)=0
FLData(i,3)=FLrepeat
FLData(i,4)=FLondur
FLData(i,5)=FLoffdur
FLData(i,6)=FLondur
FLData(i,7)=FLoffdur
FLData(i,8)=FLdelay
Next
End Sub
Sub FLTimer_Timer()
Dim i
For i=1 To FLMaxLight
If FLData(i,8)>0 Then
FLData(i,8)=FLData(i,8)-1
Else
Select Case FLData(i,1)
Case 0
FLData(i,2)=FLData(i,2)+1
Select Case FLData(i,2)
Case 5
FLflasher i,1
L2(i).State=0
Case 7
FLflasher i,0
L1(i).State=0
FLData(i,1)=99
End Select
Case 1
FLData(i,2)=FLData(i,2)+1
Select Case FLData(i,2)
Case 1
FLflasher i,1
L1(i).State=1
Case 3
FLflasher i,2
L2(i).State=1
FLData(i,1)=99
End Select
Case 2
FLData(i,2)=FLData(i,2)+1
Select Case FLData(i,2)
Case 1
FLflasher i,1
L1(i).State=1
Case 3
FLflasher i,2
L2(i).State=1
Case 4 'on Duration
IF FLData(i,4)>0 Then
FLData(i,4)=FLData(i,4)-1
FLData(i,2)=FLData(i,2)-1
Else
FLData(i,4)=FLData(i,6)
End If
Case 5
FLflasher i,1
L2(i).State=0
Case 7
FLflasher i,0
L1(i).State=0
IF FLData(i,3)>0 Then
IF FLData(i,5)>0 Then
FLData(i,5)=FLData(i,5)-1
FLData(i,2)=FLData(i,2)-1
Else
FLData(i,5)=FLData(i,7)
FLData(i,3)=FLData(i,3)-1
If FLData(i,3)=998 Then FLData(i,3)=999
FLData(i,2)=0
End If
Else
FLData(i,1)=99
End If
End Select
End Select
End If
Next
End Sub
Sub FLflasher(ByVal li,ByVal st)
Dim i
Select Case li '**** LIGHT NUMBER *****
Case 15 'Light 15 is an Alpha Flasher
Select Case st
Case 0'OFF
f32f1.alpha = 0
Case 1'INTERMIDIATE
f32f1.image = "rf_b":f32f1.alpha = 1
Case 2 'ON
f32f1.image = "rf_on"
End Select
f32r1.State=ABS(f32r1.state -1)
End Select
End Sub
'*********************************************************************************************
'*********************************************************************************************
'*********************************************************************************************
--- End code ---
---------------------------------------------------------
To use it with VPM you also need this code snippet to read the lamp states.
--- Code: ---
Dim NewState(200)
Dim OldState(200)
FLTimer.Interval = 21
LampTimer.Interval = 10
LampTimer.Enabled = 1
Sub SetFlasher(nr, value)
NewState(nr) = abs(value)
End Sub
Sub LampTimer_Timer()
Dim chgLamp, num, chg, ii
chgLamp = Controller.ChangedLamps
If Not IsEmpty(chgLamp) Then
For ii = 0 To UBound(chgLamp) ' **UPDATE LAMP STATES ***
If chgLamp(ii, 1)=0 then
FLSetOff chgLamp(ii, 0), chgLamp(ii, 0), 0
else
FLSetOn chgLamp(ii, 0), chgLamp(ii, 0), 0
end if
Next
End If
For ii=81 to 88 ' ******** FLASHER NUMBERS *************
If NewState(ii) OldState(ii) then
OldState(ii)=NewState(ii)
If NewState(ii)=0 then
FLSetOff ii, ii. 0
else
FLSetOn ii, ii, 0
end if
end if
Next
End Sub[/php]
--- End code ---
Solenoid controlled flasher states are read like this,
--- Code: ---
SolCallBack(25)="SetFlasher 81, " 'red x 4
SolCallBack(26)="SetFlasher 82, " 'yellow x 4
SolCallBack(27)="SetFlasher 83, " 'green x 4
SolCallBack(28)="SetFlasher 84, " 'blue x 4
SolCallBack(29)="SolWarrior" 'flash multiball x 4
SolCallBack(30)="SetFlasher 86, " 'left ramp x 4
SolCallBack(31)="SetFlasher 87, " 'right ramp x 4
SolCallBack(32)="SetFlasher 88, " 'pops x 2
--- End code ---
Navigation
[0] Message Index
[*] Previous page
Go to full version