Thread Tools Display Modes
Old 07-03-09, 01:16 PM   #1
Rhamses
A Theradrim Guardian
Join Date: Jun 2009
Posts: 61
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
Rhamses is offline  
Old 07-03-09, 01:39 PM   #2
Xrystal
nUI User and Supporter
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,025
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.
__________________
Xrystal is offline  
Old 07-03-09, 04:46 PM   #3
Rhamses
A Theradrim Guardian
Join Date: Jun 2009
Posts: 61
Oh wow, thanks! You all are doing a great job teaching a man to fish

Rhamses
Rhamses is offline  
Old 07-03-09, 04:56 PM   #4
Xrystal
nUI User and Supporter
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,025
Rofl, it taught me well a few months back when I was learning

My first addon was written in March and it took me a while to figure it out
__________________
Xrystal is offline  
Old 07-03-09, 05:25 PM   #5
Rhamses
A Theradrim Guardian
Join Date: Jun 2009
Posts: 61
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 is offline  
Old 07-03-09, 06:24 PM   #6
Rhamses
A Theradrim Guardian
Join Date: Jun 2009
Posts: 61
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

Last edited by Rhamses : 07-03-09 at 06:35 PM.
Rhamses is offline  
Old 07-03-09, 06:48 PM   #7
Xrystal
nUI User and Supporter
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,025
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.
__________________
Xrystal is offline  
Old 07-03-09, 07:13 PM   #8
Rhamses
A Theradrim Guardian
Join Date: Jun 2009
Posts: 61
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
Rhamses is offline  
 

Go BackWoWInterface » Featured Projects » nUI, MozzFullWorldMap and PartySpotter » Customization » nUI: Developer Chat » Icon texture instead of box

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off