Jump to content



Photo
- - - - -

How to set triggered lights to be permanent until next play in VPX?

Help Triggers VPX

  • Please log in to reply
2 replies to this topic

#1 Imriy

Imriy

    Neophyte

  • Members
  • Pip
  • 2 posts

  • Flag: United States of America

  • Favorite Pinball: Pin-Bot

Posted 23 September 2026 - 05:48 AM

Hello, 
I'm building an original game and am looking for some assistance in the way my triggers and 'lites' work. 
 
The goal: Have a rollover trigger turn on a score light (i.e. light up a letter and give score) and stay on, even if ball rolls over trigger again.

 

Maybe I'm using the wrong kind of trigger for this and i should use a Drop Target, but I'm not sure. 

 

The light starts the game in the off state. 

 

Here's the code. Ptrig and Plite is the trigger and light i'm trying to maintain lit, respectively. 

 

I am very new to coding in visual studio, so i apologize. 

 

edit: i wasn't very thoughrough with my problem. When the ball rolls over 'Ptrig' the light turns on. When it does this again, however, it turns off. I want it to stay on until the next ball is created. Eventually, I would like it to turn off after 3 balls,  but i want to proof this element first.

Sub Ptrig_hit
	AddScore 500
	If Plite.State = 1 Then	
		Plite.State = 0
	Else
		Plite.State = 1
	end If
End Sub

Edited by Imriy, 23 September 2026 - 05:50 AM.


#2 kiwi

kiwi

    Pinball Fan

  • VIP
  • 2,694 posts

  • Flag: Italy

  • Favorite Pinball: Star Trek 25th Anniversary



Posted 23 September 2026 - 06:57 AM

You can set the light to turn on every time the ball passes,

 

Sub Ptrig_hit
	AddScore 500
	Plite.State = 1
End Sub

 

or you can turn the light on only if it isn't already on.

 

Sub Ptrig_hit
	AddScore 500
	If Plite.State = 0 Then	
		Plite.State = 1
	end If
End Sub

 



#3 Imriy

Imriy

    Neophyte

  • Members
  • Pip
  • 2 posts

  • Flag: United States of America

  • Favorite Pinball: Pin-Bot

Posted 23 September 2026 - 08:47 PM

You can set the light to turn on every time the ball passes,

Sub Ptrig_hit
	AddScore 500
	Plite.State = 1
End Sub

or you can turn the light on only if it isn't already on.

Sub Ptrig_hit
	AddScore 500
	If Plite.State = 0 Then	
		Plite.State = 1
	end If
End Sub

The first one worked the way i wanted it to! thank you. how would you make it so it turns off after 3 balls?

 

The code I have right now is:

Sub Drain_Hit()
	PlaySound "drain",0,1,AudioPan(Drain),0.25,0,0,1,AudioFade(Drain)
	Drain.DestroyBall
	BIP = BIP - 1
	If BIP = 0 then
		'Plunger.CreateBall
		BallRelease.CreateBall
		BallRelease.Kick 90, 7
		Plite.State = 0
        End if 
End Sub



this is an abridged code but it works to turn any activated lights off after one ball. I have plans to have a bunch of these lites be a part of a bonus, and whichever ones are lit will add to the score at the end of the game (think like Capt. Fantastic) but that's for later.







Also tagged with one or more of these keywords: Help, Triggers, VPX