Skip to content

Commit

Permalink
- Added /btnexec "Set" Index which allows you use use buttons from mq…
Browse files Browse the repository at this point in the history
…2custombinds
  • Loading branch information
DerpleMQ2 committed Mar 31, 2024
1 parent 17e1243 commit 8506ccd
Showing 1 changed file with 38 additions and 12 deletions.
50 changes: 38 additions & 12 deletions init.lua
Expand Up @@ -10,24 +10,25 @@
Shwebro, Kevbro, RYN
--]]
local version = "2.3"
local mq = require('mq')
local version = "2.3"
local mq = require('mq')
ButtonActors = require 'actors'
Icons = require('mq.ICONS')
BMSettings = require('bmSettings').new()
BMEditPopup = require('bmEditButtonPopup')
ButtonActors = require 'actors'
Icons = require('mq.ICONS')
BMSettings = require('bmSettings').new()
BMEditPopup = require('bmEditButtonPopup')
local BMHotbarClass = require('bmHotbarClass')
local btnUtils = require('lib.buttonUtils')
local BMHotbarClass = require('bmHotbarClass')
local btnUtils = require('lib.buttonUtils')
local BMButtonHandlers = require('bmButtonHandlers')
-- globals
BMHotbars = {}
BMReloadSettings = false
BMUpdateSettings = false
BMHotbars = {}
BMReloadSettings = false
BMUpdateSettings = false
-- [[ UI ]] --
local openGUI = true
local openGUI = true
-- binds
local function BindBtn(num)
Expand All @@ -37,6 +38,30 @@ local function BindBtn(num)
end
end
local function BindBtnExec(set, index)
if not set or not index then
btnUtils.Output("\agUsage\aw: \am/btnexec \aw<\at\"set\"\aw> \aw<\atindex\aw>")
return
end
index = tonumber(index) or 0
local Button = BMSettings:GetButtonBySetIndex(set, index)
if Button.Unassigned then
btnUtils.Output("\arError\aw: \amSet: \at'%s' \amButtonIndex: \at%d \awIs Not Assigned!", set, index)
for s, data in pairs(BMSettings:GetSettings().Sets) do
btnUtils.Output("\awSet: \at%s", s)
for i, b in ipairs(data) do
btnUtils.Output("\t \aw[\at%d\aw] \am%s", i, b)
end
end
return
end
btnUtils.Output("\agRunning\aw: \amSet: \at%s \amButtonIndex: \at%d \aw:: \at%s", set, index, Button.Label)
BMButtonHandlers.Exec(Button)
end
local function ButtonGUI()
if not openGUI then return end
if not BMSettings:GetCharConfig() then return end
Expand Down Expand Up @@ -156,5 +181,6 @@ end
-- Make sure to start after the settings are validated.
mq.imgui.init('ButtonGUI', ButtonGUI)
mq.bind('/btn', BindBtn)
mq.bind('/btnexec', BindBtnExec)
GiveTime()

0 comments on commit 8506ccd

Please sign in to comment.