I want to add a 'free game' script

faralos

Faralos
Joined
Nov 17, 2008
Messages
1,810
Solutions
6
Reaction score
211
Points
90
Favorite Pinball Machine
Flash
How do i code a pin for " if score is higher than score (a) then you get a free game" i can't find any demo table that has anything concerning 'award credit(free game) for high score' anyone? is it a lot of complicated coding?
My zizzle POTC table is finished except that there is no free game awarded for a high score! Wizards Hat is busyhosting a UK tourney this week at his home, he informed me that he won't be available for the entire week! (and I'm feelign a tad guilty bugging him all the time; he has helped me with scoring, sounds, lights, table init, game over and other things.)
All that you can do right now is just play it. when the 3 balls are done, well, that's it! I can't do matches yet and (obviously) no high scores either.
Please, anyone? I just need that coding and it'll be ready!
Thanks for all your help...:help:
 
Easy. Give your table a Unique Name different from Table1 or any other table. Very important!

Create two Dims. You probably already have a Dim Score, but make sure just to create a working highscore. You can use any unique name for a Dim once you have the method.

Dim Score, Highscore, Credits, Game, KnockerUp

Then create a

Sub YourUniqueTableName_Init()
Game = False
On Error Resume Next
Highscore = LoadValue("YourUniqueTableName", "Highscore")
End Sub

Then in the Sub for game over, whatever you choose to call it:

Sub GameOver()
Game = False
On Error Resume Next
If Score > Highscore Then Highscore = Score
Credits = Credits + 3
CreditsTexBox.Text = Credits
On Error Resume Next
SaveValue("YourUniqueTableName", "Highscore")

End Sub

You might instead want to use a Timer with a Dim counter

Dim = Dim + 1

... for adding highscore credits and playing the 'Knocker' sound. Turn off the Timer when the Dim counter reaches 3

Sub GameOver()
Game = False
On Error Resume Next
If Score > Highscore Then Highscore = Score
On Error Resume Next
SaveValue("YourUniqueTableName", "Highscore")
Timer1.Enabled = True
End Sub

Sub Timer1_Timer()
If KnockerUp = 3 Then
Timer1.Enabled = False
KnockerUp = 0
End If

KnockerUp = KnockerUp + 1
Credits = Credits + 1
PlaySound "Knocker"
If Credits < 10 Then
CreditsTextBox.Text = "0" & Credits
Else
CreditsTextBox.Text = Credits
End If
End Sub

Make sure to create a TextBox on the Backglass and rename it to match the name you use for the Credits display. In this example I used CreditsTextBox for the name.
If you need help creating a Credits/Start system:

Sub Table1_KeyDown(ByVal keycode)
If keycode = 6 Then
Credits = Credits + 1
If Credits < 10 Then ' not needed but creates the double digit display like a real machine.
CreditsTextBox.Text = "0" & Credits ' You can omit the above "If" and use CreditsTextBox.Text = Credits instead
Else ' again, omit this line if you omit the extra double-digit display code
CreditsTextBox.Text = Credits 'the only line you need, but will display single digits less than 10
End If 'If you omit the extra "double-digit" code, then omit one of these End Ifs
End If

If keycode = 2 And Credits > 0 And Game = False Then
Game = True
Credits = Credits - 1
If Credits < 10
CreditsTextBox.Text = "0" & Credits
Else
CreditsTextBox.Text = Credits
End If
StartGame()
End If
End Sub

Sub StartGame()
'Do what you want the table to do
Plunger.CreateBall
...
....
End Sub

Note that the LoadValue and SaveValue commands read and write the value in the Dim Highscore to the VPReg.str file which should be located in the \Visual Pinball\Users folder.
 
Last edited:
Thanks a bunch 'sleepy'!! I am going to put it into my zizzle copies, although I hear that the zizzles DON'T remember the high scores, once they are turned off, hopefully mine will. It gives one something to 'shoot' for rather than just playing the 3 balls and then that's it! So, hopefully in about 1-2 weeks time BOTH zizzles will be done and ready to play (these are the POTC and the marvel superheroes pins) I know there are to be two more coming out soon, but I have no info at all on them, not even a theme
If anyone knows what they are to be, then post so I can start on them, too!
 
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:
    docdoc has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Exnihilo_Mundus has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    angmarg52 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    tully619 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    smorndb has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Tech49 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Topsi Klaus has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Forsaken43 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    duduky72 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Gerge has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    nunolilo has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    DavidT2025 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Gary-7 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Thunderbird has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    alug has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    bluebird has left the room.
  • HZR @ HZR:
    It’s nice to go all see a place I can play actual machines!!!!
    Quote
  • Chat Bot Mibs Chat Bot Mibs:
    Sunrise74 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Rai has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    liebowa has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    gustave has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    hoovie108 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    creatine481 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    fabioaugusto4 has left the room.
  • Chat Bot Mibs Chat Bot Mibs:
    Dangerpin has left the room.
      Chat Bot Mibs Chat Bot Mibs: Dangerpin has left the room.
      Back
      Top