Thread Tools Display Modes
07-15-05, 04:56 AM   #1
Reolin
A Deviate Faerie Dragon
 
Reolin's Avatar
Join Date: Jul 2005
Posts: 10
A little Floatbar help

Greeting all!

I'm trying to achieve something rather difficult using the Floatbar addon.

I would like to have 1 bar, that will show the current/maximum skill level for whatever weapon is currently equipped.

Now I'm not sure if this is possible or not, but it does seem like it should be.

Here's the code that it gives me to edit.

Current:

local function curv(bar, data)
return 0;
end

You must define the function curv() to return the bar's current (token <curv>) value.
Function parameter 'bar" contains a reference to the tracking bar. Any interal information can be saved as members of the 'data' table (data is saved across logins).
NOTE: The return value for a custom token must one that can be converted to a valid NUMBER.


Minimum:

local function minv(bar, data)
return 0;
end

You must define the function minv() to return the bar's minimum (token <minv>) value.
Function parameter 'bar" contains a reference to the tracking bar. Any interal information can be saved as members of the 'data' table (data is saved across logins).
NOTE: The return value for a custom token must one that can be converted to a valid NUMBER.


Maximum:

local function maxv(bar, data)
return 0;
end

You must define the function maxv() to return the bar's maximum (token <maxv>) value.
Function parameter 'bar" contains a reference to the tracking bar. Any interal information can be saved as members of the 'data' table (data is saved across logins).
NOTE: The return value for a custom token must one that can be converted to a valid NUMBER.


Custom #1:

local function custom1(bar, data)
return 0;
end

You must define the function custom1() to return the bar's custom1 (token <custom1>) value.
Function parameter 'bar" contains a reference to the tracking bar. Any interal information can be saved as members of the 'data' table (data is saved across logins).
NOTE: The return value for a custom token must one that can be converted to a valid NUMBER.
Any help in this would be great. It's driving me up the wall.

Thanks in advance. (and sorry if this is the wrong area to be asking)
  Reply With Quote
07-16-05, 02:45 AM   #2
Reolin
A Deviate Faerie Dragon
 
Reolin's Avatar
Join Date: Jul 2005
Posts: 10
So I'm guessing that this is either really difficult or not possible.

I've been reading up almost everywhere I can find information.
Unless someone knows of an addon that displays the weapon skill..

Back to the drawing board I guess.

.. and sorry for the shameless bump.
  Reply With Quote
07-16-05, 05:51 AM   #3
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
The hardest part would be determining what type of weapon you have equipped, which is not entirely hard it will just require work on your part. In its simplest form, this will work:

in the xml:
<GameTooltip name="WeaponSkillTooltip" inherits="GameTooltipTemplate" parent="UIParent" hidden="true"/>

in the lua:
function GetWeaponSkill(slot)
local equipped,skillname,cur_skill,mod_skill,max_skill,i
WeaponSkillTooltip:SetInventoryItem("player",slot)
equipped = WeaponSkillTooltipTextRight3:GetText()
for i=1,GetNumSkillLines() do
skill,_,_,cur_skill,_,mod_skill,max_skill = GetSkillLineInfo(i)
skill = string.gsub(skill,"s$","")
if equipped==skill then
i = GetNumSkillLines()
else
cur_skill = nil
end
end
return cur_skill,mod_skill,max_skill
end

This will return the skill of the slot you give it if the name of the skill (minus any trailing S if there is one -- Daggers = Dagger) matches the name of the weapon type on the right of the third line of its tooltip. So it won't work for Staves. Staff != Stave

You will probably want to set up a table:
WeaponTypes = {
["Daggers"] = "Dagger",
["Staves"] = "Staff",
["Swords"] = "Sword",
-- etc
}

then something like

for i=1,GetNumSkillLines() do
skill,_,_,cur_skill,_,mod_skill,max_skill = GetSkillLineInfo(i)
for j=1,6 do
if WeaponTypes[skill] and WeaponTypes[skill]==getglobal("WeaponSkillTooltipTextRight"..j):GetText() then
i,j = GetNumSkillLines(),6 -- end loop
skill = nil
end
end
if skill then
cur_skill = nil
end
return cur_skill,mod_skill,max_skill
end

to scan the right side of the tooltip for a matching weapon type and skill type.
  Reply With Quote
07-17-05, 01:53 PM   #4
Reolin
A Deviate Faerie Dragon
 
Reolin's Avatar
Join Date: Jul 2005
Posts: 10
Thanks Gello.

For some reason Floatbar won't accept it.
Not that big a deal though.

Thanks for your time, it's greatly appreciated!
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » A little Floatbar help


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