As I was mod'ing another FP table today for DOFLinx. I kept having to think through a lot of Flasher.FlashForMs commands as I added a parallel FF_Flasher line for the physical flasher. I was thinking is it worth having a small converter function to make this easier? I could always add it to the next version of the base DOFLinx.vbs if it was thought to be worth while.
Currently the line
flasher1.flashforms 1000, 500, bulboff
has a second line added to run the physical flasher of
FF_Flasher DV_FLOL,FL_FL,2,50,100,"Orchid"
Obviously you need to add the additional information of the physical flasher to use, the colour (which I'm making the same as the one used on the table) plus the percentage brightness. The bit that needs thought is translating the total on time and time per flash to the number of iterations and total time in hundredths as opposed to thousandths.
Perhaps a using a FF_FlasherForMS command could make this easier. The above line would become
FF_FlashForMs 1000,500,bulboff,DV_FLOL,100,"Orchid"
The little bit of code to ensure the number of iterations is calculated to leave the flasher on / off the same as the table is
Sub FF_FlasherForMs(RunTime,FlashTime,EndWith,D,ThePerc,TheColour) Dim NumbIt NumbIt=round(RunTime/FlashTime) ' Calculate an integer for the number of iterations if ((NumbIt/2)-int(NumbIt/2))>0 then ' Check if there is an even number of iterations if (EndWith=bulbon) then ' If its an even number of iterations and you want to leave the bulbon, then add one to make it uneven NumbIt=NumbIt+1 end if else if (EndWith=bulboff) then ' If its an uneven number of iterations and you want to leave the bulb off, then add one to make it uneven NumbIt=NumbIt+1 end if end if FlashTime=round(FlashTime/10) ' Convert the flash time total to 1/100th's FF_Flasher D,FL_FL,NumbIt,FlashTime,ThePerc,TheColour ' Now use the existing DOFLinx function End Sub
Happy to hear if its thought worthwhile to include this in the base vbs from next release. Anyone could use this now by adding it to the table script with a different Sub name (so not to cause a conflict if it is added to the base vbs later).




Top

Contributor









are all trademarks of VPFORUMS.