Ramp Loop Bonus Routine

Please refer to the shivaEngine script and the example table Written by shiva

This is expanded a bit, so I will start at a simple example, and build from there. First off, I would like both the ramps to give a score when made, so there are triggers (hidden) placed on both ramps. Instead of placing them at the start of The ramps, I placed them in a area where I am certain the ball will continue along The ramp, instead of rolling back down to the ramp entrance because of a weak shot. These triggers are set to give a base value, but will give a different value if a certain light is "on". The triggers are not visible during The game, but you can see them in The editor view, they are named RampLoopLeft (just before where the multiball Ramp is, to prevent a loop bonus being collected by a start of Multiball) and RampLoopRight. Those lights are The arrow shaped lights in front of each ramp, RampLoopLightRight for The green ramp, and RampLoopLightLeft for The red ramp.
First off to prevent The lights from staying on at a new ball, I add this to The NewBall sub:
Code

RampLoopLightLeft.State = LightStateOff ' switch off left red ramp loop light
RampLoopLightRight.State = LightStateOff ' switch off right green ramp loop

I also would like to call the other light to switch on, to set up a second loop, so the code for the triggers would look like this:
Code

Sub RampLoopRight_Hit() ' For Green Ramp Loop Bonus

If RampLoopLightRight.State = LightStateOn then 'if ramplight is on
addscore 5000 '5000 points added to score
RampLoopLightRight.State = LightStateOff 'turn off that light
RampLoopLightLeft.State = LightStateOn 'switch on the other ramp light
else
addscore 500 'if not light lit, then give 500 points instead
Bullet6 end if
Bullet6 end Sub

After checking that it works, now add a timer to the table (enabled, 10000 interval (about ten seconds)), so the ramps doesn't stay lit all the time. Also, a ball going in the inner lanes will now light the loop shot, instead of making a ramp first. Note the Timer is switched off first, to clear the remaining time left on the timer. If you don't turn off the timer at the beginning of the code, the timer will still be on, and the loop bonus will turn off when that timer is finished. Note that the light that controls the loop has been moved to be turned on by the inner lanes instead of the ramp. It then restarts the timer at the beginning
Code

Sub LeftInlane_Hit() 'lights green loop ramp
If RampLoopLightLeft.State = LightStateOff then
TRightTimer.Enabled = False 'Turn off Green Ramp Timer if it was on
RampLoopLightRight.State = LightStateOn 'switch on the red ramp loop light
addscore 100
TRightTimer.Enabled = True 'Turn on Green Ramp Timer
Bullet6 end if
Bullet6 end Sub

Sub RampLoopRight_Hit ' For Green Ramp Loop Bonus
If RampLoopLightRight.State = LightStateOn then 'if ramplight is on
addscore 5000 '5000 points added to score
RampLoopLightRight.State = LightStateOff 'turn off that light
else
addscore 500 'if not light lit, then give 500 points instead
End If
End Sub

Sub TRightTimer_Timer 'Timer for the loop light
TRightTimer.Enabled = false 'Turn off Timer
RampLoopLightRight.State = LightStateOff 'switch off the ramp light
Bullet6 end Sub

So not only do the inner lanes control the Ramp loops, but because the ramps end just at the start of the opposite inner lane, it will trigger the other ramp, so you can loop the ball from one ramp to another. You also can increase the value of the points with successive shots by declaring a variable with a dim statement, and using code similar to how the multiple bonus is done.

Updated Jun 22, 2005 Written by shiva
 
Last edited:
General chit-chat
Help Users
You can interact with the ChatGPT Bot in any Chat Room and there is a dedicated room. The command is /ai followed by a space and then your ? or inquiry.
ie: /ai What is a EM Pinball Machine?
  • No one is chatting at the moment.
      Chat Bot Mibs Chat Bot Mibs: Flipper Hermann has left the room.
      Back
      Top