WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   nUI: Developer Chat (https://www.wowinterface.com/forums/forumdisplay.php?f=96)
-   -   Icon texture instead of box (https://www.wowinterface.com/forums/showthread.php?t=25175)

Rhamses 07-03-09 01:16 PM

Icon texture instead of box
 
I am working on an addon that gices a warning to drain souls. I am pulling some different code together.

I have
function ExecuteWarning_OnLoad()
ExecuteWarning_BuffFrame:Show();
ExecuteWarning_BuffFrame:SetAttribute('type', 'spell')
ExecuteWarning_BuffFrame:SetAttribute('spell', "Drain Soul")
getglobal(ExecuteWarning_BuffFrame:GetName().."_Text"):SetText( "Loaded!" );.

This allows me to take the previous text warning and turn it into a button that can be clicked to drain soul.

I have found the physical dimension in the XML file.

If I wanted to have a Soul Shard icon instead of the box, how do I change the texture? If it is a root path and you do not know it you can write the first part Interface/*** and I will hunt it out.

When I try to change the texture in xml or lua I just get errors. 8 (

Rhamses

Xrystal 07-03-09 01:39 PM

If you find the spellID/itemID from wowhead for the soul shard item and then use GetItemInfo to get the information you will be able to get the icon file used for that item.

http://www.wowhead.com/?item=6265
http://www.wowwiki.com/API_GetItemInfo

This means that 6265 is the itemID so using the following command will grab the icon path for you to use as a texture file name.

itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount,
itemEquipLoc, itemTexture = GetItemInfo(itemID)

To make things easier because you may not need the other info you can just do this.

itemTexture = select(10,GetItemInfo(itemID))

This will select the 10th item in the return list from that function.

Rhamses 07-03-09 04:46 PM

Oh wow, thanks! You all are doing a great job teaching a man to fish :banana:

Rhamses

Xrystal 07-03-09 04:56 PM

Rofl, it taught me well a few months back when I was learning :D

My first addon was written in March and it took me a while to figure it out :D

Rhamses 07-03-09 05:25 PM

oops, that fish got away.

I may have put the code in the wrong place. I do not get an errorr, but I am unable to change the frame from a simple box. In the lua code I have

if (UnitName("target") == nil) then
ExecuteWarning_BuffFrame:SetAttribute('itemTexture' , 'select(10,GetItemInfo(6265))')
numShards = GetItemCount("Soul Shard");

ExecuteWarning_BuffFrame:SetBackdropColor( 1, 1, 1, 1 );
getglobal(ExecuteWarning_BuffFrame:GetName().."_Text"):SetText( numShards .." / ".. maxShards );

I have tried to place the same command ('Item...) in the on load and it does not change either. My guess is that the XML file called "secure handler is over-riding the lua? In the xml I find

- <Frame name="ExecuteWarning_secureFrames" hidden="true" virtual="true" inherits="SecureActionButtonTemplate" parent="UIParent">
- <Size>
<AbsDimension x="80" y="30" />
</Size>
- <Backdrop bgFile="Interface/Tooltips/UI-Tooltip-Background" edgeFile="Interface/Tooltips/UI-Tooltip-Border" tile="true">
- <BackgroundInsets>
<AbsInset left="4" right="4" top="4" bottom="4" />
</BackgroundInsets>
- <TileSize>
<AbsValue val="16" />
</TileSize>
- <EdgeSize>
<AbsValue val="16" />
</EdgeSize>
</Backdrop>


As well as
- <Button name="ExecuteWarning_BuffFrame" hidden="true" inherits="ExecuteWarning_secureFrames" enableMouse="true" movable="true">

Rhamses 07-03-09 06:24 PM

wow, my head is really spinning now. Maybe, I should toss out this "secure Frame" file and try to rewrite what I think it is doing in the lua files I have played with. Learning one language is hard enough without bouncing back and forth

Art

Xrystal 07-03-09 06:48 PM

Hmm, not sure there. Not touched xml files since day 1 of playing with addons. All my addons are pure lua now but I do recall having problems getting the secure action buttons working properly so maybe looking at how I did the lua side from the portal addon may help you figure out the difference.

Rhamses 07-03-09 07:13 PM

Will Do.

I have torn out the code that does not work or I would not use from Demonomicon. I have it so it automatically tries Fel Domination rather than left clicking alt, type stuff. I have fixed Execute Warning1.0 and modified it. I do not need to know 24.23% and changed some of the colors. I have also supplemented with a shard management tool to delete shards above 28. Eventually, I will make it a variable for the player, but I do not know how, yet and my bag is only a 28'er.

A couple of weeks ago, I made some cheezy aura monitoring. Like, playing,
"Needs Food Badly"
from the old Guantlet game when food buff is missing and

Mmmmmm Beer by homer simpson without flask 8 )

Rhamses


All times are GMT -6. The time now is 08:39 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI