Hi gtxjoe and everybody!
I changed the FlashForms to be used with the latest changes in the lights in VPX 10.2 rev 2781.
I also changed the routine so it can be used for both lights and flashers using the same syntax and Sub.
For the flashers I didn't use my old fading flash routine. It simply uses the Visible property. So there is no need for extra routines nor timers.
If you prefer the flashers fading then use the one gtxjoe made. But for my needs this is a shorter and easier version of FlashForms 
'********************************************************************************************
' Only for VPX 10.2 and higher.
' FlashForMs will blink light or a flasher for TotalPeriod(ms) at rate of BlinkPeriod(ms)
' When TotalPeriod done, light or flasher will be set to FinalState value where
' Final State values are: 0=Off, 1=On, 2=Return to previous State
'********************************************************************************************
Sub FlashForMs(MyLight, TotalPeriod, BlinkPeriod, FinalState) 'thanks gtxjoe for the first version
If TypeName(MyLight) = "Light" Then
If FinalState = 2 Then
FinalState = MyLight.State 'Keep the current light state
End If
MyLight.State = 2
MyLight.BlinkInterval = BlinkPeriod
MyLight.Duration TotalPeriod, FinalState
ElseIf TypeName(MyLight) = "Flasher" Then
Dim steps
' Store all blink information
steps = Int(TotalPeriod / BlinkPeriod + .5) 'Number of ON/OFF steps to perform
If FinalState = 2 Then 'Keep the current flasher state
FinalState = ABS(MyLight.Visible)
End If
MyLight.UserValue = steps * 10 + FinalState 'Store # of blinks, and final state
' Start blink timer and create timer subroutine
MyLight.TimerInterval = BlinkPeriod
MyLight.TimerEnabled = 1
ExecuteGlobal "Sub " & MyLight.Name & "_Timer:" & "Dim tmp, steps, fstate:tmp=me.UserValue:fstate = tmp MOD 10:steps= tmp\10 -1:Me.Visible = steps MOD 2:me.UserValue = steps *10 + fstate:If Steps = 0 then Me.Visible = fstate:Me.TimerEnabled=0:End if:End Sub"
End If
End Sub
Here it is a table as example. Simple press the LEFT SHIFT to blink the light, and press the RIGHT SHIFT to blink the flasher.
The syntax used are the same for both the light and the flasher:
For the light: FlashForMs Light1, 2000, 50, 0
and for the flasher: FlashForMs Flasher1, 2000, 50, 0
Edit: fixed the 2 errors (one logic error and one math error
)
Edited by jpsalas, 11 September 2016 - 02:28 PM.