User
Pass
2FA
 
 

api differences to official?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash
Author Message475
wadehadedudeda

[Mentally Stable]



Status: Offline
(since 24-06-2020 01:36)
Joined: 28 Jun 2018
Posts: 14, Topics: 9
Location: Germany

Reputation: 17.5

Post Posted: 24-08-2018, 21:29:27 | Translate post to: ... (Click for more languages)

hi, im trying to get an addon(bonus roll window hide) to work i used on official 7.1.5 server. it hides the bonus roll window in selected instances.

i added some debug prints to the code and never got them displayed as output. when i use the macro(posted below) i will get the "bonusroll window displaying now" when getting the bonusroll.

im assuming now that theres a problem with the PLAYER_ENTERING_WORLD event bacause the print macro does hook an event but the eventHandler function doesnt

Edit: its possible to add instance types like in the outcommented code

code(red lines are added by me)
Quote:
SLASH_BONUSROLLWINDOWHIDE1,SLASH_BONUSROLLWINDOWHIDE2 = '/brwh', '/brwh2';
local frame = CreateFrame("FRAME");
frame:RegisterEvent("PLAYER_ENTERING_WORLD");


local function eventHandler(self, event, ...)
--print("event handler called")
if not GVBRFrmShowLastTime then
GVBRFrmShowLastTime = GetTime()
--print("last time called set")
end

-- BonusRollFrame:SetScript("OnShow", function(self, event, ...)
BonusRollFrame:HookScript("OnShow", function(self, event, ...)
local _, _, difficulty,_,_,_,_,mapID = GetInstanceInfo()
if difficulty == 23 then
-- if difficulty == 17 or difficulty == 0 or difficulty == 14 or difficulty == 23 then
--print("all condidtions to hide met")
if GVBRFrmShowLastTime <= GetTime() then --auto show after Reload
BonusRollFrame:Hide()
GVBRFrmShowLastTime = GetTime() + 1 --time to show 2nd time to make chat command work - 45sec better TODO: add chat command
print("BonusRollFrame has been hidden!!! to show window type \"/brwh\"")
end
end

end)


end
local function showBrWindow()

BonusRollFrame:Show(); --двойной вызов ибо в функции есть таймер
BonusRollFrame:Show();
end
frame:SetScript("OnEvent", eventHandler);
SlashCmdList["BONUSROLLWINDOWHIDE"] = showBrWindow;


macro(i run this after entering instance)
Quote:
/run BonusRollFrame:HookScript("OnShow", function(self, event, ...) print("bonusroll window displaying now") end)


oricinal code with formatting
Spoiler:



Last edited by wadehadedudeda on 24-08-2018, 22:42:20; edited 3 times in total
0 0
  
Back to top
View user's profile Send private message
wadehadedudeda

[Mentally Stable]



Status: Offline
(since 24-06-2020 01:36)
Joined: 28 Jun 2018
Posts: 14, Topics: 9
Location: Germany

Reputation: 17.5

Post Posted: 24-08-2018, 22:19:42 | Translate post to: ... (Click for more languages)

nevermind. its working now, dont know what the problem was.

E: it was probably because i used "||" instead of "or" but afaik both should work

0 0
  
Back to top
View user's profile Send private message
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash  


The time now is 03-05-2024, 13:54:50
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x