PinUP Table Script support/tips/tricks

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #70769
    NailBuster
    Moderator
      @nailbuster

      Remember that PinUp Player has two methods of driving video content during gameplay.

      Method 1>  Using Table script that will call directly to the PinUp Display com object.  This involves modifying the tables (with permissions from table authors) and gives you complete control of the PinUp Displays.  This is more advanced and you should be comfortable with table mods/scripts to use this method.  Original Tables should use this method.

      Method 2>  Using the B2S Plugin driver for PinUP.  This allows you to use the GUI tool to setup your PinUP Videos.  See the youtube video on a sample of how easy(I think) it is to work with.

      When working any ROM table you need to know the limitations of ROM tables.  We only get to ‘know’ what is going on with gameplay through Switches, Solenoids, Lights being turned on/off.  We won’t be able to say “hey I want to play this during multiball”….we have to ‘hack’ our way into finding out what lights and events get fired during gameplay to make sense of stuffs.

      For original tables you can do a lot of things, and its probably best for original tables to just modify in script and not use the B2SPlugin method.

      I’ll have our expert Terry explain some of his workings with the ‘showcase’ PinUp Tron Table he released…

       

      1 user thanked author for this post.
      #70848
      TerryRed
      Moderator
        @terryred

         

        UPDATE: This post is VERY out of date! PuP has changed a lot since this post and table mod was made. PuP-Packs, the PuP-Pack Editor and many others things have come along that make doing things much easier and also to provide far more functionality. This post only remains here as a historical reference… NOT an up to date method for adding PUP support to a table!

         

        Ok, so I’ll just share some tidbits I’ve learned when doing the Tron Legacy PuP Edition. The first and foremost thing to remember is that PuP is using VLC media Player to playback videos. It can only do what VLC can do with files. So PuP doesn’t know when a file has finished playing for example, or if you set playback to be in a Loop, PuP won’t know to only apply that Loop to that one file,etc…

        This post is info for creating a PuP VPX table “Mod” using direct PuP script commands, and not for creating a PuPB2S!

        KNOW YOUR TABLE:

        First, you need to know the table you are modding fairly well. You need to know its rules, what switches, lights, solenoids it uses, and how it uses those things. Some of this info you can get from the table itself in the editor, or script, or from the manual of the real pinball machine. You can also try Google searching for a Rules guide at Pinball News like this one for Tron Legacy:

        http://www.pinballnews.com/games/tron/index6b.html

        One thing that helped me learn how a table plays is using the “manual ball controller mod”:

        https://vpinball.com/adding-manual-ball-control-to-your-vpx-table/

        This will allow you to manually move the ball around to test with. Some tables will crash when a ball is “destroyed” in the table script, so keep this in mind when using it. (for Tron, it would crash if I went into the Arcade kicker with “Manual Ball Control” enabled.)  Just make sure you have this mod removed completely when you are done, as it can cause problems for some other people’s configurations.

        CREATE VIDEO FOLDERS FOR PLAYLISTS:

        Create a new folder in the “PuPVideos” folder, of the table name you want to use with PuP. This name should be different than the table’s “rom” name. For example, I used “Tron_Legacy” instead of “trn_174h”. The rom name, or cGameName is specifically going to be used by PuP for a PuPB2S (which we aren’t using here). You don’t want to have both running at the same time!

        Once you have figured out what main table “events” or “actions” you want to add videos to… create a folder for each of them in your “PuPVideos/TableName” folder. This will allow you add or remove as many videos as you want without needing to update the table code later on. Then try getting at least one video to use for each one for testing.

        SETUP PINUP PLAYER IN TABLE SCRIPT:

        So now you want to setup the table to Initiate PinUp Player, and to declare your video folder / playlists. We do this at the beginning of the script. Follow the instructions NailBuster has given for doing this. I’ll point out some specifics I used for Tron. (This is not all of the Initialization code required!)

        PuPlayer.Init 0,”Tron_Legacy”
        PuPlayer.Init 2,”Tron_Legacy”

        The INIT command Initializes PinUP Player when the table first loads. You need to do this for each “PuP Screen” you want to use. It associates the “TableName”, in this case “Tron_Legacy”, with the screen you specified. (O=Topper, 2=Backglass). When the table loads, PuP will look for PuPVideos\Tron_Legacy. If it doesn’t find this folder, then it will create an empty folder with that name. This is the “root” folder for this table.

        PuPlayer.SetScreenex 2,0,0,0,0,1 ‘Set PuPlayer Backglass to Pop-Up On <screen number> , xpos, ypos, width, height, POPUP
        PuPlayer.SetScreenex 0,0,0,0,0,1 ‘Set PuPlayer Topper to Pop-Up On <screen number> , xpos, ypos, width, height, POPUP

        Setscreenex can be used to specifically setup your PuP screens uniquely for this table only, and will not use PuP’s Default settings. For your xpos, ypos, width, height, if you enter 0, then PuP will use PuP’s Default settings. PoP-UP can be turned on or off as well. Setscreenex is not required, but you can always add it into a script for optional screen settings for this table only.

        ‘Backglass Screen (2) playlist videos

        PuPlayer.playlistadd 2,”Gem”, 0 , 1
        PuPlayer.playlistadd 2,”Clu”, 1 , 2
        PuPlayer.playlistadd 2,”CluMode”, 1 , 2
        PuPlayer.playlistadd 2,”Quorra”, 0 , 2

        ‘Topper Screen (0) playlist videos
        PuPlayer.playlistadd 0,”ZuseZ”, 1 , 1
        PuPlayer.playlistadd 0,”ZuseU”, 1 , 1
        PuPlayer.playlistadd 0,”ZuseS”, 1 , 1
        PuPlayer.playlistadd 0,”ZuseE”, 1 , 1

        Declare your playlists for each PuP screen. You may need to adjust your Rest Seconds later on (the time you must wait for the next video to play). Try to have all the videos in a Playlist folder be at around the same length, and adjust your Rest Seconds to accommodate.

         

        CREATE PUP CODE SECTION, AND SUB-ROUTINES FOR EACH “PUP EVENT”

        While you can use PuP commands throughout the table’s script, I recommend creating a main “PinUP Player” section for all your PuP related code. This will make it much easier to keep everything organized. Then, for every “PuP Event” (Playlist folder), you create a new sub routine labelled something like PUP_PuPEvent” to match your Playlist. Then you can add whatever PuP commands and code you want to each “PUP_” subroutine without making a mess of the rest of the script. A simple example (compared to what I actually used in Tron):

        Sub PUP_Zuse_Z
        if HasPuP Then
        PuPlayer.playlistplayex 0,”ZuseZ”,””,100,0
        End If
        End Sub

        Then to run the “PUP_” sub-routine you simply use the name of the PuP_ sub-routine, wherever in the script you want it to play. So in this example, if the Zuse “Z” target switch is hit (sw7), then the PUP_Zuse_Z sub-routine will be run.

        Sub sw7_Hit
        Me.TimerEnabled = 1
        sw7p.TransX = -2
        vpmTimer.PulseSw 7
        PlaySoundAt SoundFX(“fx_target”,DOFContactors),sw7p
        PUP_Zuse_Z
        End Sub

         

        PinUP PLAYER BASIC COMMANDS:

        The main PuP playback commands you will use are:   PuPlayer.playlistplayex and PuPlayer.playlistplay. An example of each:

        PuPlayer.playlistplay 2,(“Gem”)

        This will play a video from the Playlist folder of Gem on the Backglass screen. The video will play to it’s end and won’t allow another PuPlayer.playlistplay command to play a video until it’s Rest Seconds (declared in PuPlayer.playlistadd 2,”Gem”, 0 , 1)  are done.

        PuPlayer.playlistplayex 0,”ZuseZ”,””,100,0

        This will play a video from the Playlist folder of ZuseZ. This command will override any video currently playing on the Topper screen with the same Priority or Lower. It doesn’t matter what Rest Seconds the previous video has set. This kind of command is useful for something like a Drain, other event that you want to use to stop other videos currently playing with another media file (audio or video). It’s recommended that you DO NOT refer to a single specific file in the Playlist, but instead just use “” to play the next file in the Playlist.

        SetLength and SetLoop commands. Examples:

        PuPlayer.playlistplayex 0,”LightCycleMBInfo”,””,100,4
        PuPlayer.SetLength 0,8
        PuPlayer.SetLoop 0,1

        This will play the next file in the LightCycleMBInfo Playlist on the Toppers screen with a Priority of 4.  Then it will set the playback length of the file being played on the Toppers screen to 8 secs using SetLength. Then it will turn on Loop for the file currently playing on the Topper screen using SetLoop. Note: that the Loop will still be enabled if another file on the same screen is played. You need to issue a PuPlayer.SetLoop 0,0 command to disable it.

         

        This is the main basics for PinUP Player. There is more involved if you wish to add more controlling options to the table using Timers, “PuP_” variables, and new triggers.

         

         

         

        2 users thanked author for this post.
        #70858
        TerryRed
        Moderator
          @terryred

          USING SWITCHES TRIGGERS AND SOLENOIDS:

          Reacting to switches, solenoids, lights, and triggers are the only means of control you have to start PuP video when dealing with a rom based table. As demonstrated before, you can simply use one of your “PUP_” sub-routines to react to a Switch being hit. Look in the table script to see if there is already a “Sub xxx_hit” for the switch, or trigger you want to use.

          Sub sw7_Hit
          Me.TimerEnabled = 1
          sw7p.TransX = -2
          vpmTimer.PulseSw 7
          PlaySoundAt SoundFX(“fx_target”,DOFContactors),sw7p
          PUP_Zuse_Z
          End Sub

          If there isn’t, then you can simply make your own sub-routine for that switch / trigger being “_Hit”. All of the above also applies to solenoids and switches that are “_UNHIT” as well.

          You can also use the logic or state that each solenoid, switch, trigger and lights are in to control PuP as well, depending on the table.

          If sw29 =1 Then PuPlayer.playlistplay 2,(“Recognizer”)

          If PUP_Quorra_Spinner_Trigger=True Then PuPlayer.playlistplay 2,(“Quorra”)

          If l29=1 Then PuPlayer.playlistplayex 2,”LightCycleMBLit”,””,100,10

           

          LIGHTS…”BANKING”….  OH CRAP…

          Lights are a great source to use for rom based tables to trigger PuP videos…but they can be a real pain as well. It’s just the nature of dealing with PinMAME rom tables. VPX and B2S has no way of knowing that a light is “blinking” or “ON” or “OFF”.  They simply “react” to whatever state the rom sends (on / off), and the rom can be changing that many times per second. (Whereas on FP, and maybe a VPX original you can use Light States to control anything)

          So if I hit a trigger and wanted to play a video based on a certain light being on…if the light that was “blinking” isn’t on at that exact moment, then it won’t work. I had this same issue when trying to have the neon ramps trigger addressable led colours to match the table. By the time the trigger would happen, the light state or neon ramp colour would either be off (no trigger) or constantly changing (lots of triggers).

          I basically would monitor all the PF lights, and neon ramp colours, in real-time, and create a “bank” for each one. If its blinking then each time its ON I would add +50 (or whatever was needed) to the bank, and if its Off I would subtract a smaller amount from the bank (to allow it to stay positive for a “blink”).  I would also set a max + and max – so the values could be controlled within reason and need timing. If its always On or Off well then the values get maxed out + or – either way.

          Then when I would trigger a PUP event, I would check the “bank” of the required light and neon ramp colour to do part of the controlling. However this part REQUIRES the use of Timers as well to make it all sync up for certain conditions to work. So I would need to “delay” the “bank check” of the lights and conditions needed by 100ms up to 3500ms, depending on the trigger and event.

          Since I only had the lights of the table to go by….  in terms of “multiball is lit”, “jackpot”, and specific videos for certain modes on the same ramps or orbits….well without Timers and “light banking”, those parts would be impossible with just B2S / DOF trigger conditions that you use for PuPB2S. I have the same limitation when doing DOF MX Leds for VPX.

          CREATE YOUR OWN LIGHT_CHECK TIMER, and LIGHT BANKING CODE:

          Some tables will have a real-time light monitoring sub-routine that checks for light status…other won’t. You can always just create your own Timer (that is always enabled and cycles very quickly) and create a sub-routine for that Timer that will create the “Light Status Bank” for each light. A sub-routine that will be run every time a Timer is executed will be “TimerName_Timer()”. An example of Light Banking with a Timer named “PUP_LightStatus_Check”:

          First you need to declare the variable for the PUP_Light you want to set a Bank value to. That is Dim PUP_ExtraBall_Light.  Then you want to set that to = 0 for the first time the table starts. You need these to be outside of any other sub-routine.

          Dim PUP_ExtraBall_Light
          PUP_ExtraBall_Light=0

          Every time the Timer expires, this will check the status of Light 37 and add to it’s BANK every time it’s ON, or subtract from it every time its OFF. I set a MAX + amount and a MAX – amount.

          Sub PUP_LightStatus_Check_Timer()
          if l37.State=1 then PUP_ExtraBall_Light = PUP_ExtraBall_Light + 10
          if l37.State=0 then PUP_ExtraBall_Light = PUP_ExtraBall_Light – 2
          if PUP_ExtraBall_Light > 300 then PUP_ExtraBall_Light = 300
          if PUP_ExtraBall_Light < 0 then PUP_ExtraBall_Light = 0
          End Sub

          Now you can use the PuP_Light and its BANK amount to determine if it’s light is ON for a minimum amount of time when your PuP video trigger is enabled. This is needed as the light may be off right when you check it, if it’s blinking. Some lights will be ON or blinking when your trigger needs to check them. That’s easy. If they however turn Off (no blinking) at the moment you check them, then that’s where you need to have the BANK’d amount for the Light to do your check.  Other times it may be the opposite, and a Light will only come on AFTER your trigger needs to do the check. This is where you need to use a Timer to delay the check so the Light will have enough in its BANK.  Sounds complicated? You bet…and I had to use all of the above for Tron Legacy PuP Edition to work for multi-ball, jackpots,etc.  :(

          Here are examples of PuP_Light checks using additional PUP_ variables for control to start Light Cycle MB:

          If PUP_LC_MB_Light >= 10 Then PUP_LC_MB_Lit=True

          if PUP_Ramp_Yellow >=10 and PUP_LC_MB_Lit=True and PUP_Clu_Lit=False Then
          PuPlayer.playlistplayex 2,”LightCycleMB”,””,100,4
          PuPlayer.playlistplayex 0,”LightCycleMBInfo”,””,100,4
          PuPlayer.SetLength 0,8
          PuPlayer.SetLoop 0,1
          PUP_LC_MB_Lit=False
          PUP_LightCycleMB_Active=True
          End if

          You can use all of the above examples combined with your own methods of control through the use of PUP_ variables and PUP_ Timers to control more aspects of what you want to do. It’s daunting at first…hell I’m not really a programmer and never touched VB until 1 year ago! I’m sure the smarter guys out there will have more efficient methods to do this then I did. With some time and patience you can do some really cool things with PuP combined with these great VPX tables!

          2 users thanked author for this post.
        Viewing 3 posts - 1 through 3 (of 3 total)

        Forums are currently locked.

        ©2024 VPinBall.com

        Log in with your credentials

        Forgot your details?