Myslot

Myslot

2M Downloads

How to swap profile using a macro?

fisken1991 opened this issue · 7 comments

commented

Hello, great addon!

Can i write a macro that can load a myslot profile?
That also "Clear macro before applying" ?

For example somesthing like this:
/myslot ClearMacro
/myslot load GuardianAOE

Best regards

commented

theorical doable
i will test to see if blz has some limit, typically, it requires hardware event (such as mouse click).
but macro generally requires a click

commented

Hi tg123!

Your addon has been a blessing in the past 3 months especially for copying over my live server settings to the PTR!

Did you try it out if you can just have a macro command for profile application? It would be such a nice QoL feature for me cause when playing my frost alt that has a tank offspec I use 2 diff profiles for each spec since I run out of personal macro space 😓
I have a macro that just swaps spec

/run SetActiveTalentGroup(1)
/run SetActiveTalentGroup(2)

and then use your addon to import the macros and action bar bindings for the spec. But it already happened to me that I overwrote my tank profile with my dps one. So a option to have a macro command with the spec swap would be really poggers.
Would be nice if you could comment on that.

Cheers! 🍻

commented

I will check if I can make it work with macro

commented

I'm a bit late to the party, but I've had the same issue and managed to work around with this modification of the slash function

SlashCmdList["MYSLOT"] = function(msg, editbox)
    local cmd, what = msg:match("^(%S*)%s*(%S*)%s*$")

    if cmd == "load" then
        MySlot:Print(L["Myslot Load " .. what])

        if not MyslotExports then
            MyslotExports = {}
        end
        if not MyslotExports["exports"] then
            MyslotExports["exports"] = {}
        end
        local exports = MyslotExports["exports"]

        for i, profile in ipairs(exports) do
            --MySlot:Print(L["profile " .. profile.name])
            if profile.name == what then

                MySlot:Print(L["Profile to load found : " .. profile.name])
                local msg = MySlot:Import(profile.value, { force = false })

                if not msg then
                    return
                end

                MySlot:RecoverData(msg, {
                    ignoreAction = false,
                    ignoreBinding = false,
                    ignoreMacro = false,
                    clearAction = false,
                    clearBinding = false,
                    clearMacro = false,
                })
            end
        end

    elseif cmd == "clear" then
        -- MySlot:Clear(what)
        InterfaceOptionsFrame_OpenToCategory(L["Myslot"])
        InterfaceOptionsFrame_OpenToCategory(L["Myslot"])
    elseif cmd == "trim" then
        if not MyslotExports then
            MyslotExports = {}
        end
        if not MyslotExports["exports"] then
            MyslotExports["exports"] = {}
        end
        local exports = MyslotExports["exports"]
        local n = tonumber(what) or MAX_PROFILES_COUNT
        n = math.max(n, 0)
        while #exports > n do
            table.remove(exports, 1)
        end
        C_UI.Reload()
    else
        f:Show()
    end
end

And then we can pilot myslot with the command 'load' and put macros in our profile to swap.
i.e

/myslot load Voomlz
commented

Do i put this code in myslot.lua?

I'm a bit late to the party, but I've had the same issue and managed to work around with this modification of the slash function

SlashCmdList["MYSLOT"] = function(msg, editbox)
    local cmd, what = msg:match("^(%S*)%s*(%S*)%s*$")

    if cmd == "load" then
        MySlot:Print(L["Myslot Load " .. what])

        if not MyslotExports then
            MyslotExports = {}
        end
        if not MyslotExports["exports"] then
            MyslotExports["exports"] = {}
        end
        local exports = MyslotExports["exports"]

        for i, profile in ipairs(exports) do
            --MySlot:Print(L["profile " .. profile.name])
            if profile.name == what then

                MySlot:Print(L["Profile to load found : " .. profile.name])
                local msg = MySlot:Import(profile.value, { force = false })

                if not msg then
                    return
                end

                MySlot:RecoverData(msg, {
                    ignoreAction = false,
                    ignoreBinding = false,
                    ignoreMacro = false,
                    clearAction = false,
                    clearBinding = false,
                    clearMacro = false,
                })
            end
        end

    elseif cmd == "clear" then
        -- MySlot:Clear(what)
        InterfaceOptionsFrame_OpenToCategory(L["Myslot"])
        InterfaceOptionsFrame_OpenToCategory(L["Myslot"])
    elseif cmd == "trim" then
        if not MyslotExports then
            MyslotExports = {}
        end
        if not MyslotExports["exports"] then
            MyslotExports["exports"] = {}
        end
        local exports = MyslotExports["exports"]
        local n = tonumber(what) or MAX_PROFILES_COUNT
        n = math.max(n, 0)
        while #exports > n do
            table.remove(exports, 1)
        end
        C_UI.Reload()
    else
        f:Show()
    end
end

And then we can pilot myslot with the command 'load' and put macros in our profile to swap. i.e

/myslot load Voomlz

Do i put this code in Myslot.lua ?

commented

In the file gui.lua, you replace the SlashCmdList["MYSLOT"] = function(msg, editbox) function line 484 with this.

I attached the zip of my modified myslot (tested only on classic era) if it makes your life easier.

Myslot.zip

Also would need your profiles be named in a single word (no spaces)

commented

fixed by #41