Jump to content



Tutorial info Visit support topic

  • Added on: Oct 14 2014 08:13 AM
  • Views: 7776
 


* * * * *
1 Ratings

SCRIPT scripting for Future Pinball (Scripting for Dummies)

I look through my own script when i build in FP.. I will share my script will all. It may help.

Posted by ghostmachine on Oct 14 2014 08:13 AM

tumblr_lstbslOSFm1qd5bcwo1_500.gif

 

GHOSTMACHINE SCRIPTS

 

HUD CREDITS  ######= HudDmd1.Text = "[f3][xc][y3]CREDITS " & nvCredits & ".[f3][xc][y15]INSERT COIN"

HUD SCORE          =DispDmd1.Text = "[f3][xc][y3]* " & (nvScore(CurrentPlayer)) & ".[f3][xc][y15]INSERT COIN"
 
DispSeg2.Text = "SCORE "
MyDmd1.Text = "[f3][xc][y3]CREDITS " & nvCredits & ".[f3][xc][y15]INSERT COIN"
 
hud2.setvalue (nvBallsPerGame)

Sub Timer3_Expired()
Popup1.SolenoidOn
Popup1.SolenoidOff
End Sub

Sub 
Playsound"your music file name here" 
End Sub 
 
playmusic 4, "YOURMUSICFILEGOESHERE", true, 0.5, 0700
 
----------------------------------------------------------
 
Sub 
  PlayMusic "ar.mp3"
End Sub 
 
---------------------------------------------------------
 
KICKERS
 
Sub KickerName_Hit()
 KickerName.SolenoidPulse()
End Sub
 
-----------------------------------------------------------
 
KICKER TIMER
 
Sub
KickerName_Hit
"TimerName.Enabled = True"
End Sub
 
 
Sub
TimerName_Expired
TimerName.Enabled = False
  
End Sub
 
-----------------------------------------------------------
 
SCORE
 
Sub Bumper1_Hit() 
AddScore(100)
End Sub 
 
-----------------------------------------------------------
 
TARGET SOUND and FLASHER
 
Sub Target1_Hit()
    Flasher1.FlashForMs 300, 75, BulbOff
    Flasher2.FlashForMs 300, 75, BulbOff
    PlaySound("sfx_TargetMade")
    AddPoints(500)
End Sub
 
 
--------------------------------------------------------------

TIMERS
 
Sub kicker1_hit()
    kickertimer.enabled = TRUE       ' Turn on the timer having set it to 1500 in the editor
End Sub
 
Sub kickertimer_expired()            ' The time has run out
    kickertimer.enabled = FALSE      ' So turn OFF the timer
    kicker1.solenoidpulse()          ' Kick the ball out
End Sub
 
---------------------------------------------------------------
 
EXTRA BALL
BallsOnPlayfield = BallsOnPlayfield + 1
Sub target_hit
 ExtraBallsAwards(CorrentPlayer)=ExtraBallsAwards(CorrentPlayer)+1
end sub
 
-------------------------------------------------------------
 
EXTRA FLIPPERS
 
 Now look at line 132 (Left Flipper) and line 138 (Right Flipper).
 As you can see, the flippers will move up when the flipper key is 
pressed and play a sound. Now look at lines 229 and 234. When the
 flipper keys are released the flippers will return to the down position.
 
For example: LeftUpperFlipper.SolenoidOn and LeftUpperFlipper.SolenoidOff.

------------------------------------------------------------------------
 
SPELLS A WORD LIGHTS.. rotate by flipper
 
Sub RotateLairLights()
 
      Dim tmp1
      Dim tmp2
      Dim tmp3
      Dim tmp4
 
     tmp1 = Llight.state
      tmp2 = Alight.state
      tmp3 = Ilight.state
      tmp4 = Rlight.state
 
      Llight.state = tmp4
      Alight.state = tmp1
      Ilight.state = tmp2
      Rlight.state = tmp3
 
      End Sub
 
 
------------------------------------------------------------------
 
--------------------------------------------------------------------------
BALL POPUP SKRIPT   set first to timer on.. 1000 and 5000
 
Sub TimerPoP_Expired
Popup1.SolenoidOn
End Sub
 
 
Sub TimerOFF_Expired
Popup1.SolenoidOff
End Sub
 
 
 
--------------------------------------------------------------------------
 
DROP TARGETS  USE 5000 for timer
 
 
Sub DropTarget3_Hit()
Addscore(500) 
timer1.enabled = TRUE
end sub
 
Sub DropTarget7_Hit()
Addscore(500) 
timer2.enabled = TRUE 
end sub
 
Sub  timer2_expired() 
DropTarget3.solenoidpulse()
DropTarget7.solenoidpulse()
end sub
 
 
 
------------------------------------------------------------------------------
 
 
TRIGGER LIGHTS ON
 
Sub Trigger7_Hit()
If (fpTilted = False) Then
       AddScore(510)
If (LightBonus4x.State = BulbOff) Then
         LightBonus4x.State = BulbOn
End If
End If
set LastSwitchHit = Trigger3
End Sub
 
 
----------------------------------------------------------------------------

Timer LIGHTS OFF 
 
Sub Trigger7_hit()
    timer1.enabled = TRUE       
End Sub
 
Sub timer1_expired()            
    timer1.enabled = FALSE      
    Light.State = BulbOff      
End Sub
 
 
 
 
------------------------------------------------------------------------------
EXTRA BALL
BallsOnPlayfield = BallsOnPlayfield + 1
PlungerKicker.CreateBall
 
 
 
Sub Kicker3_Hit()
 Kicker3.SolenoidPulse()
 TimerBALL.enabled = TRUE 
PlungerKicker.CreateBall
End Sub

Sub timerBALL_expired()            
    timerBALL.enabled = FALSE      
End Sub
 
 
 
BallsOnPlayfield = BallsOnPlayfield + 1
 
 
 
Sub Kicker1_Hit()
Kicker1.SolenoidOff
PlungerKicker.CreateBall
timer1.enabled = TRUE 
End Sub
---------------------------------------------------------------------------------
at the begining
 
 
Sub FuturePinball_BeginPlay()
Randomize
Trapkick.CreateCaptiveBall
 
 
-----------------------------------------------------------------------------------
HUD SCORE TO POINTS
 
ScoreDisplay.ResetToZero
 
HudSeg1.ResetToZero
Sub AddScore(points)
If (fpTilted = FALSE) Then
' add the points to the current players score variable
nvScore(CurrentPlayer) = nvScore(CurrentPlayer) + points
 
' update the score displays
 
 
' add the points to the correct display and light the current players display
Select Case (CurrentPlayer)
Case 1: ScoreDisplay.AddValue(points)
 
End Select
End if
 
' you may wish to check to see if the player has gotten a replay
End Sub
 
 
---------------------------------------------------------------------------------
hud words
 
Sub Trigger1_Hit ()
    DispWords.QueueText "ALIEN"
End Sub

-------------------------------------------------------
PlungerKicker ball color 
 
HyperKickHole.DestroyBall
HypeLight.FlashForMs(7000)
HyperKickHole.CreateBall 255,0,0
 
 
253,204,102 GOLD
0,255,0 is green
255,0,0 is red
 
0,0,255 is blue
0,0,0 is black
255,255,0 yellow
255,0,255 purple
0,255,255 light blue
Trigger20
 
Timer8
 
 
 
----------------------------------------------------------------
nvCredits
ScoreDisplay.ResetToZero
 
BallDisplay.SetValue(BallInPlay)
 
EndGame()
BallDisplay.SetValue(0)
CreditDisplay.SetValue(0)
reset for new player ball
 
player insterted coin
CreditDisplay.SetValue(nvCredits)
BallDisplay.SetValue(BallInPlay)
 
------------------------------------------------------------------
 
 
 
 
EXTRA FLIPPER
 
find RIGHT FLIPPER on and off above add
Flipper1.SolenoidOn
Flipper1.SolenoidOff
 
 
-------------------------------------------------------------------
 
PlaySound "1SPINNY"
 
----------------------------------------------------------
rotate lights
 
'rotate lights'
templight = light4.state
light4.state = light3.state
light3.state = light2.state
light2.state = light1.state
 

------------------------------------------------------------------------------
DIVERTER TIMER TEST FOR BEST ###
 
Sub Trigger2_Hit()
AddScore(700)
Diverter2.SolenoidOn
Timer3.Enabled = TRUE
End Sub
 
Sub Timer3_Expired()
Timer3.Enabled = FALSE
Diverter2.SolenoidOff
End Sub
 
 
 
 
------------------------------------------------------------------------
 
HUD SCRIPT  OLD SCHOOL HUD
 
Sub ResetForNewPlayerBall()
' make sure the correct display is upto date
AddScore(0)
 
' set the current players bonus multiplier back down to 1X
SetBonusMultiplier(1)
    if ball1.state=bulbblink then
   ball2.state=bulbblink
   ball1.state=1
   hud.Text = "[f1][b]BALL 2"
   else
   if ball2.state=bulbblink then
   ball3.state=bulbblink
   ball2.state=1
   hud.Text = "[f1][b]BALL 3"
   else
   ball1.state=bulbblink
   hud.Text = "[f1][b]BALL 1"
   end if
   end if
   golit.state=0
' reset any drop targets, lights, game modes etc..
 
End Sub
 
end of game
 
 
hud.Text = "[f1][b]game over"
 
hud.AddValue(points)
 
------------------------------------------------------
 
 
SOLENOID ON
 
EmKicker.SolenoidOn
 
 
 
------------------------------------------------------------------
COLOR CHANGING PLAYFIELD
 
darkpf.render=true
darkpf.render=false
 
-------------------------------------------------------------------
 
BEST TIMER SCRIPT FOR KICKER
 
1500 MILLISECONDS
 
Sub kicker1_Hit()
AddScore(1000)
Timer1.Enabled = true
u1.FlashForMs 1500, 80, BulbOn
 
END SUB
 
 
Sub Timer1_Expired
   Timer1.Enabled = False
   kicker1.solenoidpulse
End Sub
 
--------------------------------------------------------------------------
 
SPINNING DISK
 
LEFTFLIPPER AND RIGHT FLIPPER
 
disk.solenoidon
 
----------------------------------------------------------
 
Sub Trigger1_hit()
rampA.SolenoidPulse
rampA.PopDown
end Sub
 
 
-------------------------------------------------
 
ROTO TARGET
 
RotoTarget1.stepforward(10000)
 
Sub RotoTarget1_Hit()
' add some points
AddScore(2500)
   if ctl.state=bulbblink then
   IncrementBonusMultiplier()
   ctl.state=0
   end if
End Sub
 
 
 
 
 
 
-----------------------------------
 
RANDOM STUFF
SetAllLightsForAttractMode()
SpinningDisk3.AntiClockwise = true
   SpinningDisk2.solenoidon
 
Drain.DestroyBall
CreateNewBall()
BallsOnPlayfield = BallsOnPlayfield - 1
Dmd1.Text = "[f1][b]shoot again"
 
CaptiveBallKicker.CreateCaptiveBall 0,224,224
 

---------------------------------------------------
 
HOLOGRAMS
 
Hologram22.Fadein()
sub DeleteTimer_Expired
    DeleteTimer.Enabled = False
    Hologram1.Fadein()
      Hologram1.UpdateInterval = 70
      Hologram1.Frame 8,20
      holotimer1.Set True, 2500
    Hologram22.Fadein()
    Hologram22.UpdateInterval = 100
    Hologram22.Frame 10,19
    holotimer22.Set True, 2050
     invisible1()
end sub
 
holotimer22.Set True, 2050
 
 
Sub holotimer22_Expired()    
    holotimer22.Set False
    Hologram22.FadeOut()
End Sub
 
 
       Hologram12.Frame 1,14
 
LightSeqsst.stopplay()
LightSeqsst.Play
 
Hologram1.Frame 1,12
 
 
-----------------------------------------------
AUTO PLUNGER
 
BEST USE TRIGGER and use
AutoPlunger1.SolenoidPulse
 
Plunger.LetGo
Plunger.Pull
AutoPlunger1.SolenoidOn()
AutoPlunger1.SolenoidOff()
. SolenoidOn () 
 . SolenoidOff () 
 
-----------------------------------------------
 
 
 
THESE ARE THE BASICS.. I KEEP THEM HANDY. scripting, and timers can be mixed, just remember to start with SUB then end with END SUB.. you will be fine. LOL.