This is a patch for Merlight's mer Torchbug inspection tool. Thanks merlight for this great inspector tool!


Optional dependencies:
If you want to use the context menu functions you need to install this library: LibCustomMenu
If you want to see the "outline" attribute at controls, and make the slash commands for outlining controls work, you need to install
Circonians Control Outlines version 1.7 or newer


What is mer Torchbug?
The idea behind this tool is (like with Zgoo as well) to inspect global variables/controls ingame to see their current attributes/parents/variables/values.
You can e.g. use /tbug <globalVariableNameOrFunction> (where <globalVariableNameOrFunction> could be e.g. MyAddon or GetUnitName("player")) to inspect this global variable, or show the results of the function call in the chat.

/tbug alone shows you the "global inspector" which holds texts, global variables, sounds, libraries etc.

An inspector (global, normal, table, control) is a window with possible tabs where you can click the different variables etc. and it will open another tab for them, so you are able to inspect (and change, if possible) some of the values of the inspected variables. __index shows you "inherited" functions and variables of the parent "class" (table, using metatables).


What are the base features or merTorchbug?
Please read here: mer Torchbug


What was added new with this patch?
Please read the changelog for a total list of bugfixes and changes.
Here is a short overview of new added slash commands and features.


Slash commands (enter into the chat editbox):
<searchText: optional> behind the slash commands means you can enter a search text like "bagId" and the inspector will show and filter to that searchText matches directly without you having to enter it at the search editfield (top left) manually.
  • /tb <variable : optional> <searchText: optional> -> Sames as /tbug. Without a <variable> the GlobalInspector (main TB UI, providing the constants,functions,objects,strings, ... tabs) will be shown!
  • /tbd <seconds> <variable> <searchText: optional> -> Inspect the variable delayed by <seconds> seconds
  • /tbdm <seconds> <searchText: optional> -> Inspect the control/object below the mouse cursor delayed by <seconds> seconds
  • /tbugm or /tbm <searchText: optional> -> Inspect control below mouse cursor
    -> Or use (SHIFT key + left&right mouse button) to inspect the control below the mouse
  • /zgoo (if not addon Zgoo is loaded) -> Sames as [color="MediumTurquoise"]/tbug <variable> or [color="MediumTurquoise"]/tb <variable>
    -> /tbe to show the events tab
  • /tba or /tbuga <searchText: optional> -> Show the addons info
  • /tbs or /tbugs <searchText: optional> -> Show the scripts history
  • /tbi or /tbugi -> Show the information about an item (itemlink) below the cursor
  • /tbiinfo <itemLink> -> Show the information about an itemlink passed in as <itemLink>
  • /tbsc <searchText: optional> shows the SCENE_MANAGER
  • /tbst or /tbugst <searchText: optional> -> Show the Strings constants like SI_* (for the GetString(SI_*) function usage)
  • /tbsv shows the SavedVariables (or actually enabled addons) which were detected. As SavedVariables are global tables Torchbug can only detect those which contain a suffix like settings, options, opts, savedvar, savedvariables, sv, data or similar in their name and might also show false positive matches for non-sv tables! So always check if the tables shown really are SavedVariables (e.g. contain the table structures with the servername/default and the @displayName and/or characterId/name before changing them!
  • /tbug <globalInspectorTab> will directly open the tab at the global inspector. Values of <globalInspectorTab> can be:
    • addons
    • classes
    • objects
    • controls
    • fonts
    • functions
    • constants
    • strings
    • sounds
    • dialogs
    • scenes
    • fragments
    • libs
    • scripts
    • events
    • sv
    • -all-
  • With "Circonians Control Outline" enabled: s /tbugo or /tbo <control> will show the outline on that control. If no control is named it will use moc()
  • With "Circonians Control Outline" enabled: s /tbugoc or /tboc <control> will show the outline on that control + it's children. If no control is named it will use moc()
  • With "Circonians Control Outline" enabled: s /tbugor or /tbor <control> will hide the outline on that control and it's children. If no control is named it will use moc()
  • With "Circonians Control Outline" enabled: s /tbugo- or /tbo- <control> will hide all outlines on all controls.


New features/Bug fixes:
  • The tab title and the inspector title show proper names now, depending on the inspected type of object, and "breadCrumbs" show you the clicked path of the inspected data (e.g. Control1.table1.subTable2[5]).
  • The tab's show a tooltip if you move the mouse above them, telling you when (date & time) you have inspected this tab and showing you other info like the breadCrumbs
  • Added search at all inspctors to search for atttributes, variables, tables, lists, control etc. using the different search modes "str", "pat", "val" and "con" (you can use k.<variable> and v.<variable> for key / value in con mode -> e.g. v.data.typ == 8)
  • -Collapse/Expand inspector window with v^ icons (top right corner)
  • -Refresh inspector window with o icon (top right corner)
  • -Right click context menu at the inspector's torchBug icon
  • -Context menu at inspector values: Copy raw data / Copy special (bagId, slotIndex e.g.) / Change boolean value (true/false/NIL)
    -> Special context menu entries for bag & slotIndex (e.g. create itemLinks etc.)
  • Preview textures / .dds strings in a tooltip on mouse over of the string row
  • -Track all events ingame via the e (= disabled / E = enabled) button at the global inspector. Check the "Events" tab to see al events that fired since it was enabled. Right click the e/E button, or events at the Events tab list to add filters, exclude/include only some events.
  • -Scripts history added to global inspector. All /script or /tbug or /tb commands run via the chat edit box will be automatically saved there so you can reuse them. Double click to paste the entry to your chatbox. Right click to edit it. Right click the key number to show a context menu (delete entry, test it, edit it e.g.)
    You can use the slash command /tbugs <searchText: optional> to open the scripts and enter lua code in the multiline editbox (max 2000 chars can be saved for each script within the SavedVariables!) and save it manually as a history entry.
    Scripts of the history will be executed via the /tbug command as they are run, which means that the results will be either shown in chat or opened in an inspector (if a control/table will be returned).
  • Fragments show a purple subTable "__usedInScenes" where all scenes are listed that this fragment was added to (at the time that merTorchbug was loaded! If fragments get added dynamically to scenes this will not update the fragments's "__usednScenes" subtable)
  • Clicked table keys (numerical) will open as tableName[keyNr] now and not only as [keyNr] anymore
  • Added support for non-LibStub libraries in the "Libs" tab
  • Added support for some list row entries. If the control inspector recognizes them (e.g. ZO_PlayerInventoryList1Row...) it will add the dataEntry.data table and the bagId and slotIndex to the List row properties at the top of the Anchor properties, so you have them directly in view after using e.g. /tbm or /tbugm on that list row.
    ItemLink tooltip will be shown and the bagId will show the BAG_* constant too at these rows
  • Show constant names (e.g. ITEMTYPE_POTION) as inspector right key, for some defined keys like itemType, specializedItemType, bagId, displayQuality, ...)
  • Preview the font color at labels, clicking it will show a color picker to change it.
  • Filter dropdowns to filter some global inspector values
  • Number of currently shown/filtered entries in inspectpor lists (bottom right)
  • Automatic find of control/object for the function usage (SHIFT + left click on function name) if __index metatables are involved. A new entry __Object will be forwarded to the __index entries of the inspectors so that the __Object:functioName() could be called. Does only work properly with Get*(), Clear*() etc. functions where you do not need to pass in any additional parameters! Set*() functions might work if no parameters are needed.
    The __Object entry will be shown with a purple color.
    e.g. SMITHING -> __index to ZO_Smithing will shows __Object SMITHING and you are able to call functions of ZO_Smithing automatically passing in SMITHING as object
  • Press SHIFT + CTRL + mouse left on a function to run the function with the currently shown inspector (e.g. ZO_Smithing "class").
    Press SHIFT + mouse left on a function to run the function with the __invokerControl (object) (e.g. created SMITHING object of ZO_Smithing "class").


Known bugs:
Resizing the inspectors with the last tab selected (most right tab) might hide (scroll out of view to the left) all tabs on the horizontal scrollbar. Just resize the inspector window again to show the tabs, click on another tab than the last right one, and resize the window to your needs again. Or use the mouse wheel to scroll on the horizontal scrollbar to show the tabs again.

Original addon's description:
The original addon can be found here: mer Torchbug

This ambitious Torchbug wants to become a more capable and less sticky alternative to Zgoo. But beware: it's not quite there yet, and has more bugs than the one in its name.

/tbug expr
If expr is omitted or evaluates to _G, Global inspector will be opened.
If expr evaluates to a table, Table inspector will be opened for the table.
If expr evaluates to a control (userdata with function IsControlHidden), Control inspector will be opened for the control.

The most recently opened object inspector window will have the Torchbug icon at the top-left corner desaturated (grayscale). Such window is subject to recycling whenever you a) click on a table or control row in Global inspector, or b) enter a /tbug command that evaluates to a table or control. You can force opening a new window by shift-click (in Global inspector) or shift-enter (/tbug command).


Global inspector
Classes - global tables with an __index member
Objects - global tables without an __index member, and userdata that are neither controls nor fonts
Controls - global userdata with function IsControlHidden
Fonts - global userdata with function GetFontInfo
Functions - global functions
Constants - all other globals
Strings - EsoStrings - with SI constant names as well as integer values displayed
Sounds - SOUNDS - click to play
Dialogs - ESO_Dialogs
Libs - LibStub.libs - with minor versions displayed next to names

Next to the magnifier icon is a filter mode switch (the three-letter button) and a string/expression filter field.
str - plain string search. Case-sensitive if there is at least one upper-case letter in the string.
pat - string pattern search. Case-sensitive.
val - value search. The expression is evaluated once. Items whose value compares equal to the result pass the filter.
con - condition search. The expression is evaluated for each list item, with environment containing 'k' and 'v' as the list item key and value. Items for which the result is truthy pass the filter.
For example, this is how you can search the Constants tab for items whose key starts with "B" and whose value is an even number:
k:find("^B") and v % 2 == 0

Left-click on a row with a table or control opens a new inspector for that object.
Right-click on a value - same as in Table inspector.


Table inspector

Metatable members are listed before actual table contents. Metamethods are differentiated by having yellow keys, despite them being strings.

Left-click on a row with a table or control opens a new tab in the same inspector window. Shift-Left-click to open a new window.
Right-click on a value (the right half of the row) switches to edit mode. Whatever you type will be evaluated after you hit Enter, and unless that fails, the result will be assigned to the corresponding key in the table. Use with care.

Right-click on a tab to close it.


Control inspector

In v1.1 there are many more control properties listed, including anchors, children and properties specific to certain control types. Some are editable, but there's currently no visual cue, you'll need to right-click and see.


Original addon's TODO
String search uses tostring(value), which leads to stupid matches with table/userdata address (which may not even be displayed if it has a global name).
Windows don't close after their last tab has been closed. -> Fixed in mer Torchbug - Fixed and improved
Add color box to color properties, open color picker on click.
Implement inserting a new key/value pair to inspected table. Also add "self" to the environment to facilitate copying another value from the same table.
Control properties hidden/controlHidden, alpha/controlAlpha and scale have confusing set/get semantics when inheritance is involved; needs discussion.
Toggle boolean properties with a doubleclick. -> Fixed in mer Torchbug - Fixed and improved



Many thanks to
Merlight - For the idea and code of torchbug, and zgoo
Rhyono - For zgoo improved code
SinusPi - For zgoo code
sirinsidiator - For helping with addon manager & libraries code
votan - For helping with addon manager code & creating LibCustomMenu

返回
顶部