Jump to content



Photo
- - - - -

Switching Lights After Hitting Target?


  • Please log in to reply
5 replies to this topic

#1 jrolson

jrolson

    Enthusiast

  • Members
  • PipPipPip
  • 56 posts

  • Flag: United States of America

  • Favorite Pinball: TRON Legacy

Posted 09 January 2012 - 03:32 AM

How do I script a light to turn on after hitting a target, then after hitting the same target it turns off that light and turns on a different one?

Something like this,
CODE
Sub Target1_Hit()
    CheckLights()
End Sub

Sub CheckLights()
    If

    End If
End Sub


#2 petecoomali

petecoomali

    Hobbyist

  • Members
  • PipPip
  • 22 posts

  • Flag: Burma

  • Favorite Pinball: Fish tales

Posted 09 January 2012 - 06:16 AM

sub target_hit
if (light1.state=BulbOff) then
light1.state=BulbOn
light2.state=BulbOff
exit sub
end if
if (light1.state=BulbOn) then
light1.state=BulbOff
light2.state=BulbOn
end if
end sub

This will rotate between two lights.



#3 jrolson

jrolson

    Enthusiast

  • Members
  • PipPipPip
  • 56 posts

  • Flag: United States of America

  • Favorite Pinball: TRON Legacy

Posted 09 January 2012 - 08:56 AM

Problem is I need this to work with 4 targets and 10 lights... and each target needs to switch the light to the next one.

Edited by jrolson, 09 January 2012 - 08:56 AM.


#4 petecoomali

petecoomali

    Hobbyist

  • Members
  • PipPip
  • 22 posts

  • Flag: Burma

  • Favorite Pinball: Fish tales

Posted 09 January 2012 - 03:14 PM

dim lighttempstate

sub target1_hit
rotatelight
end sub

sub target2_hit
rotatelight
end sub

sub target3_hit
rotatelight
end sub

sub target4_hit
rotatelight
end sub

sub rotatelight
lighttempstate=ligh1.state
ligh1.state=ligh2.state
light2.state=light3.state
light3.state=light4.state
.
.
.
light9.state=light10.state
light10.state=lighttempstate
end sub

thankx f666
otvclap.gif

#5 s1500

s1500

    Enthusiast

  • Members
  • PipPipPip
  • 396 posts
  • Location:twin cities

  • Flag: ---------

  • Favorite Pinball: Fun House

Posted 09 January 2012 - 03:46 PM

I would just have an integer variable that keeps track of what light you are at.

#6 jrolson

jrolson

    Enthusiast

  • Members
  • PipPipPip
  • 56 posts

  • Flag: United States of America

  • Favorite Pinball: TRON Legacy

Posted 09 January 2012 - 08:40 PM

QUOTE (petecoomali @ Jan 9 2012, 12:16 AM) <{POST_SNAPBACK}>
sub target_hit
if (light1.state=BulbOff) then
light1.state=BulbOn
light2.state=BulbOff
exit sub
end if
if (light1.state=BulbOn) then
light1.state=BulbOff
light2.state=BulbOn
end if
end sub

This will rotate between two lights.


Thanks got it working! otvclap.gif