Maximum Ball Speed Debug Code

GeorgeH

Flippered Out
Site Supporters
Joined
May 3, 2016
Messages
2,685
Solutions
6
Reaction score
2,138
Points
145
Favorite Pinball Machine
Attack From Mars
I had some trouble a long time ago with figuring out ball speed because the numbers fly by so fast you can't read them when set up to run in real time. Ravarcade sent me this code for max ball speed debug code. It works pretty well. It has two parts:

Code:
'Rav's Fastest ball speed debug start
' ----------------------- This will record fastert ball (and display new record) -------------------
Dim FastestBallSpeed
FastestBallSpeed = 0
Sub NewtonPhysicsTick()
   Dim Ball
   Set Ball = xBAM.BallCloseTo(0,0,0)

   If Ball.Exist Then
      If FastestBallSpeed < Ball.Speed Then
         FastestBallSpeed = Ball.Speed
         AddDebugText "New Ball Speed Record: " & FastestBallSpeed
      End If
   End If
End Sub
'Rav's Fastest ball speed debug end

This part you add under the Sub FuturePinball_KeyPressed(ByVal KeyCode):

Code:
'Rav's Fastest ball speed debug start
' --------------------------- Add this to FuturePinball_KeyPressed, to reset and read Ball Speed Record
   If KeyCode = 82 Then FastestBallSpeed = 0                                    ' KeyCode = 82 = '0' on numpad
   If KeyCode = 79 Then AddDebugText "Ball Speed Record: " & FastestBallSpeed   ' KeyCode = 79 = '1' on numpad
'Rav's Fastest ball speed debug end

Gimli created something different where the debug code displays the ball speed at a 200 millisecond interval (you need to add a timer):

Code:
' Ball Speed Debug Start
Sub BallSpeedTimer_Expired()
    AddDebugText "Ball Speed: " & xBam.Ball.Speed
End Sub
' Ball Speed Debug End

This part is added under Sub FuturePinball_BeginPlay():

Code:
' Ball Speed Debug Start - Be sure to add timer named "BallSpeedTimer".
    BallSpeedTimer.Set True, 200
' Ball Speed Debug End

Hopefully one of these may help you.
 
You can find code for that in smoke's rolling ball sound script just as well.
 
if you just put "AddDebugText "Ball Speed: " & xBam.Ball.Speed" on your flipper sub, you will have the speed when ball leave your flipper..
The last value shown on debug before ball is out of prehit zone fo flipper will be the max ball speed.
 
That is some useful code. I have found the fastest ball speed can be the ball leaving the plunger, ball leaving the bumpers or after the ball hits the flippers. It depends on your setup.
 
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: momohoho27 has left the room.
      Back
      Top