Thread Tools Display Modes
01-22-17, 08:18 AM   #1
wille480
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 56
button("OnClick") & PLAYER_ENTERING_WORLD

Hey guys!
this is the code i have now! , this code does so if mybutton2 is clicked it will run the second code below the line and print out "HelyaAssist is now Disabled" , nothing with the code broken so far but that will be printed everytime i release from graveyard, reloadui manually and so on.. I only want that code to go off if mybutton2 is clicked. How do i do this? have tried alot of things like if statements and stuff but then i get an error ingame saying that it failed cuz it is trying to call frame a global nil value.

Lua Code:
  1. mybutton2:SetScript("OnClick", function(self, button, down)
  2.  local playerName = UnitName("player")
  3.  DisableAddOn(folder, playerName)
  4.  ReloadUI()
  5.  eventHandlerE();
  6. end)
  7.  
  8. ------------------------------------
  9.  
  10. local frame = CreateFrame("FRAME", "FooAddonFrame");
  11. frame:RegisterEvent("PLAYER_ENTERING_WORLD");
  12. local function eventHandlerE(self, event, ...)
  13. print('|cffffff00HelyaAssist is now Disabled')
  14.  end
  15. frame:SetScript("OnEvent", eventHandlerE);

tried this for example but did not work :/
Lua Code:
  1. local ds = 0
  2.  
  3. mybutton2:SetScript("OnClick", function(self, button, down)
  4.  local playerName = UnitName("player")
  5.  DisableAddOn(folder, playerName)
  6.  ReloadUI()
  7.  ds = 1
  8. end)
  9.  
  10. ------------------------------------
  11. if ds == 1 then
  12. local frame = CreateFrame("FRAME", "FooAddonFrame");
  13. frame:RegisterEvent("PLAYER_ENTERING_WORLD");
  14. local function eventHandlerE(self, event, ...)
  15. print('|cffffff00HelyaAssist is now Disabled')
  16.  end
  17. end
  18. frame:SetScript("OnEvent", eventHandlerE);

Best regards!

Last edited by wille480 : 01-22-17 at 08:21 AM.
  Reply With Quote
01-22-17, 10:27 AM   #2
pas06
A Theradrim Guardian
Join Date: Apr 2009
Posts: 62
Lua Code:
  1. local frame = CreateFrame("FRAME", "FooAddonFrame");
  2. frame:RegisterEvent("PLAYER_ENTERING_WORLD");
  3. local function eventHandlerE(self, event, ...)
  4. print('|cffffff00HelyaAssist is now Disabled')
  5.  end
  6. frame:SetScript("OnEvent", eventHandlerE);

of course it does this. what you did with this few lines is register the event PLAYER_ENTERING_WORLD (http://wowprogramming.com/docs/event...ENTERING_WORLD) on your frame. Every time this event fires the function eventHandlerE is run.
Explanation:
frame:SetScript("OnEvent", eventHandlerE)
this means: run the function eventHandlerE whenever a event that is registered on that frame (via frame:RegisterEvent) fires


this should do the job:

Lua Code:
  1. mybutton2:SetScript("OnClick", function(self, button, down)
  2.     local playerName = UnitName("player")
  3.     DisableAddOn(folder, playerName)
  4.     ReloadUI()
  5.     print('|cffffff00HelyaAssist is now Disabled')
  6. end)

just keep in mind that the player might not notice your message because of "addon loaded spam" when the ui got reloaded.

Last edited by pas06 : 01-22-17 at 10:36 AM.
  Reply With Quote
01-22-17, 12:03 PM   #3
wille480
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 56
Hello pas06!
The code you linked recently (the second code) is what i had before and the message will just be spammed over , that is why i have the code i poated in my first post because that will show the message last of everything so you can see the message, but the problem with that is that i can't make it trigger when only mybutton2 is clicked

Possible to sort it out with the code i had? So it only triggers on mybutton2 "OnClick"

Last edited by wille480 : 01-22-17 at 12:06 PM.
  Reply With Quote
01-22-17, 12:10 PM   #4
pas06
A Theradrim Guardian
Join Date: Apr 2009
Posts: 62
hmm,

i was talking about replacing your whole code
Lua Code:
  1. mybutton2:SetScript("OnClick", function(self, button, down)
  2.  local playerName = UnitName("player")
  3.  DisableAddOn(folder, playerName)
  4.  ReloadUI()
  5.  eventHandlerE();
  6. end)
  7.  
  8. ------------------------------------
  9.  
  10. local frame = CreateFrame("FRAME", "FooAddonFrame");
  11. frame:RegisterEvent("PLAYER_ENTERING_WORLD");
  12. local function eventHandlerE(self, event, ...)
  13. print('|cffffff00HelyaAssist is now Disabled')
  14.  end
  15. frame:SetScript("OnEvent", eventHandlerE);

with
Lua Code:
  1. mybutton2:SetScript("OnClick", function(self, button, down)
  2.     local playerName = UnitName("player")
  3.     DisableAddOn(folder, playerName)
  4.     ReloadUI()
  5.     print('|cffffff00HelyaAssist is now Disabled')
  6. end)
  Reply With Quote
01-22-17, 12:34 PM   #5
wille480
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 56
Yes got that ,
But with that code only it will like not show the message because it will be like spammed over , had that code only before but it does not show it, like with elvui, when you do /reloadui , it will show "welcome to elvui version .. Bla bla" like that message does show and is not spammed over but i cant make it do that

Best regards
  Reply With Quote
01-22-17, 01:04 PM   #6
pas06
A Theradrim Guardian
Join Date: Apr 2009
Posts: 62
i don't see whats causing the message to get spammed.
  Reply With Quote
01-22-17, 01:51 PM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
This should show the message once every time a character logs in with the addon disabled.
Lua Code:
  1. mybutton2:SetScript("OnClick", function(self, button, down)
  2.     local playerName = UnitName("player")
  3.     DisableAddOn(folder, playerName)
  4.     ReloadUI()
  5. end)
  6.  
  7. ------------------------------------
  8.  
  9. local function eventHandlerE(self, event, ...)
  10.     local playerName = UnitName("player")
  11.     if GetAddOnEnableState(playerName, folder) == 0 then
  12.         print('|cffffff00HelyaAssist is now Disabled')
  13.     end
  14.     self:UnregisterEvent("PLAYER_ENTERING_WORLD")
  15. end
  16. local frame = CreateFrame("FRAME", "FooAddonFrame");
  17. frame:RegisterEvent("PLAYER_ENTERING_WORLD");
  18. frame:SetScript("OnEvent", eventHandlerE);

Edit: Checked Enable State instead of Loaded
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-22-17 at 02:54 PM.
  Reply With Quote
01-22-17, 05:42 PM   #8
wille480
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 56
Hey fizzlemizz!

That code prints("HelyaAssist is now Disabled") on every reloadui you do.
Same issue as i had before
  Reply With Quote
01-22-17, 07:01 PM   #9
pas06
A Theradrim Guardian
Join Date: Apr 2009
Posts: 62
Please write your whole code/addon in here.
  Reply With Quote
01-22-17, 07:33 PM   #10
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Originally Posted by wille480 View Post
Hey fizzlemizz!

That code prints("HelyaAssist is now Disabled") on every reloadui you do.
Same issue as i had before
Indeed because every ReloadUI causes a PLAYER_ENTERING_WORLD event to fire. If you are only wanting the message to be printed after pressing the button each time, you will have to save the fact that it was pressed into a SavedVariable and then check it on PLAYER_ENTERING_WORLD

To your .toc file add the following (or use some other unique addon specific name for the variable):
Code:
    ## SavedVariables: wille480Addon
Lua Code:
  1. mybutton2:SetScript("OnClick", function(self, button, down)
  2.     local playerName = UnitName("player")
  3.     DisableAddOn(folder, playerName)
  4.     wille480Addon = true
  5.     ReloadUI()
  6. end)
  7.      
  8.     ------------------------------------
  9.      
  10. local function eventHandlerE(self, event, ...)
  11.     local playerName = UnitName("player")
  12.     if wille480Addon and GetAddOnEnableState(playerName, folder) == 0 then
  13.         wille480Addon = nil
  14.         print('|cffffff00HelyaAssist is now Disabled')
  15.     end
  16.     self:UnregisterEvent("PLAYER_ENTERING_WORLD")
  17. end
  18. local frame = CreateFrame("FRAME", "FooAddonFrame");
  19. frame:RegisterEvent("PLAYER_ENTERING_WORLD");
  20. frame:SetScript("OnEvent", eventHandlerE);
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-22-17 at 07:46 PM.
  Reply With Quote
01-23-17, 08:10 AM   #11
wille480
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 56
Hello FizzleMizz! : )
The code you sent in your last post did not work , I don't know if it the code or if i am doing wrong..

This is my whole LUA Code for my addon.
Lua Code:
  1. local TaintOfTheSea     = GetSpellInfo(228054)
  2. local Ticker            = 0
  3. local MoveMessage       = "{moon} MOVE TO MOON {moon}"
  4. local DispelMessage     = "Dispell on {moon} in "
  5. local debuffexists      = false
  6. local titleFont = [=[Interface\Addons\HelyaAssist\fonts\accid___.ttf]=]
  7. local folder = [=[Interface\Addons\HelyaAssist\HelyaAssist.toc]=]
  8. local ds = 0
  9.  
  10. -- Adds HelyaAssist to interface in addons
  11. local myAddon = {};
  12. myAddon.panel = CreateFrame( "Frame", "myAddonPanel", UIParent);
  13. myAddon.panel.name = "HelyaAssist";
  14. InterfaceOptions_AddCategory(myAddon.panel);
  15.  
  16. --Create the button (enable)
  17. local mybutton1 = CreateFrame("Button","mybutton", myAddon.panel, "UIPanelButtonTemplate")
  18. mybutton1:SetPoint("CENTER", -255,220)
  19. mybutton1:SetWidth(80)
  20. mybutton1:SetHeight(22)
  21. mybutton1:SetText("Enabled")
  22.  
  23. --Create the button (disable)
  24. mybutton2 = CreateFrame("Button","mybutton", myAddon.panel, "UIPanelButtonTemplate")
  25. mybutton2:SetPoint("CENTER", -160,220)
  26. mybutton2:SetWidth(80)
  27. mybutton2:SetHeight(22)
  28. mybutton2:SetText("Disabled")
  29.  
  30. --Text in panel
  31.  MOD_TextFrame = CreateFrame("Frame", nil, myAddonPanel);
  32.  MOD_TextFrame:ClearAllPoints();
  33.  MOD_TextFrame:SetHeight(300);
  34.  MOD_TextFrame:SetWidth(300);
  35.  MOD_TextFrame:SetScript("OnUpdate", MOD_TextFrame_OnUpdate);
  36.  MOD_TextFrame.text = MOD_TextFrame:CreateFontString(nil, "BACKGROUND", "PVPInfoTextFont");
  37.  MOD_TextFrame.text:SetAllPoints();
  38.  MOD_TextFrame:SetPoint("CENTER", -245, 260);
  39.  MOD_TextFrameTime = 0;
  40.  MOD_TextFrame.text:SetText('|cffffff00HelyaAssist');
  41.  MOD_TextFrame.text:SetFont(titleFont, 19);
  42.  
  43.  --If mybutton2 is clicked, then disable HelyaAssist (disable button)
  44. mybutton2:SetScript("OnClick", function(self, button, down)
  45.     local playerName = UnitName("player")
  46.     DisableAddOn(folder, playerName)
  47.     wille480Addon = true
  48.     ReloadUI()
  49. end)
  50.  
  51. -- PLAYER_ENTERING_WORLD for Disable button
  52. local function eventHandlerE(self, event, ...)
  53.     local playerName = UnitName("player")
  54.     if HelyaAssistAddon and GetAddOnEnableState(playerName, folder) == 0 then
  55.         HelyaAssistAddon = nil
  56.         print('|cffffff00HelyaAssist is now Disabled')
  57.     end
  58.     self:UnregisterEvent("PLAYER_ENTERING_WORLD")
  59. end
  60. local frame = CreateFrame("FRAME", "FooAddonFrame");
  61. frame:RegisterEvent("PLAYER_ENTERING_WORLD");
  62. frame:SetScript("OnEvent", eventHandlerE);
  63.  
  64.  
  65. --If MyButton1 is clicked , then Enable HelyaAssist (enable button)
  66. mybutton1:SetScript("OnClick", function(self, button, down)
  67. local playerName2 = UnitName("player")
  68. EnableAddOn(folder, playerName2)
  69. ReloadUI()
  70. end)
  71.  
  72.  
  73.  
  74.  
  75. -- PLAYER_ENTERING_WORLD for Enable button
  76.  
  77.  
  78.  
  79.  
  80. local function UpdateTicker()
  81.     if Ticker < 1 or not debuffexists then return end
  82.  
  83.     SendChatMessage((Ticker > 5) and MoveMessage or DispelMessage .. Ticker, "Yell", nil, name)
  84.     Ticker = Ticker - 1
  85.  
  86.     C_Timer.After((Ticker > 5) and 1.5 or 0.4, UpdateTicker)
  87. end
  88.  
  89. local function UNIT_AURA()
  90.     local name, _, _, _, _, duration, expires = UnitDebuff("player", TaintOfTheSea)
  91.    
  92.     if name then
  93.         if not debuffexists then
  94.             debuffexists = true --player just got the debuff
  95.             Ticker = 6
  96.             UpdateTicker()
  97.         end
  98.     else
  99.         debuffexists = false -- doesn't exist
  100.     end
  101. end
  102.  
  103. local eventframe = CreateFrame("Frame")
  104. eventframe:RegisterUnitEvent("UNIT_AURA", "player")
  105. eventframe:SetScript("OnEvent", UNIT_AURA)

This is my .toc file
Lua Code:
  1. ## Interface: 70100
  2. ## Author: Lmannen (Ingame Name = Bishoop)
  3. ## Version: 1.0
  4. ## Title: HelyaAssist
  5. ## Notes: Triggered guild addon
  6. ## DefaultState: enabled
  7.  
  8. ## SavedVariables: HelyaAssistAddon
  9.  
  10. HelyaAssist.lua

Should be easier now as you can see for yourself how the code looks like so far!
best regards guys and ty for help so far!
  Reply With Quote
01-23-17, 09:27 AM   #12
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
mybutton2 on line 24 is a global variable. I take it that is not intended? Also, when you come back to this code in a year or two, are you immediately going to know what mybutton1 and mybutton2 are used for? They are hardly descriptive in their names.

The point being, at a glace, I have no idea what they do, and neither will you in a year or two.
  Reply With Quote
01-23-17, 10:29 AM   #13
pas06
A Theradrim Guardian
Join Date: Apr 2009
Posts: 62
hi, i am currently looking through your code. why do you even wan't to disable the addon through the addon panel? As a user i usually disable addons through the build in addon list. in my opinion it would be better if the addon automatically runs when the player is in combat with helya and is sleeping if not. (no need for ui options anymore)
For what is this OnUpdate in line 35 good for?

my suggestion would be this(untested, no guarantee if its working or not)

Lua Code:
  1. local TaintOfTheSea     = GetSpellInfo(228054)
  2. local Ticker            = 0
  3. local MoveMessage       = "{moon} MOVE TO MOON {moon}"
  4. local DispelMessage     = "Dispell on {moon} in "
  5. local debuffexists      = false
  6. local eventframe = CreateFrame("Frame")
  7.  
  8.  
  9. local function UpdateTicker()
  10.     if Ticker < 1 or not debuffexists then return end
  11.  
  12.     SendChatMessage((Ticker > 5) and MoveMessage or DispelMessage .. Ticker, "Yell", nil, name)
  13.     Ticker = Ticker - 1
  14.  
  15.     C_Timer.After((Ticker > 5) and 1.5 or 0.4, UpdateTicker)
  16. end
  17.  
  18. local function eventframe.UNIT_AURA()
  19.     local name, _, _, _, _, duration, expires = UnitDebuff("player", TaintOfTheSea)
  20.    
  21.     if name then
  22.         if not debuffexists then
  23.             debuffexists = true --player just got the debuff
  24.             Ticker = 6
  25.             UpdateTicker()
  26.         end
  27.     else
  28.         debuffexists = false -- doesn't exist
  29.     end
  30. end
  31.  
  32. local function eventframe:ENCOUNTER_START(EncounterID)
  33.     if EncounterID == 1829 then
  34.         print("|cffffff00HelyaAssist is now enabled")
  35.         self:RegisterUnitEvent("UNIT_AURA", "player")
  36.         self:RegisterEvent("ENCOUNTER_END")
  37.     end
  38. end
  39. local function eventframe:ENCOUNTER_END()
  40.     print("|cffffff00HelyaAssist is now disabled")
  41.     self:UnregisterEvent("UNIT_AURA")
  42. end
  43.  
  44.  
  45. eventframe:RegisterEvent("ENCOUNTER_START")
  46. eventframe:SetScript("OnEvent", function(self, event, ...)
  47.         self[event](...)       
  48. end);

Last edited by pas06 : 01-23-17 at 10:57 AM.
  Reply With Quote
01-23-17, 10:33 AM   #14
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Because you're still setting wille480Addon in the OnClick but checking for HelyaAssistAddon in the OnEvent. Change wille480Addon to HelyaAssistAddon.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
01-23-17, 10:44 AM   #15
wille480
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 56
Originally Posted by Fizzlemizz View Post
Because you're still setting wille480Addon in the OnClick but checking for HelyaAssistAddon in the OnEvent. Change wille480Addon to HelyaAssistAddon.
Hey guys to for help! responding to your quote here fizzlemizz!
I just noticed that i missed to change it to HelyaAssistAddon , Changed everyone else but did not look properly!

Ty for help
best regards
  Reply With Quote
01-23-17, 10:46 AM   #16
wille480
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 56
Originally Posted by pas06 View Post
hi, i am currently looking through your code. why do you even wan't to disable the addon through the addon panel? As a user i usually disable addons through the build in addon list. in my opinion it would be better if the addon automatically runs when the player is in combat with helya and is sleeping if not. (no need for ui options anymore)
For what is this OnUpdate in line 35 good for?

my suggestion would be this(untested, no guarantee if its working or not)

Lua Code:
  1. local TaintOfTheSea     = GetSpellInfo(228054)
  2. local Ticker            = 0
  3. local MoveMessage       = "{moon} MOVE TO MOON {moon}"
  4. local DispelMessage     = "Dispell on {moon} in "
  5. local debuffexists      = false
  6. local eventframe = CreateFrame("Frame")
  7.  
  8.  
  9. local function UpdateTicker()
  10.     if Ticker < 1 or not debuffexists then return end
  11.  
  12.     SendChatMessage((Ticker > 5) and MoveMessage or DispelMessage .. Ticker, "Yell", nil, name)
  13.     Ticker = Ticker - 1
  14.  
  15.     C_Timer.After((Ticker > 5) and 1.5 or 0.4, UpdateTicker)
  16. end
  17.  
  18. local function eventframe.UNIT_AURA()
  19.     local name, _, _, _, _, duration, expires = UnitDebuff("player", TaintOfTheSea)
  20.    
  21.     if name then
  22.         if not debuffexists then
  23.             debuffexists = true --player just got the debuff
  24.             Ticker = 6
  25.             UpdateTicker()
  26.         end
  27.     else
  28.         debuffexists = false -- doesn't exist
  29.     end
  30. end
  31.  
  32. local function eventframe:ENCOUNTER_START(EncounterID)
  33.     if EncounterID = 1829 then
  34.         print("|cffffff00HelyaAssist is now enabled")
  35.         self:RegisterUnitEvent("UNIT_AURA", "player")
  36.         self:RegisterEvent("ENCOUNTER_END")
  37.     end
  38. end
  39. local function eventframe:ENCOUNTER_END()
  40.     print("|cffffff00HelyaAssist is now disabled")
  41.     self:UnregisterEvent("UNIT_AURA")
  42. end
  43.  
  44.  
  45. eventframe:RegisterEvent("ENCOUNTER_START")
  46. eventframe:SetScript("OnEvent", function(self, event, ...)
  47.         self[event](...)       
  48. end);
Oh hey pas06!
Thank you for the help , basicly why i disable through addon panel is because i can't find anyway around it :O , all i find is that on wowprogrammings own api site , Basicly my addon will run on every difficulty etc.. even on maw of soul dungeon so i thought it would be a good idea to have a enable and disable button because to be honest , in maw of soul , this addon is not necessary at all and can be annoying to not have a option to disable it! , But yea like i said , i can't find any way around it.

Best regards!
  Reply With Quote
01-23-17, 10:48 AM   #17
pas06
A Theradrim Guardian
Join Date: Apr 2009
Posts: 62
my way should be the way around it, it checks for the encounter id of helya 1829. if the encounter has this id it basically starts the addon.
Edit:Changed line 33 of the code i posted in post #13

Last edited by pas06 : 01-23-17 at 10:58 AM. Reason: deleted necessary quote
  Reply With Quote
01-23-17, 11:09 AM   #18
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
To clear up a few problems with your original code, the addon wouldn't have been disabled as DisableAddon requires just the folder name, not the full path (The WoWProgramming discription is a little cryptic):

Code:
DisableAddon("HelyaAssist")
The other problem is that once disabled, the addon would not be loaded again after the ReloadUI() (because it's disabled) so the message would never be printed.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
01-23-17, 11:21 AM   #19
wille480
A Wyrmkin Dreamwalker
Join Date: Jan 2017
Posts: 56
Originally Posted by Fizzlemizz View Post
To clear up a few problems with your original code, the addon wouldn't have been disabled as DisableAddon requires just the folder name, not the full path (The WoWProgramming discription is a little cryptic):

Code:
DisableAddon("HelyaAssist")
The other problem is that once disabled, the addon would not be loaded again after the ReloadUI() (because it's disabled) so the message would never be printed.
Ah okey roger ! ty
so it is fully disabled now with the code you sent me?

btw one more question<3
Lua Code:
  1. buttonEnable:SetScript("OnClick", function(self, button, down)
  2. local playerName = UnitName("player")
  3. EnableAddOn(folder, playerName)
  4. HelyaAssistAddon = false
  5. ReloadUI()
  6. end)
  7.  
  8. -------------------------------------
  9.  
  10. local function eventHandlerE(self, event, ...)
  11.     local playerName = UnitName("player")
  12.     if HelyaAssistAddon and GetAddOnEnableState(playerName, folder) == 0 then
  13.         HelyaAssistAddon = nil
  14.         print('|cffffff00HelyaAssist is now Disabled')
  15.     end
  16.     if HelyaAssistAddon and GetAddOnEnableState(playerName, folder) == 1 then
  17.     HelyaAssistAddon = nil
  18.     print('|cffffff00HelyaAssist is now Enabled')
  19.     end
  20.     self:UnregisterEvent("PLAYER_ENTERING_WORLD")
  21. end
  22. local frame = CreateFrame("FRAME", "FooAddonFrame");
  23. frame:RegisterEvent("PLAYER_ENTERING_WORLD");
  24. frame:SetScript("OnEvent", eventHandlerE);

Trying to make the same for the enabled button , so if buttonEnable is clicked, print('|cffffff00HelyaAssist is now Enabled')

I think i have gotten everything right so far except
Lua Code:
  1. if HelyaAssistAddon and GetAddOnEnableState(playerName, folder) == 1 then
  2.     HelyaAssistAddon = nil -- think this one is wrong because for disabled if statement this is nil aswell.        
  3.     print('|cffffff00HelyaAssist is now Enabled')
  4.     end
That line "HelyaAssistAddon=nil" , i think that is wrong if i wanna have it enable the addon , But can not find what to set it to , tried with true and false.
  Reply With Quote
01-23-17, 11:27 AM   #20
pas06
A Theradrim Guardian
Join Date: Apr 2009
Posts: 62
i don't get the logic behind this. You wan't to enable an addon from an disabled addon?
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » button("OnClick") & PLAYER_ENTERING_WORLD


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