Thread Tools Display Modes
04-07-12, 06:50 PM   #1
Orko
An Aku'mai Servant
 
Orko's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 35
nibProfileLoader

Im currently trying to set up a UI that has two totally different layouts for a tank and a healer. What I have used so far is Reflux and nibprofileloader. What I want to see if I can do is rework nibprofileloader to instead of asking this.....


New Character detected. Would you like to load profile xxxx?
--- Yes --- --- No ----


I want it two have different answers like this..

Thanks for using xxxx UI. Please select a UI layout from options below.
---Tank --- --- Healer ---


Basically what nib does is if you press YES it will load a predetermined profile and if you press no it cancels out and closes the window. What I need it to do is where the Yes button is will load a tank profile and where No button is load Heal profile. Hope someone understands this and can help!!
__________________

Do not go where the path may lead, go instead where there is no path -- and leave a trail.”
  Reply With Quote
04-07-12, 08:52 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I've never heard of nibProfileLoader, but you could probably write something like that very easily for Reflux. You would need to read a list of Reflux profiles, and add a button for each one.

If you want more specific help, you will need to post your code and describe what you want to change, and what you have already tried.
  Reply With Quote
04-07-12, 10:10 PM   #3
Orko
An Aku'mai Servant
 
Orko's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 35
Here is the code from the addon I am using. I want an option to load two different profiles instead of just one. Right now the choices are load one profile or exit with the No button. Just a Yes or No button is currently there and I want like I descirbed in original post..

Lua Code:
  1. local frame = CreateFrame("FRAME");
  2. frame:RegisterEvent("VARIABLES_LOADED");
  3.  
  4. -- BEGIN USER OPTIONS --
  5. -- InterfaceName = Name to describe your UI
  6. -- ProfileName = Addon profile name to use with /reflux switch
  7. local InterfaceName  = "MyInterface"
  8. local ProfileName = "MyProfile"
  9.  
  10. local UseClassProfiles = false  -- Use specific profile names for different classes
  11. local ClassProfiles = {         -- Change profile names to suit
  12.     ["DEATHKNIGHT"] = "MyProfile",
  13.     ["DRUID"] = "MyProfile",
  14.     ["HUNTER"] = "MyProfile",
  15.     ["MAGE"] = "MyProfile",
  16.     ["PALADIN"] = "MyProfile",
  17.     ["PRIEST"] = "MyProfile",
  18.     ["ROGUE"] = "MyProfile",
  19.     ["SHAMAN"] = "MyProfile",
  20.     ["WARLOCK"] = "MyProfile",
  21.     ["WARRIOR"] = "MyProfile",
  22. }
  23. -- END USER OPTIONS --
  24.  
  25. local LocalizedMessages = {
  26.     ["enUS"] = {
  27.         [1] = "New character detected! Do you wish to load the settings for %s?",
  28.         [2] = "Yes",
  29.         [3] = "No",
  30.     },
  31.     ["deDE"] = {
  32.         [1] = "Neuen Character gefunden! Willst du die %s einstellungen laden?",
  33.         [2] = "Ja",
  34.         [3] = "Nein",
  35.     },
  36. }
  37.  
  38.  
  39. local CID, CE, HasAdded = "", false, false
  40.  
  41. local function AddChar()
  42.   if (CID ~= "") and not HasAdded then
  43.     tinsert(nibPLNames, CID)
  44.     HasAdded = true
  45.   end
  46. end
  47.  
  48. local function CharAnswered(ans)
  49.   AddChar()
  50.   if ans then
  51.     local _, class = UnitClass("player")
  52.     local NewProfile = UseClassProfiles and ClassProfiles[class] or ProfileName
  53.     local RefluxArg = string.format("%s %s", "switch", NewProfile)
  54.     SlashCmdList.REFLUX(RefluxArg) -- This will cause a UI reload
  55.   end
  56. end
  57.  
  58. local function AskNewChar()
  59.   local Locale = GetLocale() or "enUS"
  60.   local MsgTexts = LocalizedMessages[Locale] or LocalizedMessages["enUS"]
  61.   StaticPopupDialogs["PUDASKNEWCHAR"] = {
  62.     text = MsgTexts[1],
  63.     button1 = MsgTexts[2],
  64.     button2 = MsgTexts[3],
  65.     OnAccept = function()
  66.       CharAnswered(true)
  67.     end,
  68.     OnCancel = function()
  69.       CharAnswered(false)
  70.     end,
  71.     timeout = 0,
  72.     whileDead = true,
  73.     hideOnEscape = false,
  74.     notClosableByLogout = true,
  75.   }
  76.   StaticPopup_Show ("PUDASKNEWCHAR", InterfaceName);
  77. end
  78.  
  79. local function CheckNewChar()
  80.   CID = string.format("%s - %s", GetRealmName(), UnitName("player"))
  81.   CE = false
  82.   if (nibPLNames == nil) then nibPLNames = { }; end
  83.   for i,v in pairs(nibPLNames) do
  84.     if (v == CID) then CE = true; end
  85.   end
  86.   if not CE then AskNewChar(); end
  87. end
  88.  
  89. local function eventHandler(self, event, ...)
  90.   if (event == "VARIABLES_LOADED") then
  91.     CheckNewChar()
  92.   end
  93. end
  94. frame:SetScript("OnEvent", eventHandler);
__________________

Do not go where the path may lead, go instead where there is no path -- and leave a trail.”
  Reply With Quote
04-08-12, 05:58 AM   #4
Lordyfrb
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 71
This should work for you, not tested as I dont use reflux or nibProfileLoader.
Lua Code:
  1. local frame = CreateFrame("FRAME");
  2.     frame:RegisterEvent("VARIABLES_LOADED");
  3.      
  4.     -- BEGIN USER OPTIONS --
  5.     -- InterfaceName = Name to describe your UI
  6.     -- ProfileName = Addon profile name to use with /reflux switch
  7.     local InterfaceName  = "MyInterface"
  8.     local TankName = "MyTankProfile"
  9.     local HealName = "MyHealProfile"
  10.      
  11.     local UseClassProfiles = false  -- Use specific profile names for different classes
  12.     local ClassProfiles = {         -- Change profile names to suit
  13.         ["DEATHKNIGHT"] = "MyProfile",
  14.         ["DRUID"] = "MyProfile",
  15.         ["HUNTER"] = "MyProfile",
  16.         ["MAGE"] = "MyProfile",
  17.         ["PALADIN"] = "MyProfile",
  18.         ["PRIEST"] = "MyProfile",
  19.         ["ROGUE"] = "MyProfile",
  20.         ["SHAMAN"] = "MyProfile",
  21.         ["WARLOCK"] = "MyProfile",
  22.         ["WARRIOR"] = "MyProfile",
  23.     }
  24.     -- END USER OPTIONS --
  25.      
  26.     local LocalizedMessages = {
  27.         ["enUS"] = {
  28.             [1] = "Thanks for using xxxx UI. Please select a UI layout from options below.",
  29.             [2] = "Tank",
  30.             [3] = "Heal",
  31.         },
  32.         ["deDE"] = {
  33.             [1] = "Neuen Character gefunden! Willst du die %s einstellungen laden?",
  34.             [2] = "Ja",
  35.             [3] = "Nein",
  36.         },
  37.     }
  38.      
  39.      
  40.     local CID, CE, HasAdded = "", false, false
  41.      
  42.     local function AddChar()
  43.       if (CID ~= "") and not HasAdded then
  44.         tinsert(nibPLNames, CID)
  45.         HasAdded = true
  46.       end
  47.     end
  48.      
  49.     local function CharAnswered(ans)
  50.       AddChar()
  51.       if ans == "Tank" then
  52.         local _, class = UnitClass("player")
  53.         local NewProfile = UseClassProfiles and ClassProfiles[class] or ProfileName
  54.         local RefluxArg = string.format("%s %s", "switch", TankProfile)
  55.         SlashCmdList.REFLUX(RefluxArg) -- This will cause a UI reload
  56.       elseif ans == "Heal" then
  57.         local _, class = UnitClass("player")
  58.         local NewProfile = UseClassProfiles and ClassProfiles[class] or ProfileName
  59.         local RefluxArg = string.format("%s %s", "switch", HealProfile)
  60.         SlashCmdList.REFLUX(RefluxArg) -- This will cause a UI reload
  61.       end
  62.     end
  63.      
  64.     local function AskNewChar()
  65.       local Locale = GetLocale() or "enUS"
  66.       local MsgTexts = LocalizedMessages[Locale] or LocalizedMessages["enUS"]
  67.       StaticPopupDialogs["PUDASKNEWCHAR"] = {
  68.         text = MsgTexts[1],
  69.         button1 = MsgTexts[2],
  70.         button2 = MsgTexts[3],
  71.         OnAccept = function()
  72.           CharAnswered(Tank)
  73.         end,
  74.         OnCancel = function()
  75.           CharAnswered(Heal)
  76.         end,
  77.         timeout = 0,
  78.         whileDead = true,
  79.         hideOnEscape = false,
  80.         notClosableByLogout = true,
  81.       }
  82.       StaticPopup_Show ("PUDASKNEWCHAR", InterfaceName);
  83.     end
  84.      
  85.     local function CheckNewChar()
  86.       CID = string.format("%s - %s", GetRealmName(), UnitName("player"))
  87.       CE = false
  88.       if (nibPLNames == nil) then nibPLNames = { }; end
  89.       for i,v in pairs(nibPLNames) do
  90.         if (v == CID) then CE = true; end
  91.       end
  92.       if not CE then AskNewChar(); end
  93.     end
  94.      
  95.     local function eventHandler(self, event, ...)
  96.       if (event == "VARIABLES_LOADED") then
  97.         CheckNewChar()
  98.       end
  99.     end
  100.     frame:SetScript("OnEvent", eventHandler);
__________________
  Reply With Quote
04-08-12, 03:44 PM   #5
Orko
An Aku'mai Servant
 
Orko's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 35
Oh sweet I will try this ASAP. The problem I have is I dont know how to code and did not know how the buttons worked. Couldnt figure that part out. Ill see how this goes and will let you know.
__________________

Do not go where the path may lead, go instead where there is no path -- and leave a trail.”
  Reply With Quote
04-08-12, 03:57 PM   #6
Orko
An Aku'mai Servant
 
Orko's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 35
Ok I tried this modification and it does not do anything. After selecting Tank or Heal the window cancels and nothing happens. No profile switch or reloadui. Trying to see what I can find out. Im not getting any errors or anything. Just not doing what its intended to do.
__________________

Do not go where the path may lead, go instead where there is no path -- and leave a trail.”
  Reply With Quote
04-08-12, 04:29 PM   #7
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
There were some quotes missing around Tank and Heal, but rest should be good.

Lua Code:
  1. local frame = CreateFrame("FRAME");
  2. frame:RegisterEvent("VARIABLES_LOADED");
  3.      
  4. -- BEGIN USER OPTIONS --
  5. -- InterfaceName = Name to describe your UI
  6. -- ProfileName = Addon profile name to use with /reflux switch
  7. local InterfaceName  = "MyInterface"
  8. local TankName = "MyTankProfile"
  9. local HealName = "MyHealProfile"
  10.      
  11. local UseClassProfiles = false  -- Use specific profile names for different classes
  12. local ClassProfiles = {         -- Change profile names to suit
  13.     ["DEATHKNIGHT"] = "MyProfile",
  14.     ["DRUID"] = "MyProfile",
  15.     ["HUNTER"] = "MyProfile",
  16.     ["MAGE"] = "MyProfile",
  17.     ["PALADIN"] = "MyProfile",
  18.     ["PRIEST"] = "MyProfile",
  19.     ["ROGUE"] = "MyProfile",
  20.     ["SHAMAN"] = "MyProfile",
  21.     ["WARLOCK"] = "MyProfile",
  22.     ["WARRIOR"] = "MyProfile",
  23. }
  24. -- END USER OPTIONS --
  25.  
  26. local LocalizedMessages = {
  27.     ["enUS"] = {
  28.         [1] = "Thanks for using xxxx UI. Please select a UI layout from options below.",
  29.         [2] = "Tank",
  30.         [3] = "Heal",
  31.     },
  32.     ["deDE"] = {
  33.         [1] = "Neuen Character gefunden! Willst du die %s einstellungen laden?",
  34.         [2] = "Ja",
  35.         [3] = "Nein",
  36.     },
  37. }
  38.  
  39.  
  40. local CID, CE, HasAdded = "", false, false
  41.  
  42. local function AddChar()
  43.   if (CID ~= "") and not HasAdded then
  44.     tinsert(nibPLNames, CID)
  45.     HasAdded = true
  46.   end
  47. end
  48.  
  49. local function CharAnswered(ans)
  50.   AddChar()
  51.   if ans == "Tank" then
  52.     local _, class = UnitClass("player")
  53.     local NewProfile = UseClassProfiles and ClassProfiles[class] or ProfileName
  54.     local RefluxArg = string.format("%s %s", "switch", TankProfile)
  55.     SlashCmdList.REFLUX(RefluxArg) -- This will cause a UI reload
  56.   elseif ans == "Heal" then
  57.     local _, class = UnitClass("player")
  58.     local NewProfile = UseClassProfiles and ClassProfiles[class] or ProfileName
  59.     local RefluxArg = string.format("%s %s", "switch", HealProfile)
  60.     SlashCmdList.REFLUX(RefluxArg) -- This will cause a UI reload
  61.   end
  62. end
  63.  
  64. local function AskNewChar()
  65.   local Locale = GetLocale() or "enUS"
  66.   local MsgTexts = LocalizedMessages[Locale] or LocalizedMessages["enUS"]
  67.   StaticPopupDialogs["PUDASKNEWCHAR"] = {
  68.     text = MsgTexts[1],
  69.     button1 = MsgTexts[2],
  70.     button2 = MsgTexts[3],
  71.     OnAccept = function()
  72.       CharAnswered("Tank")
  73.     end,
  74.     OnCancel = function()
  75.       CharAnswered("Heal")
  76.     end,
  77.     timeout = 0,
  78.     whileDead = true,
  79.     hideOnEscape = false,
  80.     notClosableByLogout = true,
  81.   }
  82.   StaticPopup_Show ("PUDASKNEWCHAR", InterfaceName);
  83. end
  84.  
  85. local function CheckNewChar()
  86.   CID = string.format("%s - %s", GetRealmName(), UnitName("player"))
  87.   CE = false
  88.   if (nibPLNames == nil) then nibPLNames = { }; end
  89.   for i,v in pairs(nibPLNames) do
  90.     if (v == CID) then CE = true; end
  91.   end
  92.   if not CE then AskNewChar(); end
  93. end
  94.  
  95. local function eventHandler(self, event, ...)
  96.   if (event == "VARIABLES_LOADED") then
  97.     CheckNewChar()
  98.   end
  99. end
  100. frame:SetScript("OnEvent", eventHandler);
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » nibProfileLoader

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