Jump to content



Photo
- - - - -

Any switch hit call?


  • Please log in to reply
4 replies to this topic

#1 Glxb

Glxb

    Enthusiast

  • VIP
  • 385 posts

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

  • Favorite Pinball: The Addams Family



Posted 02 July 2010 - 10:46 PM

Hi as you may know I'm coding a Family Guy tribute table in FP.
One of the the modes I've yet to code is the chicken fight. In it whenever you hit any target or switch etc, it adds to your punches against the chicken.
Is there anyway to call a routine for the ball hitting any table switch or will I have to put a sub routine for each one?
Hope I'm clear in what I want.
Thanks in advance.


BTW I'm loving this.
Follow me on twitter. @GLXB

#2 Pinbotic

Pinbotic

    Enthusiast

  • VIP
  • 290 posts
  • Location:Canada

  • Flag: Canada

  • Favorite Pinball: Pin*Bot




  • Trophies:

Posted 03 July 2010 - 01:16 AM

I do not know of any code that would allow for that. Each trigger/target would need to call a single subroutine associated with the chicken fight.
Avatar courtesy of Grizz.

#3 Glxb

Glxb

    Enthusiast

  • VIP
  • 385 posts

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

  • Favorite Pinball: The Addams Family



Posted 03 July 2010 - 07:13 AM

I think I've figured out a way.
If I add an if/then statement to the addscore subroutine something like this.

If bChicken = true then
chickenhit = chickenhit + 1
end if


Then anything that calls the addscore routine should add 1 to chickenhit.

Should save some coding
Follow me on twitter. @GLXB

#4 Mystman

Mystman

    Enthusiast

  • Members
  • PipPipPip
  • 93 posts

  • Flag: Netherlands

  • Favorite Pinball: Sonic 2

Posted 03 July 2010 - 07:34 AM

QUOTE (Glxb @ Jul 3 2010, 09:13 AM) <{POST_SNAPBACK}>
I think I've figured out a way.
If I add an if/then statement to the addscore subroutine something like this.


That can work, but then you'll have to be really careful with the rest of your code. In many tables, a single trigger hit might be responsible for multiple calls of the AddScore() sub, or an addscore() event may not even be directly connected to a trigger hit. Of course, if you're sure that never happens (or is going to happen) in your table, then your solution works.

I'd personally code something like

CODE
sub ChickenCheck()
        If bChicken = true then
          chickenhit = chickenhit + 1
        end if
end sub


and then just call ChickenCheck in every trigger_Hit event. Might be a bit more work, but should be more robust.

#5 Glxb

Glxb

    Enthusiast

  • VIP
  • 385 posts

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

  • Favorite Pinball: The Addams Family



Posted 03 July 2010 - 08:14 AM

QUOTE (Mystman @ Jul 3 2010, 08:34 AM) <{POST_SNAPBACK}>
QUOTE (Glxb @ Jul 3 2010, 09:13 AM) <{POST_SNAPBACK}>
I think I've figured out a way.
If I add an if/then statement to the addscore subroutine something like this.


That can work, but then you'll have to be really careful with the rest of your code. In many tables, a single trigger hit might be responsible for multiple calls of the AddScore() sub, or an addscore() event may not even be directly connected to a trigger hit. Of course, if you're sure that never happens (or is going to happen) in your table, then your solution works.

I'd personally code something like

CODE
sub ChickenCheck()
        If bChicken = true then
          chickenhit = chickenhit + 1
        end if
end sub


and then just call ChickenCheck in every trigger_Hit event. Might be a bit more work, but should be more robust.



Thanks I may do it that way.
Got a lot more coding first.
Follow me on twitter. @GLXB