Thread Tools Display Modes
07-22-14, 04:42 PM   #1
basvanderwerff
A Murloc Raider
Join Date: Jul 2014
Posts: 9
Looking for help with modifying code tooltip addon

Hello,

I recently found this addon that changes the (gear) item tooltips to the pre 5.1 look (specificly the order of the info) it works great but it has a few issues.
- I cant seam to find anyway to set it up beside toggle it on or off with /betteritemtooltip or /bitip (found these 2 / commands when looking trough the code) the addon page itself does not have any info beside that the addon reverts it back to pre 5.1 look
- enchants show in a light blue now i did find a list of text colors in the code and when i change:
enchantColor = { 0.0, 0.82, 1.0 } to enchantColor = { 0.0, 1.0, 0.0 } wich should be green since it used on the lfr heroic flex color codes nothing happens.
- pvp seasons text shows in red on wich i tried the same as with the enchants change the color code but also no luck.
- It messes with (some) non-gear tooltips from the TSM addon quick example
a crafted item typically shows this at bottom of a tooltip (i left some part out since tsm has alot of modules)
tradskillmaster info:
group: professions->inscription->crafts->glyph
auctions operation(s): glyph
TSM crafting:
Crafting cost: (price in gold-silver-copper)
Now for some items is still shows the colored part but the rest it removes for example it still show.
tradskillmaster info:
group:
auctions operation(s):
TSM crafting:
Crafting cost:
- somehow it removes the . in dmg numbers for example a 1.350.456 chaosbolt shows as 1350456 it also does the same on item tooltips (3.545 agi showing as 3545 agi) so guess they related and caused by this addon.

Now my question is.
1) How can i change the color of the enchant and season both to green in the code (or is there some ingame way to set this up i could not find)
2) Is there a way to stop this addon from messing with TSM tooltips
3) Is there a way to stop it from removing the . in dmg/stats numbers.

I added the lua file as attachement, hope someone can help out what to change in the code for changing the colors and maby point me in the right direction of what causes the TSM conflicts and the removeal of the . in dmg/stat numbers.

Thanks alot in advance, Bas.
Attached Files
File Type: lua Kopie van BetterItemTooltip.lua (56.7 KB, 211 views)
  Reply With Quote
07-25-14, 08:07 AM   #2
basvanderwerff
A Murloc Raider
Join Date: Jul 2014
Posts: 9
I think this is the part that removes the split in large number.
frame:SetScript("OnEvent", function(self, event, ...)
if (event == "VARIABLES_LOADED") then
self:UnregisterEvent("VARIABLES_LOADED");
self:RegisterEvent("CVAR_UPDATE");
if (GetCVarBool("breakUpLargeNumbers")) then
SetCVar("breakUpLargeNumbers", nil);
end
BetterItemTooltip:OnInitialize();
elseif (event == "CVAR_UPDATE") then
if (GetCVarBool("breakUpLargeNumbers")) then
SetCVar("breakUpLargeNumbers", nil);
end
end
  Reply With Quote
07-25-14, 09:52 AM   #3
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
That must be a very old AddOn. Almost nobody registers and uses VARIABLES_LOADED. Instead, if you need it check when entering the world OR every UI reload, PLAYER_ENTERING_WORLD is used. If you only need it to check one time, use PLAYER_LOGIN, do processing, and unregister PLAYER_LOGIN in the same function.

You could even use ADDON_LOADED, and handle it that way.

The trouble with VL, iirc, is that its load order is inconsistent.

Also, next time please use the [ code ] [ /code ] tags, or the # symbol in the tools above. You may have to change your WowI forum settings to get the full toolset to display. For your short piece of code, the quote is okay, I guess, but the formatting is ruined and makes it harder to read.

Last edited by myrroddin : 07-25-14 at 10:12 AM. Reason: ADDON LOADED
  Reply With Quote
07-25-14, 01:32 PM   #4
basvanderwerff
A Murloc Raider
Join Date: Jul 2014
Posts: 9
As far as i know it was made after 5.1 so not that old.
Thank you for the heads up on how to post code properly (i only recently found this forum)
I solved some of my initial problems with the addon.
1) i got the color of the enchant and season text changed to green turned out there was a saved variables file also and ONLY changing it both in the lua code and saved variables changed it.
2) I solved the problem with TSM addon by moving the TMS tooltip to a seperate window (option of TSM)

Now i just need to solve the problem of the addon removing the large number seperators wich it does everywhere from dmg/healing gold stats ect ect, ill repost the piece of code wich i think it the culprit.
Code:
frame:SetScript("OnEvent", function(self, event, ...)
	if (event == "VARIABLES_LOADED") then
		self:UnregisterEvent("VARIABLES_LOADED");
		self:RegisterEvent("CVAR_UPDATE");
		if (GetCVarBool("breakUpLargeNumbers")) then
			SetCVar("breakUpLargeNumbers", nil);
		end
		BetterItemTooltip:OnInitialize();
	elseif (event == "CVAR_UPDATE") then
		if (GetCVarBool("breakUpLargeNumbers")) then
			SetCVar("breakUpLargeNumbers", nil);
		end
	end
end);
frame:RegisterEvent("VARIABLES_LOADED");
And also looking trough the code it sugests that there are /commands to set these colors and hide/show various things in game but please correct me if im wrong, the second piece of code repeats itself for each different color setting there is available, can post that also if needed.
Code:
	SLASH_BETTERITEMTOOLTIP1 = "/betteritemtooltip";
	SLASH_BETTERITEMTOOLTIP2 = "/bitip";
end

function BetterItemTooltip:Print(...)
	if not (...) then return; end
	print("|cff4fcfffBetterItemTooltip:|r "..(...));
end

local options = {};
SlashCmdList.BETTERITEMTOOLTIP = function(msg)
	if not msg then return; end
	wipe(options);
	for v in gmatch(strlower(msg), "[^ ]+") do
		options[#options + 1] = v;
	end
	if options[1] == "bonuscolor" then
		if tonumber(options[2]) and tonumber(options[3]) and tonumber(options[4]) then
			local r, g, b = tonumber(options[2]), tonumber(options[3]), tonumber(options[4]);
			if r > 1 then r = 1; elseif r < 0 then r = 0; end
			if g > 1 then g = 1; elseif g < 0 then g = 0; end
			if b > 1 then b = 1; elseif b < 0 then b = 0; end
			db.bonusColor[1] = r;
			db.bonusColor[2] = g;
			db.bonusColor[3] = b;
			AvgItemLvl:Print("Bonus Stats Color is now "..format("|cff%02x%02x%02x%s, %s, %s|r", r*255, g*255, b*255, r, g, b));
After this it goes trough all the available color settings it ends with.
Code:
	elseif options[1] == "on" then
		db.enable = true;
		BetterItemTooltip:Print("BetterItemTooltip is now "..(db.enable and "|cff00ff00on|r" or "|cffff0000off|r"));
	elseif options[1] == "off" then
		db.enable = false;
		BetterItemTooltip:Print("BetterItemTooltip is now "..(db.enable and "|cff00ff00on|r" or "|cffff0000off|r"));
		for _, tooltip in pairs(tooltips) do
			if _G[tooltip] then
				tipIsShown = 1;
				ItemTooltip_OnHide(_G[tooltip]);
			end
		end
After this it goes trough a list of non color option for example show/hide made by tag on items ect ect they all listed in the same format but again can post them all if needed they look like this.
Code:
	elseif options[1] == "shortbonus" then
		db.shortBonus = not db.shortBonus;
		BetterItemTooltip:Print("Bonus Stats are now using "..(db.shortBonus and "|cff00ff00short|r" or "|cffff0000long|r").." format");
So i just like to know can i set all these options in game with /commands or do i need to change them in the code?
And can i get large number seperation back again.

Thanks alot in advance, bas.
  Reply With Quote
07-26-14, 02:27 AM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by myrroddin View Post
That must be a very old AddOn. Almost nobody registers and uses VARIABLES_LOADED. ... The trouble with VL, iirc, is that its load order is inconsistent.
The trouble with VARIABLES_LOADED is that it can fire many times during the loading sequence, including before your addon's saved variables have been loaded. Its purpose is to inform the WoW client that some of its own settings (eg. Interface Options settings, key bindings, possibly action button assignment data from server?) have been loaded; it has not been an appropriate event for addon initialization since sometime back in the Burning Crusade. Either this addon is ancient, or its author found the most outdated resource on the entire internet to look at when they were developing it...

Originally Posted by basvanderwerff View Post
Now i just need to solve the problem of the addon removing the large number seperators wich it does everywhere from dmg/healing gold stats ect ect, ill repost the piece of code wich i think it the culprit.
Based on the code you posted, you should just be able to remove that entire chunk (or just comment it out) to stop the addon from stopping large numbers from behing formatted. Afterwards you may need to restore the CVar:

/run SetCVar("breakUpLargeNumbers", 1)

I'm not even sure why the addon is overriding this, as I'm pretty sure there aren't even any numbers in item tooltips that are long enough to qualify for break-up. Sounds like feature creep.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
07-26-14, 03:13 AM   #6
ObbleYeah
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 210
Originally Posted by Phanx View Post
The trouble with VARIABLES_LOADED is that it can fire many times during the loading sequence, including before your addon's saved variables have been loaded. Its purpose is to inform the WoW client that some of its own settings (eg. Interface Options settings, key bindings, possibly action button assignment data from server?) have been loaded; it has not been an appropriate event for addon initialization since sometime back in the Burning Crusade. Either this addon is ancient, or its author found the most outdated resource on the entire internet to look at when they were developing it...
I think either ElvUI or Aurora uses it liberally.
  Reply With Quote
07-27-14, 04:09 AM   #7
basvanderwerff
A Murloc Raider
Join Date: Jul 2014
Posts: 9
Originally Posted by Phanx View Post
I'm not even sure why the addon is overriding this, as I'm pretty sure there aren't even any numbers in item tooltips that are long enough to qualify for break-up. Sounds like feature creep.
I think cause those large numbersperators also got added in 5.1 but it just a quess since the addon discription only said restores the tooltips to pre 5.1.
Anyway ill give removing that piece of code a go and see if that does the trick.

Bases on the other code i linked is it possible to change settings in game beside toggle it on or off?
  Reply With Quote
08-03-14, 04:16 AM   #8
basvanderwerff
A Murloc Raider
Join Date: Jul 2014
Posts: 9
Putting in
Code:
frame:SetScript("OnEvent", function(self, event, ...)
    if ... == addonName then
        BetterItemTooltip:OnInitialize()
    end
end)
frame:RegisterEvent("ADDON_LOADED")
did the trick no errors or anything after that i ran

/run SetCVar("breakUpLargeNumbers", 1)
Now the addon works and it wont mess with large numbers anymore.

Thanks alot for those that helped to get it working good.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Looking for help with modifying code tooltip addon

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