11/01/14, 07:31 PM | #1 |
How do you call an image up?
I have a custom image I want to call up. So my question is how exactly do I call an image from a folder within my addon?
I'm pretty sure this isn't correct but this lua code should give you an idea of what I'm doing. The code is no where near finished so don't worry about the other parts. If you'll also read my comments within my code you see where and what I'm trying to do. I'm using the zone index for when a player enters a specific zone to call up the image with a name above the image. I'll add the slash command later in the code so don't worry. Also I remembered someone saying the image can't be jpg but another type please let me know what format the image has to be in and if I can use paint or what free program I might need to change it from jpg to what ever format I need to put it in. Lua Code:
Don't mind the QuestLurker stuff I will rename it I'm just using some of my other code as a short cut to put my code togeather for this new addon I'm building. Last edited by zireko : 11/01/14 at 07:34 PM. |
|
11/01/14, 07:59 PM | #2 |
|
First off you need to convert your images to DDS. I've seen some topics on how to do that here, but never did that myself so can't tell if there aren't any pitfalls. Just search for DDS.
Don't use backslashes in file paths. Never. Not even on Windows. It's an evil from the past. Windows 95 understood forward slashes, I can't believe 20 years later people still use them backwards. Now to give you a real reason on top of zealous rant - in most programming languages, Lua included, backslashes in strings are special, escape characters. "\auridon" is not a backslash followed by auridon, it's the ALARM character (aka BEL, ASCII 7), which on some consoles actually produces a sound, followed by uridon! [179] = "QuestMaps/Maps/auridon.dds", |
11/01/14, 09:33 PM | #3 |
As Merlight said, you will need to convert image to DDS first: http://www.esoui.com/forums/showthread.php?t=127
If you want to display image, you will need to create control which can display it - the easiest is using texture control. Simple example in XML: Lua Code:
The same as above in Lua: Lua Code:
Now just check if you image path exists and if so display it: Lua Code:
(untested, but I think you have an idea what I mean) |
|
11/02/14, 09:04 AM | #4 |
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:
xml Lua Code:
lua Lua Code:
|
|
11/02/14, 09:41 AM | #5 |
- You should use either XML or LUA for creating your controls, not both at the same time.
- Not all DDS files will be displayed. If you add any image to the addons folder, it wont be loaded until you restart game client (image must be present in addons folder when game is started). Second reason why image could not be displayed is invalid DDS format. Make sure that image dimensions are power of 2 - 2, 4, 8, 16, ... 128, 256, 512, ... If your image does not fit, make it bigger and then set texture coordinates to show only the part of the image - <TextureCoords top="0" bottom="1" left="0" right="1" />, coordinates are normalized numbers between 0 and 1, topleft point has coordinates 0,0 and bottomright has coordinates 1,1. If you want to test if the issue is caused by image and not by some mistake in addon code use one of ingame textures, for example "EsoUI/Art/Login/loginBG_ourosboros.dds" or "EsoUI/Art/Lockpicking/lock_body.dds". Last edited by Garkin : 11/02/14 at 09:58 AM. |
|
11/02/14, 12:56 PM | #6 |
I got the image to pull up however I think there is a problem some where in the table or the local function QuestMaps()
Because I can go above and comment the code out and pull up the image. Right now I'm just getting a white box I have it un hidden so that I can see the img currently. Here is the code I have. Lua Code:
|
|
11/02/14, 04:11 PM | #7 |
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:
|
|
11/02/14, 04:51 PM | #8 |
A silly question - are you trying it in Auridon? It wont work in different zones because there are no image paths.
Make a small change: Lua Code:
|
|
11/02/14, 05:44 PM | #9 |
Still just getting the whitebox and I changed the code too
Lua Code:
O and yes I'm in Auridon when testing this. Last edited by zireko : 11/02/14 at 05:52 PM. |
|
11/02/14, 06:04 PM | #10 |
Never mind I finally figured out what it was. I wasn't calling the funtion QuestMaps() in my OnAddOnLoaded local function. Once I added it there under my slash command it started working. So guess my rule I learned is to always call your function or it wont work lol.
|
|
11/02/14, 09:06 PM | #11 |
|
|
05/02/23, 11:24 AM | #12 |
|
total necro but is ontopic so worth it.
Im looking at using some of this to add the currency images for gold, ap, telvar and writ vouchers to my bank balance output. My question is would i need to make 4 seperate top level windows or 4 controls within it? Or can i reuse the same one and change the image being used on the fly in the same line of text output? Code:
local tlw = WINDOW_MANAGER:CreateTopLevelWindow("WindowName") tlw:SetDimensions(256,256) tlw:SetAnchor(CENTER) tlw:SetHidden(true) local image = WINDOW_MANAGER:CreateControl("WindowNameImage", tlw, CT_TEXTURE) image:SetAnchorFill(tlw) WindowNameImage:SetTexture("QuestVisions/Maps/auridon.dds") Code:
df(tlwap .. "gold amount here" .. tlwap .. "ap amount here" .. tlwtelvar .. "telvar amount here" .. tlwwv .. "writ voucher amount here") **EDIT nevermind I think I may have found a way with something like this: |t120:120:esoui/art/icons/pet_081.dds|t Last edited by sinnereso : 05/02/23 at 02:36 PM. |
05/02/23, 01:48 PM | #13 |
If you only want to show 1 line with the textutes inline in the text you do not need to create any control, just use the API functions named at the Wiki for Textures > in Strings.
https://wiki.esoui.com/Text_Formatting -> ZOs icon in text API functions If you want to have an UI with the textures for each of the currencies at fixed positions, you need to create sme texture controls and label controls and anchor them to stay at the same position and fill the texture controls with the currency textures and the labels with the amount. Or just use label controls and add text including the currency textures via the above mentioned API functions to add textures into Strings. Last edited by Baertram : 05/02/23 at 11:28 PM. |
|
05/02/23, 05:38 PM | #14 |
|
Yeh I discovered that after I posted. The text formatting was exactly what i needed.
Im just polishing up now. Making sure it looks and feels good and does what its supposed to do all the time. |
ESOUI » Developer Discussions » General Authoring Discussion » How do you call an image up? |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|