Hi there. I first tried the original plugin but then wanted to try the Lua version so I could customize. I feel pretty confident I followed you pretty well watching your video but for some reason I can't figure out, nothing happens when I press the buttons on the controller. I have the plugin active and can see the buttons are working using the register diagnostics. Maybe I'm missing some other setting? Here's what I have so far in the enabled and hidden Lua panel. Any help would be greatly appreciated.
-------------------------------------------------------
-- X_360 Lua by DazTheGas
-------------------------------------------------------
-------------------Declares
local mInst = mc.mcGetInstance()
local mInst = mc.mcGetInstance()
local Xenabled = false
local ESSTate = false
-- X360 Init Panel
X360_Panel = wx.wxPanel(wx.NULL, wx.wxID_ANY, wx.wxDefaultPostion, wx.wxDefaultSize)
X360_Timer = wx.wxTimer(X360_Panel)
X360_Timer:Start(100)
-- EStop
Estop_Panel = wx.wxPanel(wx.NULL, wx.wxID_ANY, wx.wxDefaultPostion, wx.wxDefaultSize)
Estop_Timer = wx.wxTimer(Estop_Panel)
EStop_Timer:Start(50)
-------------------Functions
function SetXin(xinput)
local hreg = mc.mcRegGetHandle(mInst, string.format("mcX360_LUA/%s", xinput))
mc.mcRegSetValueLong(hreg, speed)
end
-------------------Event Timers
X360_Panel:Connect(wx.wxEVT_TIMER, function (event)
if GetXin("LTR_Val") > 150 and Xenabled == 0 then
EStop_Timer:Start(50)
Xenabled = 1
mc.mcCntlSetLastError(mInst,"X_360 Running")
elseif GetXin("LTR_Val") < 50 and Xenabled == 1 then
EStop_Timer:Stop()
Xenabled = 0
mc.mcCntlSetLastError(mInst,"X_360 Stopped")
end
end)
EStop_Panel:Connect(wx.wxEVT_TIMER, function (event)
if GetXin("Btn_B") == 1 and ESSTate == false then
local Estop = mc.mcSignalGetState (mc.mcSignalGetHandle (mInst, mc.ISIG_EMERGENCY))
if (EStop == 1) then
mc.mcSignalSetState (mc.mcSignalGetHandle (mInst, mc.ISIG_EMERGENCY), 0)
else
mc.mcSignalSetState (mc.mcSignalGetHandle (mInst, mc.ISIG_EMERGENCY), 1)
end
ESState = true
end
if GetXin("Btn_B") == 0 and ESState == true then
ESState = false
end
end)