'#################### PINEVENT - DOF: STARTUP & CONTROL ###################
' By Nailbuster and TerryRed
' Version: 2.0
' April - 2022
' This is used for the startup and control of DOF (Direct Output Framework)
Dim DOF_Status:DOF_Status=false
Dim DOFObject
Dim DOF_romname
Dim DOF_Debug_enabled: DOF_Debug_enabled = false
Sub DOFStart(DOF_RomConfig) 'Start DOF Session
if DOF_Status=true then Exit Sub
if DOF_enabled=true Then
Set DOFObject = CreateObject("DirectOutput.ComObject")
If DOFObject is Nothing Then
AddDebugText "DOF is not installed or is not accessable"
DOF_enabled=false
DOF_Status=false
else
DOFObject.Init "B2SServer","",DOF_RomConfig
DOF_Status=true
AddDebugText "Start DOF with config: " & DOF_RomConfig
end if
End if
end sub
Sub DOFClose() 'PinEvent - Close out DOF session. Add this to FuturePinball_EndPlay()
if DOF_Status=false then Exit Sub
DOF_Status=false
DOFObject.Finish()
Set DOFObject=nothing
end sub
Sub dof(dID,dValue)
if DOF_Status=false then Exit Sub
if dValue=0 Then DOFObject.UpdateNamedTableElement "E"&dID,0: if DOF_Debug_enabled = true then AddDebugText "DOF E"&dID&" 0"
if dValue=1 Then DOFObject.UpdateNamedTableElement "E"&dID,1: if DOF_Debug_enabled = true then AddDebugText "DOF E"&dID&" 1"
if dValue=2 Then
DOFObject.UpdateNamedTableElement "E"&dID,1
DOFObject.UpdateNamedTableElement "E"&dID,0
if DOF_Debug_enabled = true then AddDebugText "DOF E"&dID&" 2"
End If
end Sub
' Usage: dof(dID,dValue)
' dID = DOF Exxx trigger
' dValue = trigger action. 0 = off, 1 = on, 2 = pulse
' Example:
' dof 103,1
' The above example will trigger DOF event E103 as ON
'############### PINEVENT - DOF: STARTUP & CONTROL - END #################