WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Script to auto set SexyMap to Global Profiles? (https://www.wowinterface.com/forums/showthread.php?t=44745)

Mayron 10-12-12 02:47 PM

Script to auto set SexyMap to Global Profiles?
 
My setup addon uses a reflux command to set each individual addon to the correct profiles with one click however the Minimap addon called SexyMap has changes how its profiles work with the newest update:



Is it possible to add some lines of lua script to my addon so that the Global Profiles option becomes active so it sets it up automatically as well? The reason for this is that because of the change, SexyMap no longer loads automatically which can be a pain since I do not want multiple profiles for each separate character.

I looked in the SexyMap.lua files and at line 187 it says the same message that you get when trying to activate the global profile option:

Code:

                globalProf = {
                        order = 17,
                        type = "toggle",
                        name = L["Use Global Profile"],
                        width = "full",
                        confirm = function(info, v)
                                if v and SexyMap2DB.global then
                                        return L["A global profile already exists. You will be switched over to it and your UI will be reloaded, are you sure?"]
                                elseif v and not SexyMap2DB.global then
                                        return L["No global profile exists. Your current profile will be copied over and used as the global profile, are you sure? This will also reload your UI."]
                                elseif not v then
                                        return L["Are you sure you want to switch back to using a character specific profile? This will reload your UI."]
                                end
                        end,
                        get = function()
                                local char = (UnitName("player").."-"..GetRealmName())
                                return type(SexyMap2DB[char]) == "string"
                        end,
                        set = function(info, v)
                                local char = (UnitName("player").."-"..GetRealmName())
                                if v then
                                        if not SexyMap2DB.global then
                                                SexyMap2DB.global = mod.deepCopyHash(SexyMap2DB[char])
                                        end
                                        SexyMap2DB[char] = "global"
                                        ReloadUI()
                                else
                                        SexyMap2DB[char] = nil
                                        ReloadUI()
                                end
                        end,
                },

Not sure if that helps at all. Thank you in advanced! :) Would be great to finally be able to use this addon again.

Phanx 10-13-12 03:52 AM

Assuming you have already set up the global profile, this should work:

Code:

/run SexyMap2DB[UnitName("player").."-"..GetRealmName()] = "global"; ReloadUI()
Though I have no idea why SexyMap is butchering the profile system that way instead of working like every other addon. :(

Alternatively, you could just use Reflux's "emulate profiles" feature to save the whole SexyMap2DB saved variables table. You'd probably still need to reload the UI afterwards, though, since SexyMap doesn't appear to have any code to support switching profiles on the fly.

Another option you might want to consider would be to use another minimap addon.

Mayron 10-13-12 05:10 AM

Quote:

Originally Posted by Phanx (Post 266614)
Assuming you have already set up the global profile, this should work:

Code:

/run SexyMap2DB[UnitName("player").."-"..GetRealmName()] = "global"; ReloadUI()
Though I have no idea why SexyMap is butchering the profile system that way instead of working like every other addon. :(

Alternatively, you could just use Reflux's "emulate profiles" feature to save the whole SexyMap2DB saved variables table. You'd probably still need to reload the UI afterwards, though, since SexyMap doesn't appear to have any code to support switching profiles on the fly.

Another option you might want to consider would be to use another minimap addon.

Fantastic it worked! So happy that I can finally use SexyMap again. I just used the code in the setup addon and it works fine which is what I wanted. Thank you so much Phanx!

keyndin 04-23-15 04:56 AM

I know that this is an old thread but since I had the very same issue and since this was the first entry on google I'd like to share my solution for now.

If you have already set up a global profile and would like it to load per default on new characters you can simply change line 305 in the SexyMap.lua from:

Code:

SexyMap2DB[char] = {}
to:

Code:

SexyMap2DB[char] = "global"
Note that this will be overwritten with any update of the Addon but I find it much easier then running a macro every time I create or log into a new toon.


All times are GMT -6. The time now is 08:29 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI