Jump to content



Photo
- - - - -

loop script problem


  • Please log in to reply
3 replies to this topic

#1 loxagon1

loxagon1

    Enthusiast

  • Silver Supporter
  • 51 posts
  • Location:germany

  • Flag: Germany

  • Favorite Pinball: Attack from Mars, Theater of Magic, Terminator 2

Posted 10 October 2011 - 02:11 PM

hi guys,

we work on a new table and plan a loop around the table. you can shoot in from 2 sides,now we have a scripting problem:
i insert 2 opto trigger on playfield, one named north , other south, and 5 lights to lit for every shoot.
but i dont work. the script:

Dim Bb_north(5) ' nordlichter
Dim countnorth ' nordcount
Dim Bb_south(5) ' southlichter
Dim countsouth ' southcount

set Bb_north(1)=north1:set Bb_north(2)=north2:set Bb_north(3)=north3:set Bb_north(4)=north4:set Bb_north(5)=north5
set Bb_south(1)=south1:set Bb_south(2)=south2:set Bb_south(3)=south3:set Bb_south(4)=south4:set Bb_south(5)=south5

Sub Triggersouth_hit()
set lastswitchhit=triggersouth
if lastswitchhit is triggernorth then
Dim i
countnorth=countnorth+1
if countnorth>5 then countnorth=5
Bb_north(countnorth).state=bulbon

select case countsouth
case 1
north2.state=bulbblink
case 2
north3.state=bulbblink
case 3
north4.state=bulbblink
case 4
north5.state=bulbblink
end select

sub Triggernorth_hit()
set lastswitchhit=triggernorth
if lastswitchhit is triggersouth then
Dim i
countsouth=countsouth+1
if countsouth>5 then countsouth=5
Bb_south(countsouth).state=bulbon

select case countnorth
case 1
north2.state=bulbblink
case 2
north3.state=bulbblink
case 3
north4.state=bulbblink
case 4
north5.state=bulbblink
end select

somewho see where our problem is, and why the loop dont work??
or a good solution for this loop?

thx in advance

lox:)

Edited by loxagon1, 10 October 2011 - 02:12 PM.

if you not a part of the solution ure a part of the problem;)

#2 Popotte

Popotte

    Pinball Fan

  • VIP
  • 808 posts
  • Location:Paris

  • Flag: France

  • Favorite Pinball: World Fair



Posted 10 October 2011 - 04:16 PM

Dim Bb_north(5) ' nordlichter
Dim countnorth ' nordcount
Dim Bb_south(5) ' southlichter
Dim countsouth ' southcount

set Bb_north(1)=north1:set Bb_north(2)=north2:set Bb_north(3)=north3:set Bb_north(4)=north4:set Bb_north(5)=north5
set Bb_south(1)=south1:set Bb_south(2)=south2:set Bb_south(3)=south3:set Bb_south(4)=south4:set Bb_south(5)=south5
Set LastSwitchHit=Nothing

Sub Triggersouth_hit()
if lastswitchhit is triggernorth then
countnorth=countnorth+1
if countnorth>5 then countnorth=5
Bb_north(countnorth).state=bulbon
if countsouth<5 then bB_north(countsouth)=bulbblink
End If
set lastswitchhit=triggersouth
End Sub

sub Triggernorth_hit()
if lastswitchhit is triggersouth then
countsouth=countsouth+1
if countsouth>5 then countsouth=5
Bb_south(countsouth).state=bulbon
if countnorth<5 then bB_south(countnorth)=bulbblink
End If
set lastswitchhit=triggernorth
End Sub



Les cons ça ose tout. C'est même à ça qu'on les reconnaît.

PopotteDMDredo.gif

 


#3 destruk

destruk

    VPF Veteran

  • VPF Staff
  • 6,338 posts
  • Location:Colorado Springs, CO

  • Flag: United States of America

  • Favorite Pinball: Ultrapin!



Posted 10 October 2011 - 05:53 PM

Yes, that fixed it. By setting the lastswitchhit first in the routine, your "If" would always fail.

Build a fire, vipers love the heat.


#4 loxagon1

loxagon1

    Enthusiast

  • Silver Supporter
  • 51 posts
  • Location:germany

  • Flag: Germany

  • Favorite Pinball: Attack from Mars, Theater of Magic, Terminator 2

Posted 10 October 2011 - 07:37 PM

aye thats works:)

thanks guys for fast help, i will promise our next table are a good one smile.gif

greetings lox:)
if you not a part of the solution ure a part of the problem;)