Quantcast
Help with Frame. - WoWInterface
Thread Tools Display Modes
07-18-21, 11:09 AM   #1
darhanger
A Deviate Faerie Dragon
 
darhanger's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2017
Posts: 10
Help with Frame.

Wanna port friend addon to BC for track some spells and stuff.

Code:
Lua Code:
  1. Dimonkiy = {};
  2. Dimonkiy.version = GetAddOnMetadata("Dimonkiy", "Version")
  3. Dimonkiy.point = "CENTER";
  4. Dimonkiy.relativePoint = "CENTER";
  5. Dimonkiy.x = -160;
  6. Dimonkiy.y = -220;
  7.  
  8. local uiScale = GetCVar("uiScale") or 1;
  9. local backdrop = {
  10.     bgFile = "Interface/Tooltips/UI-Tooltip-Background",
  11.     insets = { left = -5, right = -5, top = -5, bottom = -5 }
  12. };
  13.  
  14. Dimonkiy.Frame = CreateFrame("ScrollingMessageFrame", nil);
  15. local frame = Dimonkiy.Frame
  16. frame:ClearAllPoints();
  17. frame:SetMovable(true);
  18. frame:EnableMouse(true);
  19. frame:SetFrameStrata("HIGH");
  20. frame:RegisterForDrag("LeftButton");
  21. frame:SetScript("OnDragStart", frame.StartMoving);
  22. frame:SetScript("OnDragStop", frame.StopMovingOrSizing);
  23. frame:SetWidth(350);
  24. frame:SetHeight(100);
  25. frame:SetBackdrop(backdrop); -- comment this if you wan't frame
  26. frame:SetPoint(Dimonkiy.point, nil, Dimonkiy.relativePoint, Dimonkiy.x, Dimonkiy.y);
  27. frame:SetBackdropColor(0,0,0,1);
  28. frame:SetFontObject("CombatLogFont")
  29. frame:SetTimeVisible(10);
  30. frame:SetFadeDuration(5);
  31. frame:SetMaxLines(7)
  32. frame:SetFading(false)
  33. frame:SetAlpha(1);
  34. frame:Show();
  35.  
  36.  
  37. frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  38. frame:SetScript("OnEvent", function(self, event, ...)
  39.  
  40. local GetSpellInfo = GetSpellInfo;
  41. local playerGUID = UnitGUID("player");
  42. local useTime = date("%H:%M:%S");
  43. local spellList = {
  44.     [GetSpellInfo(57993)] = true,
  45.     [GetSpellInfo(47471)] = true,
  46.     [GetSpellInfo(47475)] = true,
  47.     [GetSpellInfo(5938)] = true,
  48. }
  49. local arg = {...};
  50.  
  51. if arg[2] == "SPELL_CAST_SUCCESS"
  52.     and arg[3] == playerGUID
  53.     and arg[7] ~= nil
  54.     and arg[9] ~= 47632
  55.     and arg[9] ~= 47633
  56.     and arg[9] ~= 49560
  57.     and arg[9] ~= 45470
  58.     and arg[9] ~= "nil" then
  59.         local _, _, icon = GetSpellInfo(arg[9])
  60.     frame:AddMessage(""..useTime.."  \124T"..icon..  ":15:15\124t "..arg[10].." - \124cffFFF423"..arg[7].."\124r")
  61. end
  62.  
  63. if arg[2] == "SPELL_CAST_SUCCESS"
  64.     and arg[3] == playerGUID
  65.     and arg[7] == nil
  66.     and arg[9] ~= 47632
  67.     and arg[9] ~= 47633
  68.     and arg[9] ~= 49560
  69.     and arg[9] ~= 45470
  70.     and arg[9] ~= "nil" then
  71.         local _, _, icon = GetSpellInfo(arg[9])
  72.     frame:AddMessage(""..useTime.."  \124T"..icon..  ":15:15\124t "..arg[10].."")
  73. end
  74.  
  75. if (arg[2] == "SPELL_CAST_SUCCESS" or arg[2] == "SPELL_DAMAGE") then
  76.     if (arg[3] == playerGUID
  77.      and spellList[arg[10]]) then
  78.         local _, _, icon = GetSpellInfo(arg[9])
  79.         frame:AddMessage(""..useTime.."  \124T"..icon..  ":15:15\124t "..arg[10].."")
  80.     end
  81. end  
  82.  
  83. if arg[2] == "UNIT_SPELLCAST_SUCCEEDED"
  84.     and arg[3] == playerGUID
  85.     and arg[7] == nil
  86.     and arg[9] ~= 47632
  87.     and arg[9] ~= 47633
  88.     and arg[9] ~= 49560
  89.     and arg[9] ~= 45470
  90.     and arg[9] ~= "nil" then
  91.         local _, _, icon = GetSpellInfo(arg[9])
  92.     frame:AddMessage(""..useTime.."  \124T"..icon..  ":15:15\124t "..arg[10].."")
  93. end
  94.  
  95. if arg[2] == "SPELL_CAST_START"
  96.     and arg[3] == playerGUID
  97.     and arg[9] ~= "nil" then
  98.         local _, _, icon = GetSpellInfo(arg[9])
  99.     frame:AddMessage(""..useTime.."  \124T"..icon..  ":15:15\124t "..arg[10].."")
  100. end
  101.  
  102. if arg[2] == "SPELL_CAST_FAILED"
  103.     and arg[3] == playerGUID
  104.     and arg[9] ~= "nil" then
  105.         local _, _, icon = GetSpellInfo(arg[9])
  106.     frame:AddMessage(""..useTime.."  \124T"..icon..  ":15:15\124t \124cFFFF0000"..arg[10].."",255,0,0)
  107. end
  108.  
  109. end)

Problems:
1. I can't make it to save position when i move it by mouse;
2. When open map. Its show on top layer;
  Reply With Quote
07-18-21, 06:14 PM   #2
auLanTisteNT
A Kobold Labourer
Join Date: Apr 2017
Posts: 1
Oh man, this is exactly what I came to WoW Interface for, watching this thread with eagerness.

I'm trying to modify TomTom to store the arrow location in a character SavedVar rather than in layout-local.txt which gets hosed if you disable the addon.
  Reply With Quote
07-19-21, 11:06 PM   #3
Ekaterina
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 64
Hi,
For number 1 - Note: I haven't tested this
I think that the problem might be the way you're setting the scripts for moving the frame. At line 21, Try
Lua Code:
  1. frame:SetScript("OnDragStart", function(self)
  2.  if not InCombatLockdown()
  3.    self:StartMoving()
  4.  end
  5. end)

and line 22
Lua Code:
  1. frame:SetScript("OnDragStop", function(self)
  2.  if not InCombatLockdown() then
  3.    self:StopMovingOrSizing()
  4.  end
  5. end)

For number 2.
The frame Strata is set too high for what you want. Change the frame strata level from HIGH on line 19 to a lower strata like BACKGROUND. https://wowpedia.fandom.com/wiki/Frame_Strata


auLanTisteNT, you will need to save the position as a part of your OnDragStop function. Phanx does it here. https://github.com/phanx-wow/CrowBar/blob/master/core.lua. Phanx no longer plays or monitors the community but her coding is beautiful.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Help with Frame.

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