Thread Tools Display Modes
08-31-16, 10:16 PM   #1
asdf
A Deviate Faerie Dragon
Join Date: Feb 2005
Posts: 18
Scrolling Combat Text Abbreviator

Are there any addons out there that can abbreviate large numbers in the default scrolling combat text? i.e. 200 instead of 200,000 or 1000 instead of 1,000,000. I can live with it if there is a "k" or "m" but ideally I'd like to be able to hide even that.

I can live with a full SCT replacement addon but only if it retains the ability to pop the text up around the target. When I tested addons like Miks, xCT, and SCT a year ago in WoD, they only appeared to have the ability to scroll down the screen in static "columns." That used to be our only option, but I've gotten used to numbers being centered around the target they actually apply to and don't want to give up that functionality.

However, I really hate the idea of 6 and 7 digits for every hit and would like to shorten the numbers so that I can more quickly mentally parse and compare.

Does this exist? Is it possible?
  Reply With Quote
09-01-16, 08:00 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You could try overwriting the CombatText frame's OnEvent handler with a copy of CombatText_OnEvent modified to use AbbreviateNumbers instead of BreakUpLargeNumbers. I'm not sure whether it would work, though.
__________________
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
09-04-16, 12:08 AM   #3
asdf
A Deviate Faerie Dragon
Join Date: Feb 2005
Posts: 18
Originally Posted by Phanx View Post
You could try overwriting the CombatText frame's OnEvent handler with a copy of CombatText_OnEvent modified to use AbbreviateNumbers instead of BreakUpLargeNumbers. I'm not sure whether it would work, though.
Do you have a primer on how I would do that? I'm a programmer by trade but have never written any LUA or a WoW addon. I can do Python and some general scripting, so I'm sure I can teach myself and test it, but if you could point me in the right direction I'd very much appreciate it.
  Reply With Quote
09-04-16, 02:52 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
1. Copy and paste the entire function from Blizzard's code into your addon file.

2. Add a "local" keyword in front of the function definition so it only exists in your file, not everywhere. "function DoStuff(x)" --> "local function DoStuff(x)"

3. Change each instance of the function names I mentioned where they're called from inside the function.

4. Set a new OnEvent handler on the CombatText frame, passing it your modified function.

You can use this tool to generate an addon package for your code if you're not sure how to write a TOC file and set up your folder structure.
__________________
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
09-05-16, 11:55 PM   #5
asdf
A Deviate Faerie Dragon
Join Date: Feb 2005
Posts: 18
Originally Posted by Phanx View Post
1. Copy and paste the entire function from Blizzard's code into your addon file.

2. Add a "local" keyword in front of the function definition so it only exists in your file, not everywhere. "function DoStuff(x)" --> "local function DoStuff(x)"

3. Change each instance of the function names I mentioned where they're called from inside the function.

4. Set a new OnEvent handler on the CombatText frame, passing it your modified function.

You can use this tool to generate an addon package for your code if you're not sure how to write a TOC file and set up your folder structure.
Thanks so much. I think I got everything except something related to the 4th step. I'm getting a Lua error on the line that I created to set the handler, in regards to finding the CombatText frame.

I used this:
CombatText:SetScript("OnEvent", CombatText_OnEvent);

And get this error:
code.lua:268: attempt to index global 'CombatText' (a nil value)

I think I'm missing something, is CombatText not a global frame?

edit: see reply below, I think I got past this hurdle.

Last edited by asdf : 09-06-16 at 01:35 AM.
  Reply With Quote
09-06-16, 01:32 AM   #6
asdf
A Deviate Faerie Dragon
Join Date: Feb 2005
Posts: 18
Ok I worked on it and got rid of the nil global error. Blizzard_CombatText wasn't loading before my addon so I had to change the code to this:

Code:
local name = "Blizzard_CombatText"
local f = CreateFrame("Frame")
local found = true
local function onevent(self, event, arg1, ...)
  if(found and event == "ADDON_LOADED" and name == arg1) then
    found = nil
    f:UnregisterEvent("ADDON_LOADED")
    print("found", arg1)
    CombatText:SetScript("OnEvent", CombatText_OnEvent);
  else
    print(arg1)
  end
end

f:RegisterEvent("ADDON_LOADED")
f:SetScript("OnEvent", onevent)
Below my local version of CombatText_OnEvent, that is. Which I believe works, but the AbbreviateNumbers function doesn't appear to be working properly. The combat text's font appears to have been affected, but the numbers themselves aren't getting shortened.

I'm going to investigate AbbreviateNumbers and hopefully find out what I can do to make my output what I want it to be.

Last edited by asdf : 09-06-16 at 01:37 AM.
  Reply With Quote
09-06-16, 01:55 AM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Does it work if, instead of AbbreviateNumber, you simply change the output to an arbitrary string like "TEST"?

That's where the "you could try" part of my original response comes in -- it may be that the combat text system, once loaded into memory, can't be affected by any further changes by addons. This would be in keeping with things like the NAME_TEXT_FONT global, which can be overridden to change the font used for unit names in the game world, but only if it's called early in the loading process, and changes persist through UI reloads, and additional changes after logging in are ignored.

Another (simpler) way you can solve the load-on-demand problem is to just write this in your TOC file:
## LoadOnDemand: 1
## LoadWith: Blizzard_CombatText
Then your addon will automatically be loaded right after Blizzard_CombatText.
__________________
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
09-06-16, 02:58 AM   #8
asdf
A Deviate Faerie Dragon
Join Date: Feb 2005
Posts: 18
Originally Posted by Phanx View Post
Does it work if, instead of AbbreviateNumber, you simply change the output to an arbitrary string like "TEST"?

That's where the "you could try" part of my original response comes in -- it may be that the combat text system, once loaded into memory, can't be affected by any further changes by addons. This would be in keeping with things like the NAME_TEXT_FONT global, which can be overridden to change the font used for unit names in the game world, but only if it's called early in the loading process, and changes persist through UI reloads, and additional changes after logging in are ignored.

Another (simpler) way you can solve the load-on-demand problem is to just write this in your TOC file:
## LoadOnDemand: 1
## LoadWith: Blizzard_CombatText
Then your addon will automatically be loaded right after Blizzard_CombatText.
I'm still trying to get it to work, but the more I look into CombatText_OnEvent the less I understand. I'm able to print strings wherever the code is executing, so my local version is getting executed. However, I'm not sure if the combat text itself is actually sent through this event handler (???).

Here's where I'm at. If I attack with an ability on a target dummy on a Rogue, I get executions of the following events:
PLAYER_REGEN_DISABLED (entering combat), COMBAT_TEXT_UPDATE (arg1: ENERGIZE, happens twice), COMBAT_TEXT_UPDATE (arg1: SPELL_AURA_START), UNIT_POWER (happens 3x), COMBAT_TEXT_UPDATE (arg1: SPELL_AURA_END), UNIT_POWER (3x), PLAYER_REGEN_ENABLED (when I leave combat), UNIT_POWER

But I can't seem to find the actual damage value in any of these events. And if I attack with no weapon/procs equipped and just autoattack with a fist, the only events I get are PLAYER_REGEN_DISABLED and PLAYER_REGEN_ENABLED. There are no events fired on each autoattack, at least not ones that are caught by my handler.

And within the code of the function itself, it doesn't actually get to the end when it does execute. This part of the function:
Code:
  -- See if we should display the message or not
  if ( not info.show ) then
    -- When Resists aren't being shown, partial resists should display as Damage
    if (info.var == "COMBAT_TEXT_SHOW_RESISTANCES" and arg3) then
      if ( strsub(messageType, 1, 5) == "SPELL" ) then
        messageType = arg4 and "SPELL_DAMAGE_CRIT" or "SPELL_DAMAGE";
      else
        messageType = arg4 and "DAMAGE_CRIT" or "DAMAGE";
      end
    else
      return;
    end
  end
Returns always because (info.var == "COMBAT_TEXT_SHOW_RESISTANCES" and arg3) seems to never be true for any of the events that it's processing.

At the end is the only call to addMessage that I can find in all of Blizzard_CombatText.lua:
Code:
  -- Add the message
  if ( message ) then
    print("adding message: ", message)
    CombatText_AddMessage(message, COMBAT_TEXT_SCROLL_FUNCTION, info.r, info.g, info.b, displayType, isStaggered);
  end
I added the print statement and it never gets executed. So how are the combat messages getting on the screen if AddMessage isn't called? Is there other combat text code somewhere else?

-----

Edit: Played around with print some more and confirmed that I was only getting secondary events, the actual "damage" event of COMBAT_TEXT_UPDATE doesn't seem to be getting caught.

Code:
[05:09:37] Event: UNIT_POWER  arg1: player  data: COMBO_POINTS  arg3: nil  arg4: nil
[05:09:37] Event: COMBAT_TEXT_UPDATE  arg1: ENERGIZE  data: 15  arg3: ENERGY  arg4: nil
[05:09:38] Event: COMBAT_TEXT_UPDATE  arg1: SPELL_AURA_START  data: Opportunity  arg3: nil  arg4: nil
[05:09:38] Event: COMBAT_TEXT_UPDATE  arg1: ENERGIZE  data: 1  arg3: COMBO_POINTS  arg4: nil
[05:09:38] Event: UNIT_POWER  arg1: player  data: ENERGY  arg3: nil  arg4: nil

Last edited by asdf : 09-06-16 at 03:13 AM.
  Reply With Quote
09-06-16, 03:26 AM   #9
asdf
A Deviate Faerie Dragon
Join Date: Feb 2005
Posts: 18
Oh, shit. I figured it out. So I forced the watched entity for COMBAT_TEXT_UPDATE to my target by adding CombatTextSetActiveUnit("target"); as a line right near the top of CombatText_OnEvent. Immediately I started getting events fired for all my damage done, but backwards:
Code:
[05:17:58] Event: COMBAT_TEXT_UPDATE  arg1: DAMAGE  data: 324561  arg3: nil  arg4: nil
[05:17:58] adding message:  -324,561
And in the middle of my screen I started getting messages as if I was taking damage (but negative, as you can see in the print statement above). So I guess the purpose of that function is for damage/healing received by the player, along with resource gains and so forth. It's also just a normal column spread in the middle of the screen, just like addons such as SCT and Mik's, it's not the damage done combat text which pops up on units in dynamic positions around the screen.

So the method seems right, but the function being modified is not what I'm looking for. Are there other resources out there or am I out of luck?
  Reply With Quote
09-06-16, 09:51 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You can look around in the Blizzard UI source code but it seems likely you simply cannot modify this part of the UI, since it's rendered in the game world rather than in the UI. Probably once the UI code for it is loaded into memory, it's copied over to the game world rendering system, and after-the-fact modifications to it in the UI space just aren't copied over, so they have no effect. This is how the UNIT_NAME_FONT global works, too.
__________________
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
09-08-16, 02:31 AM   #11
asdf
A Deviate Faerie Dragon
Join Date: Feb 2005
Posts: 18
Originally Posted by Phanx View Post
You can look around in the Blizzard UI source code but it seems likely you simply cannot modify this part of the UI, since it's rendered in the game world rather than in the UI. Probably once the UI code for it is loaded into memory, it's copied over to the game world rendering system, and after-the-fact modifications to it in the UI space just aren't copied over, so they have no effect. This is how the UNIT_NAME_FONT global works, too.
Do you know of any hooks that can mimic the effect? Can I create frames that are attached to nameplates (and will move around in real time) and filter out combat log events based on the unit they're applied to? Is the UI flexible enough for this?

Cause if it is I might just write my own addon and do all this from scratch.
  Reply With Quote
09-08-16, 02:10 PM   #12
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Now that the nameplates have valid unitIDs this may be possible.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-11-16, 01:03 AM   #13
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
It should be doable; just get the GUID for each nameplate's unit when it changes (NAMEPLATE_UNIT_ADDED event) and keep a table mapping GUID->nameplate, then in your COMBAT_LOG_EVENT_UNFILTERED handler, consult your map to figure out which nameplate (if any) to show the combat text for that event on.
__________________
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

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Scrolling Combat Text Abbreviator


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