Thread Tools Display Modes
11-30-09, 08:21 AM   #1
cormanthor
A Warpwood Thunder Caller
 
cormanthor's Avatar
AddOn Compiler - Click to view compilations
Join Date: Nov 2008
Posts: 97
scripting troubles

I am trying to get a script working, but I'm running into a couple of issues. The purpose of the script is to display my talent spec on my unit frame, and my target's (player only) spec on their unit frame. Example

Code:
Demonology
0/56/15
The data is good, and the format is right. But my issues are:

1) The script I have is not printing anything on my UF.
2) The script is printing my mouseover's spec on my target's UF

Any pointers, or is #2 "working as intended"?

Code:
text = ""
spec = ""
tree = ""
high = 0
if UnitIsUnit(uid, "player") then
    for i=1,GetNumTalentTabs() do
        name, _, points, _ = GetTalentTabInfo(i)
        if points > high then
            tree = name
            high = points
        end
        if i == 2 then
            spec = spec .. "/" .. points .. "/"
        else
            spec = spec .. points
        end
    end 
elseif UnitIsPlayer(uid) then
    for i=1,GetNumTalentTabs(true) do
        name, _, points, _ = GetTalentTabInfo(i,true)
        if points > high then
            tree = name
            high = points
        end
        if i == 2 then
            spec = spec .. "/" .. points .. "/"
        else
            spec = spec .. points
        end
    end 
end
text = tree .. "\n" .. spec
__________________
Some days it's just not worth chewing through the restraints...
  Reply With Quote
11-30-09, 06:00 PM   #2
cormanthor
A Warpwood Thunder Caller
 
cormanthor's Avatar
AddOn Compiler - Click to view compilations
Join Date: Nov 2008
Posts: 97
Well, I fixed the blunder I made with my UF (helps if you change the name in the UF when you rename a script!). So now I think I have the WoW API problem of GetTalentTabInfo(i,true) returning talents for my mouseover instead of my target. Cleaned up the code a bit too:
Code:
text = ""
spec = ""
tree = ""
high = 0
me = UnitIsUnit(uid, "target")
    for i=1,GetNumTalentTabs(me) do
        name, _, points, _ = GetTalentTabInfo(i,me)
        if points > high then
            tree = name
            high = points
        end
        if i == 2 then
            spec = spec .. "/" .. points .. "/"
        else
            spec = spec .. points
        end
    end
text = tree .. "\n" .. spec
__________________
Some days it's just not worth chewing through the restraints...
  Reply With Quote
11-30-09, 09:03 PM   #3
Dgrimes
A Black Drake
 
Dgrimes's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 89
As far as gaining talent info from another player you have to actually inspect them before you can obtain any information.

You can use this code as a base to better suit your needs.
Code:
text = "";
NotifyInspect("target");
for i =1, GetNumTalentTabs(true) do
    name, _, points = GetTalentTabInfo(i, true);

        text = text .. name .. "/" .. points .. "\n";

end
InspectFrame:Hide();
That will inspect your target and gather the information.

For some reason you are able to obtain the talent tree names instantly but you are unable to acquire the number of talents spent in each tree on the first click on the unit. You will need to either a) re-target that unit or b) add a periodic repaint to your window to update itself.

Sadly though not even with a repaint of 0.05 seconds is fast enough to get the talent point distribution from the player you are targeting since the client doesn't seem to be able to gather the information before the InspectFrame:Hide() is called.

I might have gone around it in a wrong way somewhere but I think it is more to blame blizzard in this case.
__________________
What was is, what will be was.
  Reply With Quote

WoWInterface » Featured Projects » OpenRDX » OpenRDX Community » OpenRDX: Community Chat » scripting troubles


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