[v1.7.0+] UI Hardening

A place to post your add ons and ideas for them

Moderator: Moderator

Post Reply
Message
Author
Zizzo
Sher'Tul Godslayer
Posts: 2521
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

[v1.7.0+] UI Hardening

#1 Post by Zizzo »

We've all seen it happen: something goes wrong and the screen goes solid black and unresponsive. Usually this is an error in the UI; the description text for a timed effect from some addon, for instance, has a bug in it, and the game trips over that bug thirty times a second trying to build the UI every frame. I just tripped over that recently myself, and decided to try to, if not fix it, at least guard against it — hence my new UI Hardening addon.

Basically, there are a few places in the UI that call methods defined by addons, like a temporary effect's .long_desc() method, and those places should really be using Lua's "protected mode" via pcall() to catch any error that might happen in the addon code before it can break the UI. So far I've added that protection to the timed effect stuff described above; the timed effect will appear in the buffs display as usual, but with a red border, and the broken description text will be replaced with a short description of the error. There are almost certainly other places that need similar protection (maybe buggy talent descriptions in the hotkeys toolbar?); I'll add those as I find them.

And as long as I was in the proverbial area, I figured I might as well also patch up another long-standing small bug-related thing: Have you ever seen an error dialog pop up containing nothing but the entirely cryptic message "bad argument"? What you're supposed to be seeing is an error along the lines of "bad argument #2 to 'tformat' (number expected, got nil)" and the usual stack trace. See that '#' character? The text display code is trying to treat it as the start of one of the engine's TString highlighting codes like #RED# or #{bold}#, and basically absorbing the entire rest of the error text in the process. We fix this using the trick I used in Notes to Self, by replacing each occurrence of the '#' character with a custom mini-Entity that displays as a '#' character.

[And looking ahead, I suppose this could go into ZOmnibus or ZOmnibus Lite; for now I'm categorizing it as a bugfix addon.]
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2521
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.7.0+] UI Hardening

#2 Post by Zizzo »

Small improvements in v1a; we now also wrap a pcall() around the UI's call to a temporary effect's .get_fractional_percent() method, which is what shows the "clock-like" progress display on effects like Wild Speed (and which we add to Displacement Shield and Time Shield in other addons). Tripped over that one while working on another addon:oops: :wink:
"Blessed are the yeeks, for they shall inherit Arda..."

Post Reply