Help Hello, I would like some help

Zobou

Pinball Hall of Famer
Joined
Mar 29, 2022
Messages
244
Reaction score
291
Points
76
Favorite Pinball Machine
Jupiter
Hello, I would like some help. Can someone tell me if we can isolate the last two digits of the "nvscore1" to later get the number.

Example 1: the player played a game and obtained 1,520,110
So the resulting number would be 10


Example 2: the player played a game and obtained 1,630,150
So the resulting number would be 50
etc...

I want to schedule a random lottery feature at the end of the game.
 
If at 2am i'm thinking properly...

Dim MatchNumberP1
MatchNumberP1 = nvScore1 mod 100


where nvScore1 is a the special FP var that natively holds the player1 score if you are using it.
If not, use whatever var you use to hold the player1 score
 
Thank you, the result gave


Coded:
variable statement
Dim MatchNum 'Use to generate num
Dim MatchNumP1 'Use for match num score player1
Dim MatchNumP2 'Use for Match num score player2
Dim MatchNumP3 'Use for match num score player3
Dim MatchNumP4 'Use for Match num score player4

'the basic code of the future pinball machine

Else 'no extra balls
BallsRemaining(CurrentPlayer) = BallsRemaining(CurrentPlayer) - 1

Was that the last bullet?
If (BallsRemaining(CurrentPlayer) <= 0) Then

'AddDebugText "No More Balls, High Score Entry"'end Fp code here...

“adding a time loop”
random start loop..
GenNumHTimer.Enabled = True '250 milliseconds

"is a final loop"
TakeNumTimer.Enabled = True '2500 milliseconds

Other
'not the last bullet (for this player)
' if several players play, go to the next one
EndOfBallComplete()
End if
End if
End Sub

'random loop' 250 milliseconds'
Sub-GenNumHTimer_expired()

Dim MatchNumRnd
MatchNumRnd = Rnd(1) * 10
Select Case (Int(MatchNumRnd))
Case 0: MatchNum = 00: PlaySound "fx_bleep": DispDmd1.Text = "[f1][xc][y18]Match 0" & MatchNum & "[/b][f2][x2][y2]" & nvscore( CurrentPlayer)
Case 1: MatchNum = 10: PlaySound "fx_bleep": DispDmd1.Text = "[f1][xc][y18]Match" & MatchNum & "[/b][f2][x2][y2]" & nvscore(CurrentPlayer )
Case 2: MatchNum = 20: PlaySound "fx_bleep": DispDmd1.Text = "[f1][xc][y18]Match" & MatchNum & "[/b][f2][x2][y2]" & nvscore(CurrentPlayer )
Case 3: MatchNum = 30: PlaySound "fx_bleep": DispDmd1.Text = "[f1][xc][y18]Match" & MatchNum & "[/b][f2][x2][y2]" & nvscore(CurrentPlayer )
Case 4: MatchNum = 40: PlaySound "fx_bleep": DispDmd1.Text = "[f1][xc][y18]Match" & MatchNum & "[/b][f2][x2][y2]" & nvscore(CurrentPlayer )
Case 5: MatchNum = 50: PlaySound "fx_bleep": DispDmd1.Text = "[f1][xc][y18]Match" & MatchNum & "[/b][f2][x2][y2]" & nvscore(CurrentPlayer )
Case 6: MatchNum = 60: PlaySound "fx_bleep": DispDmd1.Text = "[f1][xc][y18]Match" & MatchNum & "[/b][f2][x2][y2]" & nvscore(CurrentPlayer )
Case 7: MatchNum = 70: PlaySound "fx_bleep": DispDmd1.Text = "[f1][xc][y18]Match" & MatchNum & "[/b][f2][x2][y2]" & nvscore(CurrentPlayer )
Case 8: MatchNum = 80: PlaySound "fx_bleep": DispDmd1.Text = "[f1][xc][y18]Match" & MatchNum & "[/b][f2][x2][y2]" & nvscore(CurrentPlayer )
Case 9: MatchNum = 90: PlaySound "fx_bleep": DispDmd1.Text = "[f1][xc][y18]Match" & MatchNum & "[/b][f2][x2][y2]" & nvscore(CurrentPlayer )
End Select
End Sub

'after a 2500 millisecond shutdown loop'
Sub-TakeNumTimer_expired()

'stop loop'
TakeNumTimer.Enabled = False

'Stop loop '250 milliseconds'
GenNumHTimer.Enabled = False

'Start timer for more time Result 1000 milliseconds
WaitNumTimer.Enabled = True
End Sub

'Timer expired 1000 milliseconds after...'
Sub-WaitNumTimer_expired()

'sleep timer'
WaitNumTimer.Enabled = False

"the function compares the result [...]
"if he accepts, he closes the program and adds a credit or he closes without"

If CurrentPlayer = 1 then
MatchNumP1 = nvScore1 mod 100
If MatchNumP1 = MatchNum then
DispDmd1.Text = "[f1][xc][yc]P1 Win"
nvCredits = nvCredits + 1
PlaySound “knocker”

'here I start the "bEnteringAHighScore" "the player enters his name in the high score table
WaitHighS.Enabled = True

Exit Sub
End if
End if

If CurrentPlayer = 2 then
MatchNumP2 = nvScore2 mod 100
If MatchNumP2 = MatchNum then
DispDmd1.Text = "[f1][xc][yc]P2 Win"
nvCredits = nvCredits + 1
PlaySound “knocker”
WaitHighS.Enabled = True
Exit Sub
End if
End if

If CurrentPlayer = 3 then
MatchNumP3 = nvScore3 mod 100
If MatchNumP3 = MatchNum then
DispDmd1.Text = "[f1][xc][yc]P3 Win"
nvCredits = nvCredits + 1
PlaySound “knocker”
WaitHighS.Enabled = True
Exit Sub
End if
End if

If CurrentPlayer = 4 then
MatchNumP4 = nvScore4 mod 100
If MatchNumP4 = MatchNum then
DispDmd1.Text = "[f1][xc][yc]P4 Win"
nvCredits = nvCredits + 1
PlaySound “knocker”
WaitHighS.Enabled = True
Exit Sub
End if
End if

DispDmd1.Text = "[f1][xc][yc]No Win"
WaitHighS.Enabled = True
End Sub
 
Last edited:
Thx man
 
Last edited:
I'm assuming it worked :)
 
yes but how not to generate the same number several times in a row no ???
 
If you don't have Randomize at the top of the script, you should.

You can also (and I'm almost sure you should) put Randomize right after Sub GenNumHTimer_expired()

BTW you have Sub-GenNumHTimer_expired() and you need to remove the dash "-"

I recall some documentation about a problem with randomize, hence the suggestion to use it right before you need it and not just at table initialization.
 
Last edited:
Yes I have already seen in the "randomiser" in the FP code but I don't know what it can be used for. My strength is not the code. Its working... good ok. :ghost:
 
I just had a closer look but I really can't do the math in my head and I don't remember how I did it in Cosmic Princess

But you seem to want multiples of 10 and just the integer part of the number so I think you're looking for
MatchNumber = 10 *(Int(Rnd *10))

And the randomiz shuold be in sub futurepinball_beginplay I think... Honestly I know there's a problem with it but I can't remember if it happens when you call it multiple times or just once :D
 
in short, it works anyway and it's not so bad. Otherwise if the result is equal to the same result redo generates the number, but I have something else to finalize for the beta so .... thx againe
 
Here's the function I use to generate random numbers in a range (both ends included).

Code:
Function MakeRandom(ByVal min, ByVal max)
    MakeRandom = CInt(Int((max - min + 1) * Rnd())) + min
End Function

With this, you could generate a number between 0 and 9 and multiply it by 10.

Code:
Dim Value : Value = MakeRandom(0, 9) * 10
 
who ever worked on a mini-playfiled? I would like an example to understand how it works.
 
who ever worked on a mini-playfiled? I would like an example to understand how it works.

 
hello I would like to know if we can use BAM dynamic lighting on a textured surface. for a second floor for example
 
hello I would like to know if we can use BAM dynamic lighting on a textured surface. for a second floor for example
I am not a lighting person like @TerryRed but dynamic lighting should apply to all table objects

You can also uniquely change Texture "brightness" in code using this :
SetTexParams(texNames, specLevel, shineLevel)
 
I am not a lighting person like @TerryRed but dynamic lighting should apply to all table objects

You can also uniquely change Texture "brightness" in code using this :
SetTexParams(texNames, specLevel, shineLevel)

In order to use that code, you have to add this subroutine also:

Code:
Sub SetTexParams(texNames, specLevel, shineLevel)
    Dim texArray, oneTexName, tex
    texArray = Split(texNames,",")
    For each oneTexName in texArray
        Set tex = xBAM.GetTexture(oneTexName)
        If tex.isValid Then
            tex.SpecularLevel = specLevel
            tex.Shininess = shineLevel
        End If       
    Next
End Sub
 
If not, is there a way to modify the playing field surface? to make a hole in it. Instead, I'm going to change my approach and place the mini playground project in the center of the table. I said a simple thing for Christmas...
 
What sort of hole? Adding a kicker can create a small hole. In Iron Man, the Iron Monger rises up from below the playfield through what you might think of as a hole. Do you want some sort of custom model that extends below the surface?
 
yes that is exactly what I wanted to try. Unfortunately it doesn't work. so I found another way to share
Bam's miniplayfield. Thank you very much GeorgeH for your help.
 
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