View Single Post
11/02/14, 09:04 AM   #4
zireko
 
zireko's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 63
Maybe you can see what I'm doing wrong. I feel like I'm doing everything perfectly but the image just isn't showing up. I have it converted to dds however it doesn't display. In the xml I set hidden as false just to test the addon and everything. So here is my code currently.

txt

Lua Code:
  1. ## Title: |cFFFFB0QuestVisions 1.0|r by - |c00C000Zireko|r
  2. ## APIVersion: 100009
  3. ## Description:
  4. ## Version: 1.0
  5.  
  6. QuestVisions.lua
  7. QuestVisions.xml

xml

Lua Code:
  1. <GuiXml>
  2.     <Controls>
  3.         <TopLevelControl name="WindowName" hidden="true">
  4.             <Dimensions x="256" y="256">
  5.             <Anchor point="CENTER">
  6.             <Controls>
  7.                 <Texture name="$(parent)Image">
  8.                     <AnchorFill />
  9.                 </Texture>
  10.             </Controls>
  11.         </TopLevelControl>
  12.     </Controls>
  13. </GuiXml>

lua

Lua Code:
  1. --[[This table is the zone index map and what I want it to display. Example [179] = 51, would be quest number to display. However
  2. instead of 51, we could place an image here.]]--
  3.  
  4. --Custom images must be in .dds format a picture program like photoshop or gimp should be able to convert the image.
  5. --To call an image it would be example "QuestVisions/Maps/auridon.dds" or [[QuestVisions/Maps/auridon.dds]].
  6. local questImage ={
  7. --Aldmeri Dominion
  8.     [179] = "QuestMaps/Maps/auridon.dds", --Auridon
  9.     [295] = 11, --Khenarthi's Roost
  10.     [181] = 44, --Grahtwood
  11.     [19]  = 50, --Greenshade
  12.     [12]  = 45, --Malabal Tor
  13.     [180] = 60, --Reaper's March
  14.  
  15. --Daggerfall Covenant
  16.     [293] = 15, --Stros M'Kai
  17.     [294] = 9,  --Betnikh
  18.     [2]   = 67, --Glenumbra
  19.     [4]   = 70, --Stormhaven
  20.     [5]   = 48, --Rivenspir
  21.     [18]  = 53, --Alik'r Desert
  22.     [15]  = 47, --Bangkorai
  23.  
  24. --Ebonheart Pact
  25.     [110] = 12, --Bleakrock Isle
  26.     [111] = 9,  --Bal Foyen
  27.     [9]   = 76, --Stonefalls
  28.     [11]  = 67, --Deshaan
  29.     [20]  = 64, --Shadowfen
  30.     [16]  = 52, --Eastmarch
  31.     [17]  = 73, --The Rift
  32.  
  33. --All other quest/other
  34.     [155] = 32, --Coldharbour
  35.     [353] = 18, --Craglorn
  36.     [38] = 566, --Cyrodiil
  37. }
  38.  
  39. --This code defines the window within the game which will get the image to show up in the window.
  40.  
  41. local tlw = WINDOW_MANAGER:CreateTopLevelWindow("WindowName")
  42. tlw:SetDimensions(256,256)
  43. tlw:SetAnchor(CENTER)
  44. tlw:SetHidden(true)
  45.  
  46. local image = WINDOW_MANAGER:CreateControl("WindowNameImage", tlw, CT_TEXTURE)
  47. image:SetAnchorFill(tlw)
  48.  
  49. --[[This function pulls up what I want displayed for each zone like in questlurker it uses the zone index map to find the zone then
  50. display the quest number I've provided. Instead of a quest number I can add an image.]]--
  51.  
  52. -- QuestMapsQuest:SetTexture is how we call the texture which is our image. MyBackdropElement:SetCenterTexture([[Maps/auridon.dds]])
  53.  
  54. local function QuestMaps()
  55.     local zoneIndex = GetCurrentMapZoneIndex()
  56.     local imgQuests = questImage[zoneIndex]
  57.     if imgQuests ~= nil then
  58.         WindowNameImage:SetTexture(imgQuests)
  59.         WindowName:SetHidden(false)
  60.     else
  61.         WindowName:SetHidden(true)
  62.     end
  63. end
  64.  
  65. --This loads your addon and registers/unregisters the events so that the addon will know what it needs to do. Also it sets up the slash command.
  66.  
  67. local function OnAddOnLoaded(eventCode, addon)
  68.     if addon == "QuestVisions" then
  69.         EVENT_MANAGER:UnregisterForEvent("QuestVisions", EVENT_ADD_ON_LOADED)
  70.        
  71.         SLASH_COMMANDS["/maps"] = function()
  72.             QuestVisions:ToggleHidden()
  73.            
  74.         QuestMaps()
  75.        
  76.         end
  77.     end
  78. end
  79.  
  80. EVENT_MANAGER:RegisterForEvent("QuestVisions", EVENT_ADD_ON_LOADED, OnAddOnLoaded)
  81. EVENT_MANAGER:RegisterForEvent("QuestVisions", EVENT_ZONE_CHANGED, QuestMaps)
  Reply With Quote