# DOF Events

If DOF is installed on your system, PinballY generates DOF events to trigger effects from your feedback devices (such as solenoids and flasher lights). This will fire flashers and other devices on certain events, such as when you switch between tables in the table list.

DOF integration is automatic. To take advantage of it, just make sure that DOF is installed and that your .ini files from the DOF Config Tool are up to date. The PinballY definitions were added to the Config Tool database in late July 2018, so you'll need to generate and download fresh copies if your current .ini files are older than that.

You can disable PinballY's DOF usage entirely via the DOF Options page in the Settings dialog.

## DOF setup

If you use a "cabinet config" file with DOF, it's important to create a DOF global config file for PinballY. DOF uses a separate global config file for each program. The DOF global config file for PinballY is called GlobalConfig_PinballY.xml.

The easiest way to create the PinballY global config is to copy your existing global config for B2SServer:

- Open your main DOF install folder
- Open the Config subfolder
- Make a copy of GlobalConfig_B2SServer.xml
- Rename the copy GlobalConfig_PinballY.xml

In the future, if you make any changes to any of your global config files, remember to make the same changes to your GlobalConfig_PinballY.xml file while you're at it.

If you don't create a GlobalConfig_PinballY.xml file, DOF will just use its default settings for PinballY. That's fine if you don't need any custom settings, but it's not fine if you need a cabinet config file, since the DOF default is that there is no cabinet config file. The cabinet config file is important if you have devices that DOF can't discovery by scanning your system, particularly addressable LED strips. If you have LED strips and they don't seem to work in PinballY, the problem might be a missing global config file for PinballY.

## Customizing DOF effects

You can customize all of PinballY's DOF effects via the DOF Config Tool.

The Config Tool's database includes a predefined set of effects for PinballY, so you don't have to do anything to use the standard effects other than making sure your .ini files are up-to-date. If you want to customize anything, though, the Config Tool lets you override any of the default effects with your own custom settings.

Here's how you can access the PinballY settings in the Config Tool:

- In your Web browser, open the DOF Config Tool
- Log in
- Click Table Configs in the top navigation bar
- Select PinballY from the Table Names drop list

All of the PinballY DOF effects are defined under this "PinballY" pseudo-table. As far as DOF is concerned, PinballY is just another pinball table.

PinballY's entries in the Config Tool follow the standard format defined by DOF. That standard format is unfortunately rather obtuse and difficult to read, and it's beyond the scope of what we can explain here, but you can find documentation on it in the DOF user guide. What we will give you is a list of the special event names and state names that PinballY generates.

Note that all named effects in the Config Tool are specified with a $ prefix, so remember to add that to the names in the lists below. For example, you'd write $PBYWheelNext in the Config Tool field if you want something to trigger on a "wheel next" event.

@allrgb@: There's one special bit of Config Tool syntax that's worth mentioning, because it's a special Config Tool feature that isn't part of DOF. If you put @allrgb@ in one of the toy fields, the Config Tool expands this to a list of the settings for that toy for all of the individual tables throughout the rest of the database. This translates to showing the same colors on that device that would be shown if you were actually playing the game. For example, putting @allrgb@ in the "RGB Flippers" field makes the flipper buttons light up in the colors for whichever table is currently selected in the PinballY wheel display. This only applies to RGB toys.

### Events

Each time something DOF-worthy happens in the PinballY user interface, PinballY fires a named DOF event. For example, when you press the Next button (usually the right flipper button) to switch to the next game, PinballY fires a PBYWheelNext event.

Here's a list of the events that PinballY fires:

- PBYAttractA1 through PBYAttractA5: When attract mode is running, these events are fired in order (1 through 5) at 1-second intervals. After reaching 5, the counter loops back to 1. This can be used to create a series of events that runs on a 5-second loop.
- PBYAttractB1 through PBYAttractB60: When attract mode is running, these events fire in order (1 through 60) at 1-second intervals, looping back to 1 after reaching the last event. This can be used to create a series of events that runs on a 60-second loop.
- PBYAttractR1 through PBYAttractR5: When attract mode is running, these events fire in random sequence and at random intervals. These can be used for effects that you want to fire randomly when attract mode is active.
- PBYAttractWheelNext: Attract mode is running and automatically switched to a new game
- PBYEndGame: The current running game has ended
- PBYFlipperLeft: The left flipper button (or whichever key is assigned as the Previous button) was pressed
- PBYFlipperRight: The right flipper button (or whichever key is assigned as the Next button) was pressed
- PBYFlyer: The Flyer command was selected, to display the current game's flyer as a popup window
- PBYGameInfo: The Information command was selected, to display the pop-up information box for the current game
- PBYGameSelect: A new game was selected
- PBYHighScores: The High Scores command was selected, to display the pop-up high score box for the current game
- PBYInstructions: The Instructions command was selected, to display the current game's instruction card as a popup window
- PBYLaunchGame: A game is being launched. This fires at the start of the launch process, just after the user selects the launch command, before the new game program has been loaded. Note that any device effects associated with this event might be cut off after a short time, because PinballY has to disconnect from DOF before the new game starts, to allow the game to take over the feedback devices. DOF turns off all devices when the program disconnects.
- PBYMagnaRight: The right MagnaSave button (or whichever key is assigned as the Next Page button) was pressed
- PBYMagnaLeft: The left MagnaSave button (or whichever key is assigned as the Previous Page button) was pressed
- PBYMenuDown: The user navigated to the next item in a menu
- PBYMenuOpen: A new menu was opened
- PBYMenuSelect: A command was selected in a menu (this usually means that the "Start" button, or whichever key is assigned as the Enter/Select command key, was pressed)
- PBYMenuUp: The user navigated to the previous item in a menu
- PBYQuit: A menu was closed
- PBYScreenSaverStart: Attract mode (the "screen saver" mode) is starting
- PBYScreenSaverQuit: Attract mode is exiting
- PBYWheelNext: The user navigated to the next game in the wheel
- PBYWheelNextPage: The user navigated to the next "page" (the next alphabetical letter group) in the wheel
- PBYWheelPrev: The user navigated to the previous game in the wheel
- PBYWheelPrevPage: The user navigated to the previous "page" (the previous alphabetical letter group) in the wheel

### States

In addition to events, PinballY has "states". These differ from events only in that states are long-lasting. An event fires briefly, usually triggering a quick event in DOF, such as flashing the flashers or firing a flipper solenoid. A state turns on and stays on for an extended period. States tell DOF the current context in the UI: showing a game in the wheel interface, showing a menu, running the "attract mode" screen saver, and so on.

- PBYMenu: A menu is being displayed
- PBYScreenSaver: Attract mode is active
- PBYStartupVideo: The startup video is playing
- PBYWheel: This is the default state, where the "wheel" interface is displayed with no menus or popups active

### Current ROM name

In addition to the PBYxxx states, PinballY also turns on a named event with the same name as the ROM for the table currently selected in the wheel display. For example, PinballY turns on the named effect MM when Medieval Madness is currently selected in the wheel. This lets you trigger effects that depend on which table is selected. The @allrgb@ syntax described above uses this to select device colors according to the selected table, but you can also use it explicitly for individual effects. The ROM names match the names in the Config Tool, which you can see listed on the Table Config page (look for "Rom: XXX" near the top of the page).