Thread Tools Display Modes
10-12-12, 02:47 PM   #1
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
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.
  Reply With Quote
10-13-12, 03:52 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
10-13-12, 05:10 AM   #3
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
Originally Posted by Phanx View Post
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!
  Reply With Quote
04-23-15, 04:56 AM   #4
keyndin
A Kobold Labourer
Join Date: Apr 2015
Posts: 1
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.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Script to auto set SexyMap to Global Profiles?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off