Jump to content



Photo
- - - - -

Flasher, Timer and Kicker in VPX


  • Please log in to reply
15 replies to this topic

#1 batch

batch

    VPFroggie

  • Members
  • PipPipPipPipPip
  • 2,031 posts
  • Location:Center of France

  • Flag: France

  • Favorite Pinball: Anyone if gaming and appearence are great

Posted 01 September 2018 - 03:22 PM

Sub FlasherFlash1_Timer()
    dim flashx3, matdim
    If not FlasherFlash1.TimerEnabled Then
        FlasherFlash1.TimerEnabled = True
        FlasherFlash1.visible = 1
        FlasherLit1.visible = 1
    End If
    flashx3 = FlashLevel1 * FlashLevel1 * FlashLevel1
    Flasherflash1.opacity = 1000 * flashx3
    FlasherLit1.BlendDisableLighting = 10 * flashx3
    Flasherbase1.BlendDisableLighting =  flashx3
    FlasherLight1.IntensityScale = flashx3
    matdim = Round(10 * FlashLevel1)
    FlasherLit1.material = "domelit" & matdim
    FlashLevel1 = FlashLevel1 * 0.85 - 0.01
    If FlashLevel1 < 0.15 Then
        FlasherLit1.visible = 0
    Else
        FlasherLit1.visible = 1
    end If
    If FlashLevel1 < 0 Then
        FlasherFlash1.TimerEnabled = False
        FlasherFlash1.visible = 0
    End If
End Sub

 

I have a flasher (FlasherFlash1), a Light (FlasherLight1), and two Primitives (FlasherLit1 & Flasherbase1)

 

I put flasher (FlasherFlash1) and Light (FlasherLight1) in a collection (Flasherlight), and I can show (Sub BallRelease_UnHit) or hide (Sub Drain_Hit) them by adding the following in the script:

 

    dim xxx
        For each xxx in Flasherlight: xxx.state = True (or False) : Next

 

But I can't find any solution to show or hide the two Primitives (FlasherLit1 & Flasherbase1), and they are blinking all the time, because, I think, they are linked to the Timer which is enabled

 

Is there a way to show or hide these two primitives, or perhaps to enable or disable the Timer, in the script

 

 

 

 


 signature_14012021.jpg         DIRECT LINK TO MY TABLES http://www.vpforums....loads&mid=30858    

                                               LINK TO MY 204 BACKDROPS : Design Resources/ Main Resources/Table Templates/Table Resources/Backdrops for VPX Tables (DT 16/9)  2.0 


#2 Thalamus

Thalamus

    Pinball Wizard

  • Platinum Supporter
  • 4,831 posts

  • Flag: Norway

  • Favorite Pinball: GOT, Alien Star, LOTR, TOM

Posted 01 September 2018 - 05:03 PM

You know what. I have a suggestion for you. Download github scripts repo. Then get a grep utility so you can search for patterns without all the script files. https://sourceforge....ects/astrogrep/ seems to do the job. I'm sure there are several alternatives. The best way to learn is to peek at what has been done before and this is a very effective way to find what you are looking for.

 

TiltRecoveryTimer.Enabled = 0 or 1 to enable a timer.


Edited by Thalamus, 01 September 2018 - 05:04 PM.

From now on. I won't help anyone here at VPF. Please ask Noah why that is.


#3 batch

batch

    VPFroggie

  • Members
  • PipPipPipPipPip
  • 2,031 posts
  • Location:Center of France

  • Flag: France

  • Favorite Pinball: Anyone if gaming and appearence are great

Posted 01 September 2018 - 05:15 PM


TiltRecoveryTimer.Enabled = 0 or 1 to enable a timer.

 

 Thanks for your reply

 

Where do I add that in the script, and do I have to give it the name of the Timer I use ?


 signature_14012021.jpg         DIRECT LINK TO MY TABLES http://www.vpforums....loads&mid=30858    

                                               LINK TO MY 204 BACKDROPS : Design Resources/ Main Resources/Table Templates/Table Resources/Backdrops for VPX Tables (DT 16/9)  2.0 


#4 Thalamus

Thalamus

    Pinball Wizard

  • Platinum Supporter
  • 4,831 posts

  • Flag: Norway

  • Favorite Pinball: GOT, Alien Star, LOTR, TOM

Posted 01 September 2018 - 05:57 PM

It is just an example on how to start stop the timer which is named TiltRecoveryTimer in this case. It is not related to you script example at all. On the third line in the script you see that it tests if it is enabled and then decided to run a block depending on the result of the test.


From now on. I won't help anyone here at VPF. Please ask Noah why that is.


#5 batch

batch

    VPFroggie

  • Members
  • PipPipPipPipPip
  • 2,031 posts
  • Location:Center of France

  • Flag: France

  • Favorite Pinball: Anyone if gaming and appearence are great

Posted 25 March 2019 - 03:12 PM

I'd like to put a flasher on a ramp (with an image) and be able to see it when the light is on and not when the light is off

 

flasher.jpg

 

Here is what I wrote in the script:

 

Sub Flasher21_Timer()
If Light21.State = 1 Then
        FlasherFlash21.TimerEnabled = True
        FlasherLight21.visible = 1
End If
End Sub

Sub Flasher21_Timer()
If Light21.State = 0 Then
        FlasherFlash21.TimerEnabled = False
        FlasherFlash21.visible = 0
End If
End Sub

 

Thanks in advance for your help


Edited by batch, 25 March 2019 - 03:13 PM.

 signature_14012021.jpg         DIRECT LINK TO MY TABLES http://www.vpforums....loads&mid=30858    

                                               LINK TO MY 204 BACKDROPS : Design Resources/ Main Resources/Table Templates/Table Resources/Backdrops for VPX Tables (DT 16/9)  2.0 


#6 kiwi

kiwi

    Pinball Fan

  • VIP
  • 2,520 posts

  • Flag: Italy

  • Favorite Pinball: Star Trek 25th Anniversary



Posted 25 March 2019 - 06:33 PM

You should already have the "LampCallback" function inside the scripts,

look for the UpdateLamps sub-routine, and inside it add this:

Sub UpdateLamps

If Controller.Lamp(21) Then
Flasher21.Visible = 1
Else
Flasher21.Visible = 0
End If
End Sub


#7 batch

batch

    VPFroggie

  • Members
  • PipPipPipPipPip
  • 2,031 posts
  • Location:Center of France

  • Flag: France

  • Favorite Pinball: Anyone if gaming and appearence are great

Posted 25 March 2019 - 07:15 PM

Thanks again and again ...

 

It seems so simple when you explain it ! :tup:


 signature_14012021.jpg         DIRECT LINK TO MY TABLES http://www.vpforums....loads&mid=30858    

                                               LINK TO MY 204 BACKDROPS : Design Resources/ Main Resources/Table Templates/Table Resources/Backdrops for VPX Tables (DT 16/9)  2.0 


#8 batch

batch

    VPFroggie

  • Members
  • PipPipPipPipPip
  • 2,031 posts
  • Location:Center of France

  • Flag: France

  • Favorite Pinball: Anyone if gaming and appearence are great

Posted 26 March 2019 - 02:31 PM

I've the following problem with some flashers:

 

They work fine if they are all linked to the same timer

 

Sub Flashers_Timer
    Randomize
    countr = countr + 1
    If Countr > 6 then Countr = 0 end If
    If rnd(1) < 0.5 Then
        select case countr
            case 0 : FlashLevel1 = 1 : FlasherFlash1_Timer : FlashLevel2 = 1 : FlasherFlash2_Timer
            case 1 : FlashLevel3 = 1 : FlasherFlash3_Timer : FlashLevel4 = 1 : FlasherFlash4_Timer
            case 2 : FlashLevel5 = 1 : FlasherFlash5_Timer : FlashLevel6 = 1 : FlasherFlash6_Timer
            case 3 : FlashLevel11 = 1 : FlasherFlash11_Timer : FlashLevel18 = 1 : FlasherFlash18_Timer
            case 4 : FlashLevel12 = 1 : FlasherFlash12_Timer : FlashLevel17 = 1 : FlasherFlash17_Timer
            case 5 : FlashLevel13 = 1 : FlasherFlash13_Timer : FlashLevel16 = 1 : FlasherFlash16_Timer
            case 6 : FlashLevel14 = 1 : FlasherFlash14_Timer : FlashLevel15 = 1 : FlasherFlash15_Timer
        end Select
    End If
end Sub

 

But they don't work properly if they are linked to two different timers

 

Sub Flashers_Timer
    Randomize
    countr = countr + 1
    If Countr > 2 then Countr = 0 end If
    If rnd(1) < 0.5 Then
        select case countr
            case 0 : FlashLevel1 = 1 : FlasherFlash1_Timer : FlashLevel2 = 1 : FlasherFlash2_Timer
            case 1 : FlashLevel3 = 1 : FlasherFlash3_Timer : FlashLevel4 = 1 : FlasherFlash4_Timer
            case 2 : FlashLevel5 = 1 : FlasherFlash5_Timer : FlashLevel6 = 1 : FlasherFlash6_Timer

        end Select
    End If
end Sub

 

Sub Spotlights_Timer
    Randomize
    countr = countr + 1
    If Countr > 3 then Countr = 0 end If
    If rnd(1) < 0.5 Then
        select case countr
            case 0 : FlashLevel11 = 1 : FlasherFlash11_Timer : FlashLevel18 = 1 : FlasherFlash18_Timer
            case 1 : FlashLevel12 = 1 : FlasherFlash12_Timer : FlashLevel17 = 1 : FlasherFlash17_Timer
            case 2 : FlashLevel13 = 1 : FlasherFlash13_Timer : FlashLevel16 = 1 : FlasherFlash16_Timer
            case 3 : FlashLevel14 = 1 : FlasherFlash14_Timer : FlashLevel15 = 1 : FlasherFlash15_Timer
        end Select
    End If
end Sub

 

In fact, I'd like to have two different Timer Interval values between these two groups of flashers


 signature_14012021.jpg         DIRECT LINK TO MY TABLES http://www.vpforums....loads&mid=30858    

                                               LINK TO MY 204 BACKDROPS : Design Resources/ Main Resources/Table Templates/Table Resources/Backdrops for VPX Tables (DT 16/9)  2.0 


#9 kiwi

kiwi

    Pinball Fan

  • VIP
  • 2,520 posts

  • Flag: Italy

  • Favorite Pinball: Star Trek 25th Anniversary



Posted 26 March 2019 - 03:59 PM

Maybe you forgot to write that you declared the variable?

Dim Countr

Still with regard to the "Countr" variable, perhaps in the second sub routine (Sub Spotlights_Timer) you have to use a different name, CountrS for example.

Dim Countr, CountrS


#10 batch

batch

    VPFroggie

  • Members
  • PipPipPipPipPip
  • 2,031 posts
  • Location:Center of France

  • Flag: France

  • Favorite Pinball: Anyone if gaming and appearence are great

Posted 26 March 2019 - 04:35 PM

You're right, that was it ! :love39:


 signature_14012021.jpg         DIRECT LINK TO MY TABLES http://www.vpforums....loads&mid=30858    

                                               LINK TO MY 204 BACKDROPS : Design Resources/ Main Resources/Table Templates/Table Resources/Backdrops for VPX Tables (DT 16/9)  2.0 


#11 tgx

tgx

    Enthusiast

  • Platinum Supporter
  • 297 posts

  • Flag: United States of America

  • Favorite Pinball: You mean today?

Posted 26 April 2024 - 08:04 PM

I recently tried this sample one:

 

Sub UpdateLamps
  If Controller.Lamp(21) Then
    Flasher21.Visible = 1
Else
    Flasher21.Visible = 0
  End If
End Sub

 

and all it produced was, 'Object doesn't support this property or method 'Controller.Lamp(21)'


Edited by tgx, 26 April 2024 - 08:06 PM.


#12 xenonph

xenonph

    I have Pinball Fever!

  • VIP
  • 3,925 posts
  • Location:Castle Rock, WA.

  • Flag: United States of America

  • Favorite Pinball: TRON Classic-Congo-Xenon-PINBOT-BOP-LOTR-A Real American Hero OPERATION PINBALL-Millionaire-Whirlwind-Krull-NFL-BlackKnight-FishTales

Contributor

Posted 26 April 2024 - 08:20 PM

I recently tried this sample one:

 

Sub UpdateLamps
  If Controller.Lamp(21) Then
    Flasher21.Visible = 1
Else
    Flasher21.Visible = 0
  End If
End Sub

 

and all it produced was, 'Object doesn't support this property or method 'Controller.Lamp(21)'

Have you tried using the state of the light?

 

Sub UpdateLamps
  If l21.state=1 Then
    Flasher21.Visible = 1
Else
    Flasher21.Visible = 0
  End If
End Sub


CHECK OUT THIS TUTORIAL http://www.vpforums....howtopic=32515
TO USE DB2S BACKGLASS PROGRAM WITH DESKTOP TABLES ON 1 MONITOR

 


#13 unclewilly

unclewilly

    sofa king.....

  • VIP
  • 5,084 posts
  • Location:Baltimore, Maryland

  • Flag: United States of America

  • Favorite Pinball: tz, tom, big hurt, who dunnit



Posted 27 April 2024 - 12:55 AM

Is this a rom based table?
Controller is pinmame, is that loaded?
Were lights mapped to pinmame?
Very short snippet of code.

"it will all be ok in the end, if it's not ok, it's not the end"
 
Monster Bash VP10 WIP https://dl.dropboxus... (vpx)WIP15.vpx

uw2.gif


#14 jpsalas

jpsalas

    Grand Schtroumpf

  • VIP
  • 6,448 posts
  • Location:I'm Spanish, but I live in Oslo (Norway)

  • Flag: Norway

  • Favorite Pinball: I like both new and old, but I guess I prefer modern tables with some rules and goals to achieve.



Posted 27 April 2024 - 09:14 AM

Remember that if you use VPX8 you can simply link the flasher to the light, and it will turn on or off at the same time as the light, even using the same fading as the light :)


These are my tables, sorted by date, all them playable with VPX 7 or newer:

vp.jpg

After 18 years making tables, it is time to take a rest and let new authors do their thing.

I guess at last I'll play some more pinball :). But I'm sure I'll make some table updates from time to time :)


#15 Mike DA Spike

Mike DA Spike

    Pinball Fan

  • Platinum Supporter
  • 1,205 posts
  • Location:Hoofddorp

  • Flag: Netherlands

  • Favorite Pinball: Too many to mention

Posted 28 April 2024 - 03:25 AM

Remember that if you use VPX8 you can simply link the flasher to the light, and it will turn on or off at the same time as the light, even using the same fading as the light :)


Stupid question, but how can that be accomplished with vpx8 ?

331ddabcc742f0ba74791e946eb0f791.gif Try PinballX Database manager as a replacement of PinballX's game list manager
With special thanks to Scutters 


#16 xenonph

xenonph

    I have Pinball Fever!

  • VIP
  • 3,925 posts
  • Location:Castle Rock, WA.

  • Flag: United States of America

  • Favorite Pinball: TRON Classic-Congo-Xenon-PINBOT-BOP-LOTR-A Real American Hero OPERATION PINBALL-Millionaire-Whirlwind-Krull-NFL-BlackKnight-FishTales

Contributor

Posted 28 April 2024 - 03:47 AM

 

Remember that if you use VPX8 you can simply link the flasher to the light, and it will turn on or off at the same time as the light, even using the same fading as the light :)


Stupid question, but how can that be accomplished with vpx8 ?

 

Click on Flasher, and you will see Lightmap section to select any light.

 

capture_t.png


CHECK OUT THIS TUTORIAL http://www.vpforums....howtopic=32515
TO USE DB2S BACKGLASS PROGRAM WITH DESKTOP TABLES ON 1 MONITOR