Jump to content




Photo
- - - - -

How to use controller.vbs for EM and Original tables in depth


  • Please log in to reply
2 replies to this topic

#1 arngrim

arngrim

    DJ Force Feedback

  • VIP
  • 2,094 posts
  • Location:Charleroi, Belgium

  • Flag: Belgium

  • Favorite Pinball: Monster bash



Posted 11 April 2016 - 06:28 PM

Hi Guys,
 
After the extensive guide for SS tables:
 
http://www.vpforums....topic=33453&hl=
 
Here is the guide for the non rom tables
 
I will describe it in 2 steps, the basis and the extended features related to Force Feedback and DOF
 
So, as for Rom based tables, you need to call the controller.vbs on top of the script, basically after 
 
option explicit
Randomize
 
like this:
 
On Error Resume Next
ExecuteGlobal GetTextFile("controller.vbs")
If Err Then MsgBox "You need the controller.vbs in order to run this table, available in the vp10 package"
On Error Goto 0
 
You also need a Const cGameName that will define the B2S name, that will be used to memorize the B2S parameters in the B2STableSettings.xml
 
Const cGameName = "GTB2001_1971"

 

It is required by the controller.vbs, and for the DOF of the table is the table gets a DOF Config, most likely available in the configtool:

 

9180.png

 

Next where we need to call the command that will invoke the controller, for non rom tables, the logic will determine B2S controller is installed in the machine of the user, or no controller.

 

It is done here:

 

Sub Table1_init

    LoadEM

    .

    .

    .

End Sub

 

And one thing important is to properly close B2S when the table is stopped:

 

Sub Table1_Exit

    If B2SOn Then Controller.Stop

End Sub

 

That's all for the basis :)

 

Now let's talk about the 3 commands to script the DOF effects in the vp table

 

PlaySound SoundFX("soundname",[DOFContactors,DOFKnocker,DOFChimes,DOFBell,DOFGear,DOFShaker,DOFFlippers,DOFTargets,DOFDropTargets])

DOF DOFIDEffect, [DOFOn,DOFOff,DOFPulse]
SoundFXDOF("soundname",DOFIDEffect,[DOFOn,DOFOff,DOFPulse],[DOFContactors,DOFKnocker,DOFChimes,DOFBell,DOFGear,DOFShaker,DOFFlippers,DOFTargets,DOFDropTargets])

 

basically SoundFXDOF is just a combination of SoundFX and DOF methods

 

So

 

So for example 
 
DOF 101, DOFPulse
PlaySound SoundFX("solenoid",DOFContactors)
 
and 
 
PlaySound SoundFXDOF("solenoid",101,DOFPulse,DOFContactors)

 

are doing exactly the same, just SoundFXDOF can do 2 operations in one line

 

here are examples on how to map the flippers and the slingshots

 

Sub Table1_KeyDown(ByVal keycode)
If keycode = LeftFlipperKey AND CANBEGIN=1 AND GKMM=0 AND VMOn=0 AND Tilted=0 Then    
LeftFlipper.RotateToEnd
leftFlipper1.RotateToEnd
PlaySound SoundFXDOF("fx_flipperup", 101, DOFOn, DOFFlippers), 0, 1, -0.05, 0.05
End If
 
If keycode = RightFlipperKey AND CANBEGIN=1 AND GKMM=0 AND VMOn=0 AND Tilted=0 Then
RightFlipper.RotateToEnd
RightFlipper1.RotateToEnd
PlaySound SoundFXDOF("fx_flipperup", 102, DOFOn, DOFFlippers), 0, 1, 0.05, 0.05
End If
 
Sub Table1_KeyUp(ByVal keycode)
If keycode = LeftFlipperKey AND GKMM=0 AND CANBEGIN=1 AND VMOn=0 AND Tilted=0 Then
LeftFlipper.RotateToStart
        LeftFlipper1.RotateToStart
PlaySound SoundFXDOF("fx_flipperdown", 101, DOFOff, DOFFlippers), 0, 1, -0.05, 0.05
End If
    
If keycode = RightFlipperKey AND GKMM=0 AND CANBEGIN=1 AND VMOn=0 AND Tilted=0 Then
RightFlipper.RotateToStart
        RightFlipper1.RotateToStart
PlaySound SoundFXDOF("fx_flipperdown", 102, DOFOff, DOFFlippers), 0, 1, 0.05, 0.05
End If
 
Dim RStep, Lstep
Sub LeftSlingShot_Slingshot
If Tilted=0 Then
FlashForMs fl2,100,50,0:FlashForMs fl2a,100,50,0:FlashB2S B2SLight2,200,50,0
DOF 140, DOFPulse
  PlaySound SoundFXDOF("fx_slingshotL",103,DOFPulse,DOFContactors),0,1,-0.05,0.05
    SCORES=SCORES+2580
    LSling.Visible = 0
    LSling1.Visible = 1
    sling1.TransZ = -20
    LStep = 0
    Me.TimerEnabled = 1
OnScoreboardChanged
End If
End Sub
 
Sub RightSlingShot_Slingshot
If Tilted=0 Then
FlashForMs fl1,100,50,0:FlashForMs fl1a,100,50,0:FlashB2S B2SLight1,200,50,0
DOF 142, DOFPulse
  PlaySound SoundFXDOF("fx_slingshotR",105,DOFPulse,DOFContactors), 0, 1, 0.05, 0.05
    SCORES=SCORES+2580
    RSling.Visible = 0
    RSling1.Visible = 1
    sling2.TransZ = -20
    RStep = 0
    Me.TimerEnabled = 1
OnScoreboardChanged
End If
End Sub
 
the id 101, 102, 103 and 105 are the ones which will communicate with DOF if the cGameName matches one entry in the configtool as explained above, and if the ids are mapped in the config of that table, like this in this case
 
why do we start at 101? because we usually expect the first numbers are used for lamp interactions in the backglass, as the DOF method uses the same method that the backglass events, (Controller.B2SSetData)
 
for the flippers we need to activate the effect when we press the flipper button (DOFOn) and deactivate when we release the button (DOFOff)
 
for the slinghots, we just need to pulse the slingshot contactor so we just use a DOFPulse which will do an immediate ON OFF effect 
 
467756dof.png
 
Flippers :  
 
Sub SolLFlipper(Enabled)
    If Enabled Then
        PlaySound SoundFXDOF("fx_flipperup", 101, DOFOn, DOFFlippers)
        LeftFlipper.RotateToEnd
    Else
        PlaySound SoundFXDOF("fx_flipperdown", 101, DOFOff, DOFFlippers)
        LeftFlipper.RotateToStart
    End If
End Sub
 
Sub SolRFlipper(Enabled)
    If Enabled Then
        PlaySound SoundFXDOF("fx_flipperup", 102, DOFOn, DOFFlippers)
    Else
        PlaySound SoundFXDOF("fx_flipperdown", 102, DOFOff, DOFFlippers)
        RightFlipper.RotateToStart
    End If
End Sub

 

Configtool

E101 goes to Flipper Left 

E102 goes to Flipper Right


Edited by arngrim, 23 April 2017 - 05:11 PM.


#2 bord

bord

    Enthusiast

  • Members
  • PipPipPip
  • 296 posts

  • Flag: ---------

  • Favorite Pinball: Star Gazer, Whirlwind, Frontier

Posted 25 April 2016 - 02:21 PM

Glad this is a part of the DOF discussion. Chimes and a bell are my must-have items for a virtual cabinet. :tup:



#3 jipeji16

jipeji16

    Hobbyist

  • Members
  • PipPip
  • 36 posts

  • Flag: France

  • Favorite Pinball: Creature from the black lagoon

Posted 13 November 2017 - 06:03 PM

Thank you Arngrim for all those informations !!!!! ;) ;) ;) ;) :otvclap: