View Single Post
11/02/14, 04:11 PM   #7
zireko
 
zireko's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 63
I been playing around with it and have figured out the problem is in the table and the call (imgQuests). I even did a test of my own and found that when I call the image like this

WindowNameImage:SetTexture("QuestVisions/Maps/auridon.dds")

It will come up. However if I call the image like this.

WindowNameImage:SetTexture(imgQuests)

It will dispaly a 700x700 white box which is my settings. So I'm pretty sure my problem is how to call it after I have tried to assign it to the table. In other words it's trying but not getting it fully. Here is my entire code. Only thing that isn't working is the image call from the table.

Lua Code:
  1. --This code displays the image with lua so no need for any xml.
  2.  
  3. local tlw = WINDOW_MANAGER:CreateTopLevelWindow("WindowName")
  4. tlw:SetDimensions(700,700)
  5. tlw:SetAnchor(CENTER)
  6. tlw:SetHidden(false)
  7.  
  8. local image = WINDOW_MANAGER:CreateControl("WindowNameImage", tlw, CT_TEXTURE)
  9. image:SetAnchorFill(tlw)
  10.  
  11. --WindowNameImage:SetTexture("QuestVisions/Maps/auridon.dds")
  12.  
  13. --[[This table is the zone index map and what I want it to display. Example [179] = 51, would be quest number to display. However
  14. instead of 51, we could place an image here.]]--
  15.  
  16. --Custom images must be in .dds format a picture program like photoshop or gimp should be able to convert the image.
  17. --To call an image it would be example "QuestVisions/Maps/auridon.dds" or [[QuestVisions/Maps/auridon.dds]].
  18. --[[IMPORTANT: The image seems like it's not able to pull from the table.
  19. I'm having to do a direct call to the image to get it to come up. With the Table I just get a 700x700 white box.]]--
  20.  
  21. local questZone ={
  22. --Aldmeri Dominion
  23.     [179] = "QuestVisions/Maps/auridon.dds", --Auridon
  24.     [295] = 11, --Khenarthi's Roost
  25.     [181] = 44, --Grahtwood
  26.     [19]  = 50, --Greenshade
  27.     [12]  = 45, --Malabal Tor
  28.     [180] = 60, --Reaper's March
  29.  
  30. --Daggerfall Covenant
  31.     [293] = 15, --Stros M'Kai
  32.     [294] = 9,  --Betnikh
  33.     [2]   = 67, --Glenumbra
  34.     [4]   = 70, --Stormhaven
  35.     [5]   = 48, --Rivenspir
  36.     [18]  = 53, --Alik'r Desert
  37.     [15]  = 47, --Bangkorai
  38.  
  39. --Ebonheart Pact
  40.     [110] = 12, --Bleakrock Isle
  41.     [111] = 9,  --Bal Foyen
  42.     [9]   = 76, --Stonefalls
  43.     [11]  = 67, --Deshaan
  44.     [20]  = 64, --Shadowfen
  45.     [16]  = 52, --Eastmarch
  46.     [17]  = 73, --The Rift
  47.  
  48. --All other quest/other
  49.     [155] = 32, --Coldharbour
  50.     [353] = 18, --Craglorn
  51.     [38] = 566, --Cyrodiil
  52. }
  53.  
  54. --[[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
  55. display the quest number I've provided. Instead of a quest number I can add an image.]]--
  56.  
  57. -- QuestMapsQuest:SetTexture is how we call the texture which is our image. MyBackdropElement:SetCenterTexture([[Maps/auridon.dds]])
  58.  
  59. local function QuestMaps()
  60.     local zoneIndex = GetCurrentMapZoneIndex()
  61.     local imgQuests = questZone[zoneIndex]
  62.     if imgQuests ~= nil then
  63.         WindowNameImage:SetTexture(imgQuests)
  64.         WindowName:SetHidden(false)
  65.     else
  66.         WindowName:SetHidden(true)
  67.     end
  68. end
  69.  
  70. --This is to show and hide the image
  71.  
  72. local function ShowWindow()  
  73.     if WindowName:IsHidden() then
  74.         WindowName:SetHidden(false)
  75.     else
  76.         WindowName:SetHidden(true)
  77.     end
  78. end
  79.  
  80. --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.
  81.  
  82. local function OnAddOnLoaded(eventCode, addon)
  83.     if addon == "QuestVisions" then
  84.         EVENT_MANAGER:UnregisterForEvent("QuestVisions", EVENT_ADD_ON_LOADED)
  85.        
  86.         SLASH_COMMANDS["/maps"] = ShowWindow
  87.        
  88.         end
  89.     end
  90.  
  91. EVENT_MANAGER:RegisterForEvent("QuestVisions", EVENT_ADD_ON_LOADED, OnAddOnLoaded)
  92. EVENT_MANAGER:RegisterForEvent("QuestVisions", EVENT_ZONE_CHANGED, QuestMaps)
  Reply With Quote