View Single Post
04-09-18, 11:08 AM   #3
saxitoxin
A Theradrim Guardian
 
saxitoxin's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 60
Thank you so much for pointing me in the right direction and giving me the answer :P

now I have this:
Lua Code:
  1. local gearEditBox = CreateFrame("EditBox",nil,UIParent,"InputBoxTemplate")
  2. gearEditBox:SetSize(configFrame:GetWidth()/4.4,32)
  3. gearEditBox:SetPoint("TOPLEFT",12,-118)
  4. gearEditBox:IsNumeric()
  5. gearEditBox:SetText("|cffff0000 RIGHT-CLICK ME! ")
  6. gearEditBox:SetJustifyH("CENTER")
  7. gearEditBox:SetAutoFocus(false)
  8.  
  9. gearEditBox:HookScript("OnEnter", function(self)
  10.     GameTooltip:SetOwner(self,"ANCHOR_TOP")
  11.     GameTooltip:AddLine("Copy this text to the character.lua located at: ", 1,1,1)
  12.     GameTooltip:AddLine("Interface/AddOns/"..addon, 1,1,1)
  13.     GameTooltip:AddLine(" ")
  14.     GameTooltip:AddDoubleLine("right-click", "Sets the text in the editbox to the equipment", 1,1,1, 1,1,0)
  15.     GameTooltip:AddDoubleLine("ctrl + a", "marks all text", 1,1,1, 1,1,0)
  16.     GameTooltip:AddDoubleLine("ctrl + c", "copy the marked text", 1,1,1, 1,1,0)
  17.     GameTooltip:Show()
  18. end)
  19.  
  20. gearEditBox:HookScript("OnLeave", function()
  21.     GameTooltip:Hide()
  22. end)
  23.  
  24. local gearList = {}
  25. local visibleItemID = 0
  26.  
  27. gearEditBox:SetScript("OnMouseUp", function(self, button)
  28.     if button == "RightButton" then
  29.         gearList = table.wipe(gearList)
  30.        
  31.         for slotID = 1,19 do
  32.             if slotID == 2 or slotID == 11 or slotID == 12 or slotID == 13 or slotID == 14 or slotID == 18 then else
  33.                 local isTransmogrified = C_Transmog.GetSlotInfo(slotID, 0)
  34.                 if isTransmogrified then
  35.                     visibleItemID = C_TransmogCollection.GetSourceInfo(select(3, C_Transmog.GetSlotVisualInfo(slotID,0))).itemID
  36.                     if select(7, C_Transmog.GetSlotInfo(slotID, 0)) then visibleItemID = "nil" end
  37.                 else
  38.                     visibleItemID = GetInventoryItemID("player", slotID)
  39.                     if visibleItemID == nil then visibleItemID = "nil" end
  40.                 end
  41.                 if visibleItemID then
  42.                     if slotID == 19 then
  43.                         table.insert(gearList, "[ "..slotID.."] = ".. visibleItemID)
  44.                     else
  45.                         table.insert(gearList, "[ "..slotID.."] = ".. visibleItemID..", ")
  46.                     end
  47.                 end
  48.                
  49.             end
  50.         end
  51.     gearEditBox:SetText(unpack(gearList))
  52.    
  53.     --print(unpack(gearList))
  54.    
  55.     print("|cff6699FFSX |cffffff00WallpaperKit|r: Gear list printed in editbox")
  56.        
  57.     end
  58. end)
  59.  
  60. gearEditBox:SetScript("OnEnterPressed",function(s)
  61.  
  62.     gearEditBox:ClearFocus()
  63. -- local isTransmogrified, hasPending, isPendingCollected, canTransmogrify, cannotTransmogrifyReason, hasUndo, isHideVisual, texture = C_Transmog.GetSlotInfo(slotID, transmogType)
  64. end)
and it works great, except it only prints the first line of the table into the editBox, any help on how I can print the entire table into the editBox?

Last edited by saxitoxin : 04-09-18 at 11:15 AM.
  Reply With Quote