- Joined
- Jul 18, 2010
- Messages
- 2,377
This is a Lua UI resource that allows to inspect values of any global and table data during the game. But not no hashtable Data directly, for hashtables it uses an resource that replaces hashtables with Lua tables. One is also capable to Change number, string and boolean data.
Such changes done by Variable Debugger are written into a changelog that can be displayed and written to a file.
Variable Debugger is a WIP.

The left side of variable debuger are the variable names, the fields are editable but it won't Change anything, this is done so one can copy paste it.
The Right side Shows the values of the variables shown at left. String number and boolean values can be edited by selecting an field changing the text and Pressing enter/return. After having pressed enter/return while the field is still selected the variables value will be updated.
For GUI-Variables add the prefix "udg_", When searching for such ones. For example when searching the variable Unit, typing in Unit will Display anything with the word Unit in it. The GUI-Variable Unit would be called udg_Unit.
Array Indexes are displayed as .index like udg_X.1 for X[1].
How to use:
Select the Field Right to "Search:" and type in the search word. While this field has the focus press enter/return to start searching. When the search word exists it will only Show it and its table/array Content (if it is an Array). When the word was not directly found everything having that in its Name will be displayed. When typing in a Table child like Talent.HpalVariable Debugger Show only Talent.Hpal and its ontent, Hpal is interpreted as FourCC('Hpal') for Paladin. This 4 Digit search only works for object Editor Data.
One can also Search for empty field that everything will be displayed.
Since 0.33 there is also the Search Unit Data Button, when Pressing this Button the search field is ignored and any table using the last selected unit as Key is displayed.
In 0.34 the Unit Search Button does also Display Unit-Groups containing the unit and variables pointing the unit.
In 0.36 Also for HandleIds.
Since 0.37 There is variableDebugger.Frames.SuperParent, added an detailed information Panel showes Information of the last hovered Value Field
0.40 Fixed a bug with detail information when hoverwing a table having an none number/string key, Added "mousebuttontype", "limitop" to Filter Events:

Such changes done by Variable Debugger are written into a changelog that can be displayed and written to a file.
Variable Debugger is a WIP.

The left side of variable debuger are the variable names, the fields are editable but it won't Change anything, this is done so one can copy paste it.
The Right side Shows the values of the variables shown at left. String number and boolean values can be edited by selecting an field changing the text and Pressing enter/return. After having pressed enter/return while the field is still selected the variables value will be updated.
For GUI-Variables add the prefix "udg_", When searching for such ones. For example when searching the variable Unit, typing in Unit will Display anything with the word Unit in it. The GUI-Variable Unit would be called udg_Unit.
Array Indexes are displayed as .index like udg_X.1 for X[1].
How to use:
Select the Field Right to "Search:" and type in the search word. While this field has the focus press enter/return to start searching. When the search word exists it will only Show it and its table/array Content (if it is an Array). When the word was not directly found everything having that in its Name will be displayed. When typing in a Table child like Talent.HpalVariable Debugger Show only Talent.Hpal and its ontent, Hpal is interpreted as FourCC('Hpal') for Paladin. This 4 Digit search only works for object Editor Data.
One can also Search for empty field that everything will be displayed.
Since 0.33 there is also the Search Unit Data Button, when Pressing this Button the search field is ignored and any table using the last selected unit as Key is displayed.
In 0.34 the Unit Search Button does also Display Unit-Groups containing the unit and variables pointing the unit.
In 0.36 Also for HandleIds.
Since 0.37 There is variableDebugger.Frames.SuperParent, added an detailed information Panel showes Information of the last hovered Value Field
How to install?
copy the Code into your map.
Import "war3mapimported\\Templates.toc" or already have a TOC-File that loads standardtemplates.fdf and escmenutemplates.
copy the Code into your map.
Import "war3mapimported\\Templates.toc" or already have a TOC-File that loads standardtemplates.fdf and escmenutemplates.
0.40 Fixed a bug with detail information when hoverwing a table having an none number/string key, Added "mousebuttontype", "limitop" to Filter Events:
Lua:
--variable Debugger 0.40
BlzLoadTOCFile("war3mapimported\\Templates.toc")
variableDebugger = {}
variableDebugger.Data = {}
variableDebugger.Data.Filter = {}
variableDebugger.Data.Changes = {}
variableDebugger.Data.Found = {}
variableDebugger.Data.Monitor = {}
variableDebugger.Data.MonitorCount = 0
variableDebugger.Data.MonitorTimer = CreateTimer()
variableDebugger.Data.MonitorLog = {}
variableDebugger.Data.HoverTimer = CreateTimer()
variableDebugger.Frames = {}
variableDebugger.EditBoxes = {}
variableDebugger.EditBoxesCount = 8
variableDebugger.SliderMax = 0
variableDebugger.BoxPosX = 0.8
variableDebugger.BoxPosY = 0.55
variableDebugger.BoxPosPoint = FRAMEPOINT_TOPRIGHT
variableDebugger.BoxSizeX = 0.32
variableDebugger.BoxSizeY = 0.37
variableDebugger.BoxAddSizeX = 0.20
variableDebugger.BoxAddSizeY = variableDebugger.BoxSizeY/2
variableDebugger.LogSizeX = 0.2
variableDebugger.LogSizeY = 0.2
variableDebugger.Trigger = {}
function variableDebugger.err(x)
print(x)
return x
end
TimerStart(variableDebugger.Data.HoverTimer, 0.05, true, function()
xpcall(function()
if variableDebugger.Data.LastHoveredTable then
--print("update by Timer")
BlzFrameSetText(variableDebugger.Frames.ValueDetailWindow, variableDebugger.Data.LastHoveredDisplay)
BlzFrameAddText(variableDebugger.Frames.ValueDetailWindow, variableDebugger.GetDetailInfo(variableDebugger.Data.LastHoveredTable[variableDebugger.Data.LastHoveredTableKey]))
end
end, variableDebugger.err)
end)
function variableDebugger.GetDetailInfo(value, typeAsString)
if not typeAsString then typeAsString = typeOfObject(value) end
local returnValue = tostring(value)
--print("GetDetailInfo",value)
if type(value) == "userdata" then
returnValue = returnValue.. "\nHandleId: " .. GetHandleId(value)
if typeAsString == "unit" then
returnValue = returnValue.. "\nUnitcode:" .. ('>I4'):pack(GetUnitTypeId(value))
returnValue = returnValue.. "\nCustom Value:" .. GetUnitUserData(value)
returnValue = returnValue.. "\nName:" .. GetUnitName(value)
if IsUnitType(value, UNIT_TYPE_HERO) then
returnValue = returnValue.. "\nPropername:" .. GetHeroProperName(value)
returnValue = returnValue.. "\nLevel:" .. GetHeroLevel(value)
else
returnValue = returnValue.. "\nLevel:" .. GetUnitLevel(value)
end
returnValue = returnValue.. "\nOwner: Player " .. GetPlayerId(GetOwningPlayer(value))
returnValue = returnValue.. "\nLife:" .. GetUnitState(value, UNIT_STATE_LIFE).." / "..GetUnitState(value, UNIT_STATE_MAX_LIFE)
if GetUnitState(value, UNIT_STATE_MAX_MANA) > 0 then
returnValue = returnValue.. "\nMana:" .. GetUnitState(value, UNIT_STATE_MANA).." / "..GetUnitState(value, UNIT_STATE_MAX_MANA)
end
if not IsUnitHidden(value) then
returnValue = returnValue.. "\nX:" .. GetUnitX(value)
returnValue = returnValue.. "\nY:" .. GetUnitY(value)
end
elseif typeAsString == "timer" then
returnValue = returnValue.. "\nElapsed: " .. TimerGetElapsed(value)
returnValue = returnValue.. "\nRemaining: " .. TimerGetRemaining(value)
returnValue = returnValue.. "\nTimeout: " .. TimerGetTimeout(value)
elseif typeAsString == "item" then
returnValue = returnValue.. "\nName: " .. GetItemName(value)
returnValue = returnValue.. "\nItemcode:" .. ('>I4'):pack(GetItemTypeId(value))
returnValue = returnValue.. "\nItemPlayer: " .. GetItemPlayer(value)
returnValue = returnValue.. "\nItemLive: " .. GetItemLifeBJ(value)
returnValue = returnValue.. "\nCustomValue: " .. GetItemUserData(value)
returnValue = returnValue.. "\nX: " .. GetItemX(value)
returnValue = returnValue.. "\nY: " .. GetItemY(value)
returnValue = returnValue.. "\nCharges: " .. GetItemCharges(value)
returnValue = returnValue.. "\nLevel: " .. GetItemLevel(value)
elseif typeAsString == "player" then
returnValue = returnValue.. "\nName: " .. GetPlayerName(value)
returnValue = returnValue.. "\nPlayerId: " .. GetPlayerId(value)
elseif typeAsString == "destructable" then
returnValue = returnValue.. "\nName: " .. GetDestructableName(value)
returnValue = returnValue.. "\nDestrucCode: " .. ('>I4'):pack(GetDestructableTypeId(value))
returnValue = returnValue.. "\nLife: " .. GetDestructableLife(value)
returnValue = returnValue.. "\nX: " .. GetDestructableX(value)
returnValue = returnValue.. "\nY: " .. GetDestructableY(value)
elseif typeAsString == "group" then
returnValue = returnValue.. "\nUnitCount: " .. BlzGroupGetSize(value)
ForGroup(value, function()
returnValue = returnValue.. "\n".. tostring(GetEnumUnit())
returnValue = returnValue.. "\n ".. GetUnitName(GetEnumUnit())
end)
elseif typeAsString == "force" then
local count = 0
ForForce(value, function()
count = count + 1
returnValue = returnValue.. "\n ".. GetPlayerName(GetEnumPlayer())
returnValue = returnValue.. "\n-> PlayerId: ".. GetPlayerId(GetEnumPlayer())
end)
returnValue = "PlayerCount: ".. count.. "\n".. returnValue
elseif typeAsString == "location" then
returnValue = returnValue.. "\nX: " .. GetLocationX(value)
returnValue = returnValue.. "\nY: " .. GetLocationY(value)
returnValue = returnValue.. "\nZ: " .. GetLocationZ(value)
elseif typeAsString == "rect" then
returnValue = returnValue.. "\nCenter: " .. GetRectCenterX(value) .." / ".. GetRectCenterY(value)
returnValue = returnValue.. "\nXmin: " .. GetRectMinX(value)
returnValue = returnValue.. "\nXmax: " .. GetRectMaxX(value)
returnValue = returnValue.. "\nYmin: " .. GetRectMinY(value)
returnValue = returnValue.. "\nYmax: " .. GetRectMaxY(value)
elseif typeAsString == "effect" then
returnValue = returnValue.. "\nX: " .. BlzGetLocalSpecialEffectX(value)
returnValue = returnValue.. "\nY: " .. BlzGetLocalSpecialEffectY(value)
returnValue = returnValue.. "\nZ: " .. BlzGetLocalSpecialEffectZ(value)
returnValue = returnValue.. "\nScale: " .. BlzGetSpecialEffectScale(value)
elseif typeAsString == "trigger" then
returnValue = returnValue.. "\nEnabled: " .. tostring(IsTriggerEnabled(value))
returnValue = returnValue.. "\nExecCount: " .. GetTriggerExecCount(value)
returnValue = returnValue.. "\nEvalCount: " .. GetTriggerEvalCount(value)
end
elseif type(value) == "table" then
for tableKey, tableValue in pairs(value)
do
returnValue = returnValue.. "\n " .. tostring(tableKey) ..": "..tostring(tableValue)
end
elseif type(value) == "number" and variableDebugger.isInteger(value) and GetObjectName(value) ~= "" then
returnValue = returnValue.. "\n " .. ('>I4'):pack(value)
returnValue = returnValue.. "\n ".. GetObjectName(value)
end
return returnValue
end
function typeOfObject(value)
--returns the type of userData or type(value) "unit" or "timer"...
local typeString = type(value)
local wort = ""
if typeString == "userdata" then
typeString = tostring(value)
for c in typeString:gmatch"." do
if c == ":" then
return wort
else
wort = wort .. c
end
end
end
return typeString
end
function variableDebugger.MonitorTimerAction()
xpcall(function()
BlzFrameSetText(variableDebugger.Frames.Monitor, "")
for key, value in pairs(variableDebugger.Data.Monitor)
do
local currentValue = value.Parent[value.Key]
if currentValue ~= value.Value then
local newObject = "Time: "..os.clock().." ".. value.DisplayedText..": "..tostring(value.Value).." -> "..tostring(currentValue)
table.insert(variableDebugger.Data.MonitorLog, newObject)
BlzFrameAddText(variableDebugger.Frames.MonitorLog, newObject)
value.Value = currentValue
end
--is value an object Editor integer?
if tonumber(currentValue) and variableDebugger.isInteger(currentValue) and GetObjectName(currentValue) ~= "" then
currentValue = ('>I4'):pack(currentValue)
BlzFrameAddText(variableDebugger.Frames.Monitor, value.DisplayedText..": "..currentValue)
else
BlzFrameAddText(variableDebugger.Frames.Monitor, value.DisplayedText..": "..tostring(currentValue))
end
end
end, variableDebugger.err)
end
function variableDebugger.MonitorAddVariable(parentTable, key, displayedText)
--adds a variable to the monitoring screen.
local newObject = {}
newObject.Key = key
newObject.Parent = parentTable
newObject.DisplayedText = variableDebugger.convertText(displayedText)
newObject.Value = parentTable[key]
variableDebugger.Data.Monitor[displayedText] = newObject
variableDebugger.Data.MonitorCount = variableDebugger.Data.MonitorCount + 1
if variableDebugger.Data.MonitorCount == 1 then
print("Start Monitor Timer")
TimerStart(variableDebugger.Data.MonitorTimer, 0.01, true, variableDebugger.MonitorTimerAction)
end
end
function variableDebugger.MonitorRemoveVariable(displayedText)
--removes a variable from the monitoring screen.
if variableDebugger.Data.Monitor[displayedText] then
print("Stop monitoring")
variableDebugger.Data.Monitor[displayedText] = nil
variableDebugger.Data.MonitorCount = variableDebugger.Data.MonitorCount - 1
if variableDebugger.Data.MonitorCount == 0 then
print("Pause Monitor Timer")
PauseTimer(variableDebugger.Data.MonitorTimer)
end
return true
end
return false
end
function variableDebugger.AddTable(prefix, tableObject)
--Add content of tableObject
for key, value in pairs(tableObject)
do
--avoid adding the found-container or _G
if value ~=_G and value ~= variableDebugger.Data.Found then
variableDebugger.insertFound(tableObject, key, prefix.."."..tostring(key))
if type(value) == "table" then
variableDebugger.AddTable(prefix.."."..tostring(key), value)
end
end
end
end
function variableDebugger.AddUnitDataFromTable(prefix, tableObject, unit)
--Search Tables in Tables for unit and add Keys when found
for key, value in pairs(tableObject)
do
if value ~=_G and value ~= variableDebugger.Data.Found then
--this variable uses the unit as key?
--be it the unit itself or its handleId
if (string.sub(tostring(key), 1, 5) == "unit:" and key == unit) or (tonumber(key) and GetHandleId(unit) == key) then
if type(value) ~= "table" then
if prefix ~= "" then
variableDebugger.insertFound(tableObject, key, prefix.."."..tostring(key))
else
variableDebugger.insertFound(tableObject, key, tostring(key))
end
else
--add all of tables content using the unit as key
if prefix ~= "" then
variableDebugger.AddTable(prefix.."."..tostring(key), value)
else
variableDebugger.AddTable(tostring(key), value)
end
end
--this variable points to the unit?
elseif string.sub(tostring(value), 1, 5) == "unit:" and value == unit then
if prefix ~= "" then
variableDebugger.insertFound(tableObject, key, prefix.."."..tostring(key))
else
variableDebugger.insertFound(tableObject, key, tostring(key))
end
--this variable is a group and contains the unit?
elseif string.sub(tostring(value), 1, 6) == "group:" and IsUnitInGroup(unit, value) then
if prefix ~= "" then
variableDebugger.insertFound(tableObject, key, prefix.."."..tostring(key))
else
variableDebugger.insertFound(tableObject, key, tostring(key))
end
end
--is this a sub table to search from?
if type(value) == "table" then
if prefix ~= "" then
variableDebugger.AddUnitDataFromTable(prefix.."."..tostring(key), value, unit)
else
variableDebugger.AddUnitDataFromTable(tostring(key), value, unit)
end
end
end
end
end
function variableDebugger.updateSlider()
--Update the Sliders max size.
BlzFrameSetStepSize(variableDebugger.Frames.PageSlider, 1)
variableDebugger.SliderMax = math.max((#variableDebugger.Data.Found/variableDebugger.EditBoxesCount) - 1, 0)
BlzFrameSetMinMaxValue(variableDebugger.Frames.PageSlider, 0, variableDebugger.SliderMax)
BlzFrameSetValue(variableDebugger.Frames.PageSlider, 0)
end
function variableDebugger.insertFound(parentTable, key, displayedText)
--Write the found data in variableDebugger.Data.Found.
local value = parentTable[key]
local typeAsString = typeOfObject(value)
if not variableDebugger.Data.Filter[typeAsString] then
local newObject = {}
newObject.Key = key
newObject.Parent = parentTable
newObject.DisplayedText = variableDebugger.convertText(displayedText)
table.insert(variableDebugger.Data.Found, newObject)
else
-- print("Filter:", typeAsString, value)
end
end
--would be cool but it breaks 4 digit Objects which it should allow (wanted).
--function variableDebugger.isInteger(value)
--local integer = R2I(value)
--return integer == value
--end
function variableDebugger.isInteger(value)
--validation check before converting to a 4 Digit in value fields
local valueString = tostring(value)
if valueString == "inf" then return false end
for c in valueString:gmatch"." do
if c == "." then return false end
end
return true
end
function variableDebugger.convertText2Number(text)
--converts 4 digit objects in normal numbers.
local newText = ""
local word = ""
for c in text:gmatch"." do
-- do something with c
if c~= "." then
word = word..c
else
if string.len(word) == 4 and GetObjectName(FourCC(word)) then
word = FourCC(word)
end
if newText == "" then
newText =word
else
newText =newText.."."..word
end
word = ""
end
end
if string.len(word) == 4 and GetObjectName(FourCC(word)) then
word = FourCC(word)
end
if newText == "" then
newText =word
else
newText =newText.."."..word
end
--print(text, newText)
return newText
end
function variableDebugger.convertText(text)
--converts numbers in 4 digit objects when able to.
local newText = ""
local word = ""
for c in text:gmatch"." do
if c~= "." then
word = word..c
else
if tonumber(word) and GetObjectName(word) ~= "" then
word = ('>I4'):pack(word)
end
if newText == "" then
newText =word
else
newText =newText.."."..word
end
word = ""
end
end
if tonumber(word) and GetObjectName(word) ~= "" then
word = ('>I4'):pack(word)
end
if newText == "" then
newText =word
else
newText =newText.."."..word
end
--print(text, newText)
return newText
end
function variableDebugger.updateBoxes(startIndex)
xpcall(function()
startIndex = math.max(0, startIndex)
local shownSomething = false
for boxIndex = 1, variableDebugger.EditBoxesCount,1 do
local valueFrame = variableDebugger.EditBoxes[boxIndex].Value
local nameFrame = variableDebugger.EditBoxes[boxIndex].Name
if variableDebugger.Data.Found[startIndex + boxIndex] then
shownSomething = true
local tableObject = variableDebugger.Data.Found[startIndex + boxIndex].Parent
local key = variableDebugger.Data.Found[startIndex + boxIndex].Key
local displayedText = variableDebugger.Data.Found[startIndex + boxIndex].DisplayedText
local value = tableObject[key]
BlzFrameSetText(nameFrame, displayedText)
BlzFrameSetEnable(valueFrame, true)
--check if value is a number anid if it is an object Editor object
if type(value) == "number" and variableDebugger.isInteger(value) and GetObjectName(value) ~= "" then
BlzFrameSetText(valueFrame, ('>I4'):pack(value))
else
BlzFrameSetText(valueFrame, tostring(value))
end
--update icon of monitor when already monitoring
if variableDebugger.Data.Monitor[displayedText] then
BlzFrameSetTexture(variableDebugger.EditBoxes[boxIndex].MonitorIcon, "ReplaceableTextures\\CommandButtons\\BTNCancel", 0, true)
else
BlzFrameSetTexture(variableDebugger.EditBoxes[boxIndex].MonitorIcon, "ReplaceableTextures\\WorldEditUI\\Doodad-Cinematic", 0, true)
end
else
--this box is not used.
BlzFrameSetText(nameFrame, "")
BlzFrameSetEnable(valueFrame, false)
BlzFrameSetText(valueFrame, "")
end
end
--when the new page would be empty show the first page, but only when not the first page should be shown
if not shownSomething and startIndex > 0 then
variableDebugger.updateBoxes(0)
else
variableDebugger.Frames.BoxEndIndex = startIndex + variableDebugger.EditBoxesCount
end
end, variableDebugger.err)
end
function variableDebugger.getLastParent(f)
local v = _G -- start with the table of globals
local word = ""
local total = ""
for c in f:gmatch"." do
if c~= "." then
word = word..c
else
if total == "" then
total =word
else
total =total.."."..word
end
if tonumber(word) then
word = tonumber(word)
end
v = v[word]
word = ""
end
end
if tonumber(word) then
return v, tonumber(word)
else
return v, word
end
end
function variableDebugger.write2File(tableObject, fileName)
PreloadGenStart()
PreloadGenClear()
print("Write 'CustomMapData\\"..fileName.."'")
for key, value in ipairs(tableObject)
do
Preload(value)
end
PreloadGenEnd(fileName)
print("Done")
end
function variableDebugger.createCloseButton(parentFrame)
local closeButton = BlzCreateFrameByType("GLUETEXTBUTTON", "", parentFrame, "ScriptDialogButton", 0)
BlzFrameSetPoint(closeButton, FRAMEPOINT_TOPRIGHT, parentFrame, FRAMEPOINT_TOPRIGHT, 0, 0)
BlzFrameSetSize(closeButton, 0.022, 0.022)
BlzFrameSetText(closeButton, "X")
local closeTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(closeTrigger, closeButton, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(closeTrigger, function()
BlzFrameSetVisible(BlzFrameGetParent(BlzGetTriggerFrame()), false)
BlzFrameSetVisible(variableDebugger.Frames.BoxShowButtons, true)
end)
table.insert(variableDebugger.Trigger, closeTrigger)
table.insert(variableDebugger.Frames, closeButton)
end
function variableDebugger.createWindowToggle(targetFrame, parent, framepoint, xoffset, yoffset)
local buttonFrame = BlzCreateFrameByType("GLUETEXTBUTTON", "", parent, "ScriptDialogButton", 0)
BlzFrameSetPoint(buttonFrame, framepoint, parent, framepoint, xoffset or 0, yoffset or 0)
BlzFrameSetSize(buttonFrame, 0.022, 0.022)
BlzFrameSetText(buttonFrame, "<-")
local buttonTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(buttonTrigger, buttonFrame, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(buttonTrigger, function()
if BlzFrameIsVisible(targetFrame) then
BlzFrameSetText(BlzGetTriggerFrame(), "<-")
BlzFrameSetVisible(targetFrame, false)
else
BlzFrameSetVisible(targetFrame, true)
BlzFrameSetText(BlzGetTriggerFrame(), "->")
end
end)
table.insert(variableDebugger.Trigger, buttonTrigger)
table.insert(variableDebugger.Frames, buttonFrame)
end
function variableDebugger.createFilterCheckBox(labelText, ...)
--adds an checkbox, the first word is the text shown in the label, all further arguments are types beeing filtered.
local filterLabel = BlzCreateFrame("StandardSmallTextTemplate", variableDebugger.Frames.BoxFilters, 0, 0)
local filterCheckBox = BlzCreateFrame("QuestCheckBox2", variableDebugger.Frames.BoxFilters, 0, 0)
local args = {...}
local filteredTypeAsString = {}
for i,v in ipairs(args) do
table.insert( filteredTypeAsString, v )
end
BlzFrameSetSize(filterCheckBox, 0.011, 0.011)
BlzFrameSetText(filterLabel, labelText)
--is this the first checkbox?
if not variableDebugger.Frames.FilterLabel then
BlzFrameSetPoint(filterLabel, FRAMEPOINT_TOPLEFT, variableDebugger.Frames.BoxFilters, FRAMEPOINT_TOPLEFT, 0.0085, -0.038)
BlzFrameSetPoint(filterCheckBox, FRAMEPOINT_TOPRIGHT, variableDebugger.Frames.BoxFilters, FRAMEPOINT_TOPRIGHT, -0.0085, -0.038)
else
--no, pos below the previous
BlzFrameSetPoint(filterLabel, FRAMEPOINT_TOPLEFT, variableDebugger.Frames.FilterLabel, FRAMEPOINT_BOTTOMLEFT, 0, -0.0005)
BlzFrameSetPoint(filterCheckBox, FRAMEPOINT_TOPLEFT, variableDebugger.Frames.FilterBox, FRAMEPOINT_BOTTOMLEFT, 0, -0.0005)
end
--remember the current created one for the next function
variableDebugger.Frames.FilterLabel = filterLabel
variableDebugger.Frames.FilterBox = filterCheckBox
local filterTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(filterTrigger, filterCheckBox, FRAMEEVENT_CHECKBOX_CHECKED)
BlzTriggerRegisterFrameEvent(filterTrigger, filterCheckBox, FRAMEEVENT_CHECKBOX_UNCHECKED)
TriggerAddAction(filterTrigger, function()
local checked = BlzGetTriggerFrameEvent() == FRAMEEVENT_CHECKBOX_CHECKED
for key, value in ipairs(filteredTypeAsString)
do
print("Filter:",value, checked)
variableDebugger.Data.Filter[value] = checked
end
end)
table.insert(variableDebugger.Trigger, filterTrigger)
table.insert(variableDebugger.Frames, filterCheckBox)
table.insert(variableDebugger.Frames, filterLabel)
end
TimerStart(CreateTimer(), 0.0, false, function()
xpcall(function()
variableDebugger.Frames.SuperParent = BlzCreateFrameByType("FRAME", "", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
variableDebugger.Frames.BoxShowButtons = BlzCreateFrameByType("FRAME", "", variableDebugger.Frames.SuperParent, "", 0)
variableDebugger.Frames.Box = BlzCreateFrame("CheckListBox", variableDebugger.Frames.SuperParent, 0, 0)
variableDebugger.Frames.BoxPanel = BlzCreateFrameByType("FRAME", "", variableDebugger.Frames.Box, "", 0)
variableDebugger.Frames.BoxFilters = BlzCreateFrame("CheckListBox", variableDebugger.Frames.Box, 0, 0)
variableDebugger.Frames.ChangeLog = BlzCreateFrame("EscMenuTextAreaTemplate", variableDebugger.Frames.SuperParent, 0, 0)
BlzFrameSetAbsPoint(variableDebugger.Frames.ChangeLog, variableDebugger.BoxPosPoint, variableDebugger.BoxPosX, variableDebugger.BoxPosY)
BlzFrameSetSize(variableDebugger.Frames.ChangeLog, variableDebugger.LogSizeX, variableDebugger.LogSizeY)
BlzFrameSetVisible(variableDebugger.Frames.ChangeLog, false)
variableDebugger.Frames.Monitor = BlzCreateFrame("EscMenuTextAreaTemplate", variableDebugger.Frames.Box, 0, 0)
BlzFrameSetPoint(variableDebugger.Frames.Monitor, FRAMEPOINT_TOPRIGHT, variableDebugger.Frames.Box, FRAMEPOINT_TOPLEFT, 0, 0)
BlzFrameSetSize(variableDebugger.Frames.Monitor, variableDebugger.BoxAddSizeX, variableDebugger.BoxAddSizeY)
BlzFrameSetVisible(variableDebugger.Frames.Monitor, false)
variableDebugger.Frames.MonitorLog = BlzCreateFrame("EscMenuTextAreaTemplate", variableDebugger.Frames.SuperParent, 0, 0)
BlzFrameSetAbsPoint(variableDebugger.Frames.MonitorLog, variableDebugger.BoxPosPoint, variableDebugger.BoxPosX, variableDebugger.BoxPosY)
BlzFrameSetSize(variableDebugger.Frames.MonitorLog, variableDebugger.LogSizeX, variableDebugger.LogSizeY)
BlzFrameSetVisible(variableDebugger.Frames.MonitorLog, false)
variableDebugger.Frames.WriteChangeLog = BlzCreateFrameByType("GLUETEXTBUTTON", "MyButton", variableDebugger.Frames.ChangeLog, "ScriptDialogButton", 0)
BlzFrameSetPoint(variableDebugger.Frames.WriteChangeLog, FRAMEPOINT_TOPRIGHT, variableDebugger.Frames.ChangeLog, FRAMEPOINT_BOTTOM, 0, 0)
BlzFrameSetText(variableDebugger.Frames.WriteChangeLog, "ChangeLog 2 File")
BlzFrameSetSize(variableDebugger.Frames.WriteChangeLog, 0.12, 0.03)
variableDebugger.Frames.WriteMonitorLog = BlzCreateFrameByType("GLUETEXTBUTTON", "MyButton", variableDebugger.Frames.MonitorLog, "ScriptDialogButton", 0)
BlzFrameSetPoint(variableDebugger.Frames.WriteMonitorLog, FRAMEPOINT_TOPRIGHT, variableDebugger.Frames.MonitorLog, FRAMEPOINT_BOTTOM, 0, 0)
BlzFrameSetText(variableDebugger.Frames.WriteMonitorLog, "MonitorLog 2 File")
BlzFrameSetSize(variableDebugger.Frames.WriteMonitorLog, 0.12, 0.03)
local writeLogTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(writeLogTrigger, variableDebugger.Frames.WriteChangeLog, FRAMEEVENT_CONTROL_CLICK)
BlzTriggerRegisterFrameEvent(writeLogTrigger, variableDebugger.Frames.WriteMonitorLog, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(writeLogTrigger, function()
if BlzGetTriggerFrame() == variableDebugger.Frames.WriteChangeLog then
variableDebugger.write2File(variableDebugger.Data.Changes, "Variable Debugger ChangeLog.txt")
else
variableDebugger.write2File(variableDebugger.Data.MonitorLog, "Variable Debugger MonitorLog.txt")
end
end)
variableDebugger.Frames.ShowChangeLog = BlzCreateFrameByType("GLUETEXTBUTTON", "MyButton", variableDebugger.Frames.BoxShowButtons, "ScriptDialogButton", 0)
BlzFrameSetAbsPoint(variableDebugger.Frames.ShowChangeLog, FRAMEPOINT_TOPRIGHT, 0.8, 0.52)
BlzFrameSetSize(variableDebugger.Frames.ShowChangeLog, 0.15, 0.03)
BlzFrameSetText(variableDebugger.Frames.ShowChangeLog, "Variable-ChangeLog")
variableDebugger.Frames.ShowMonitorLog = BlzCreateFrameByType("GLUETEXTBUTTON", "MyButton", variableDebugger.Frames.BoxShowButtons, "ScriptDialogButton", 0)
BlzFrameSetAbsPoint(variableDebugger.Frames.ShowMonitorLog, FRAMEPOINT_TOPRIGHT, 0.8, 0.49)
BlzFrameSetSize(variableDebugger.Frames.ShowMonitorLog, 0.15, 0.03)
BlzFrameSetText(variableDebugger.Frames.ShowMonitorLog, "Variable-MonitorLog")
variableDebugger.createCloseButton(variableDebugger.Frames.ChangeLog)
variableDebugger.createCloseButton(variableDebugger.Frames.MonitorLog)
variableDebugger.createCloseButton(variableDebugger.Frames.Box)
variableDebugger.Frames.ShowBox = BlzCreateFrameByType("GLUETEXTBUTTON", "MyButton", variableDebugger.Frames.BoxShowButtons, "ScriptDialogButton", 0)
BlzFrameSetAbsPoint(variableDebugger.Frames.ShowBox, variableDebugger.BoxPosPoint, variableDebugger.BoxPosX, variableDebugger.BoxPosY)
BlzFrameSetSize(variableDebugger.Frames.ShowBox, 0.15, 0.03)
BlzFrameSetText(variableDebugger.Frames.ShowBox, "Variable-Debugger")
BlzFrameSetPoint(variableDebugger.Frames.BoxFilters, FRAMEPOINT_TOPRIGHT, variableDebugger.Frames.Box, FRAMEPOINT_TOPLEFT, 0, 0)
BlzFrameSetSize(variableDebugger.Frames.BoxFilters, 0.1, 0.3)
BlzFrameSetVisible(variableDebugger.Frames.BoxFilters, false)
variableDebugger.Frames.BoxMinimize = BlzCreateFrameByType("GLUETEXTBUTTON", "MyButton", variableDebugger.Frames.Box, "ScriptDialogButton", 0)
BlzFrameSetPoint(variableDebugger.Frames.BoxMinimize, FRAMEPOINT_TOPRIGHT, variableDebugger.Frames.Box, FRAMEPOINT_TOPRIGHT, 0, -0.022)
BlzFrameSetSize(variableDebugger.Frames.BoxMinimize, 0.022, 0.022)
BlzFrameSetText(variableDebugger.Frames.BoxMinimize, "->")
local boxMinimizeTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(boxMinimizeTrigger, variableDebugger.Frames.BoxMinimize, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(boxMinimizeTrigger, function()
if BlzFrameIsVisible(variableDebugger.Frames.BoxPanel) then
BlzFrameSetText(BlzGetTriggerFrame(), "<-")
BlzFrameSetVisible(variableDebugger.Frames.BoxPanel, false)
BlzFrameSetSize(variableDebugger.Frames.Box, 0.04, variableDebugger.BoxSizeY)
else
BlzFrameSetVisible(variableDebugger.Frames.BoxPanel, true)
BlzFrameSetText(BlzGetTriggerFrame(), "->")
BlzFrameSetSize(variableDebugger.Frames.Box, variableDebugger.BoxSizeX, variableDebugger.BoxSizeY)
end
end)
variableDebugger.Frames.LockValueDetailWindowTarget = BlzCreateFrameByType("GLUETEXTBUTTON", "MyButton", variableDebugger.Frames.BoxPanel, "ScriptDialogButton", 0)
BlzFrameSetPoint(variableDebugger.Frames.LockValueDetailWindowTarget, FRAMEPOINT_BOTTOMLEFT, variableDebugger.Frames.Box, FRAMEPOINT_BOTTOMLEFT, 0, 0.023)
BlzFrameSetSize(variableDebugger.Frames.LockValueDetailWindowTarget, 0.04, 0.022)
BlzFrameSetText(variableDebugger.Frames.LockValueDetailWindowTarget, "Lock")
variableDebugger.Frames.ValueDetailWindow = BlzCreateFrame("EscMenuTextAreaTemplate", variableDebugger.Frames.Box, 0, 0)
BlzFrameSetPoint(variableDebugger.Frames.ValueDetailWindow, FRAMEPOINT_BOTTOMRIGHT, variableDebugger.Frames.Box, FRAMEPOINT_BOTTOMLEFT, -0.0005, 0)
BlzFrameSetSize(variableDebugger.Frames.ValueDetailWindow, variableDebugger.BoxAddSizeX, variableDebugger.BoxAddSizeY)
BlzFrameSetVisible(variableDebugger.Frames.ValueDetailWindow, false)
variableDebugger.createWindowToggle(variableDebugger.Frames.ValueDetailWindow, variableDebugger.Frames.Box, FRAMEPOINT_BOTTOMLEFT, 0, 0)
variableDebugger.createWindowToggle(variableDebugger.Frames.Monitor, variableDebugger.Frames.Box, FRAMEPOINT_TOPLEFT, 0, -0.022)
variableDebugger.createWindowToggle(variableDebugger.Frames.BoxFilters, variableDebugger.Frames.Box, FRAMEPOINT_TOPLEFT, 0, 0)
BlzFrameSetEnable(variableDebugger.Frames.Box, false)
BlzFrameSetEnable(variableDebugger.Frames.ChangeLog, false)
BlzFrameSetVisible(variableDebugger.Frames.ChangeLog, false)
BlzFrameSetVisible(variableDebugger.Frames.Box, false)
local showTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(showTrigger, variableDebugger.Frames.ShowBox, FRAMEEVENT_CONTROL_CLICK)
BlzTriggerRegisterFrameEvent(showTrigger, variableDebugger.Frames.ShowChangeLog, FRAMEEVENT_CONTROL_CLICK)
BlzTriggerRegisterFrameEvent(showTrigger, variableDebugger.Frames.ShowMonitorLog, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(showTrigger, function()
if BlzGetTriggerFrame() == variableDebugger.Frames.ShowBox then
BlzFrameSetVisible(variableDebugger.Frames.Box, true)
elseif BlzGetTriggerFrame() == variableDebugger.Frames.ShowChangeLog then
BlzFrameSetVisible(variableDebugger.Frames.ChangeLog, true)
elseif BlzGetTriggerFrame() == variableDebugger.Frames.ShowMonitorLog then
BlzFrameSetVisible(variableDebugger.Frames.MonitorLog, true)
end
BlzFrameSetVisible(variableDebugger.Frames.BoxShowButtons, false)
end)
BlzFrameSetAbsPoint(variableDebugger.Frames.Box, variableDebugger.BoxPosPoint, variableDebugger.BoxPosX, variableDebugger.BoxPosY)
BlzFrameSetSize(variableDebugger.Frames.Box, variableDebugger.BoxSizeX, variableDebugger.BoxSizeY)
variableDebugger.Frames.PageSliderTitel = BlzCreateFrame("StandardLabelTextTemplate", variableDebugger.Frames.BoxPanel, 0, 0)
variableDebugger.Frames.PageSlider = BlzCreateFrame("EscMenuSliderTemplate", variableDebugger.Frames.BoxPanel, 0, 0)
BlzFrameSetPoint(variableDebugger.Frames.PageSliderTitel, FRAMEPOINT_BOTTOM, variableDebugger.Frames.PageSlider, FRAMEPOINT_TOP, 0.0, 0.0)
BlzFrameSetPoint(variableDebugger.Frames.PageSlider, FRAMEPOINT_BOTTOM, variableDebugger.Frames.Box, FRAMEPOINT_BOTTOM, 0.0, 0.01)
BlzFrameSetSize(variableDebugger.Frames.PageSlider, 0.16, 0.012)
BlzFrameSetStepSize(variableDebugger.Frames.PageSlider, 1)
local sliderTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(sliderTrigger, variableDebugger.Frames.PageSlider, FRAMEEVENT_SLIDER_VALUE_CHANGED)
TriggerAddAction(sliderTrigger, function()
BlzFrameSetText(variableDebugger.Frames.PageSliderTitel, BlzFrameGetValue(variableDebugger.Frames.PageSlider).." / "..variableDebugger.SliderMax)
variableDebugger.updateBoxes(BlzGetTriggerFrameValue()*variableDebugger.EditBoxesCount)
end)
variableDebugger.Frames.NextPage = BlzCreateFrameByType("GLUETEXTBUTTON", "MyButton", variableDebugger.Frames.BoxPanel, "ScriptDialogButton", 0)
variableDebugger.Frames.PrevPage = BlzCreateFrameByType("GLUETEXTBUTTON", "MyButton", variableDebugger.Frames.BoxPanel, "ScriptDialogButton", 0)
BlzFrameSetPoint(variableDebugger.Frames.NextPage, FRAMEPOINT_LEFT, variableDebugger.Frames.PageSlider, FRAMEPOINT_RIGHT, 0.0, 0.0)
BlzFrameSetPoint(variableDebugger.Frames.PrevPage, FRAMEPOINT_RIGHT, variableDebugger.Frames.PageSlider, FRAMEPOINT_LEFT, 0.0, 0.0)
BlzFrameSetSize(variableDebugger.Frames.PrevPage, 0.025, 0.025)
BlzFrameSetText(variableDebugger.Frames.PrevPage, "-")
BlzFrameSetSize(variableDebugger.Frames.NextPage, 0.025, 0.025)
BlzFrameSetText(variableDebugger.Frames.NextPage, "+")
variableDebugger.Frames.BoxEndIndex = 0
local pageTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(pageTrigger, variableDebugger.Frames.NextPage, FRAMEEVENT_CONTROL_CLICK)
BlzTriggerRegisterFrameEvent(pageTrigger, variableDebugger.Frames.PrevPage, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(pageTrigger, function()
if BlzGetTriggerFrame() == variableDebugger.Frames.NextPage then
BlzFrameSetValue(variableDebugger.Frames.PageSlider, BlzFrameGetValue( variableDebugger.Frames.PageSlider) + 1)
else
BlzFrameSetValue(variableDebugger.Frames.PageSlider, BlzFrameGetValue( variableDebugger.Frames.PageSlider) - 1)
end
end)
variableDebugger.Frames.Title = BlzCreateFrame("EscMenuTitleTextTemplate", variableDebugger.Frames.BoxPanel, 0, 0)
BlzFrameSetTextAlignment(variableDebugger.Frames.Title, TEXT_JUSTIFY_MIDDLE, TEXT_JUSTIFY_CENTER)
BlzFrameSetText(variableDebugger.Frames.Title, "Variable Debugger")
BlzFrameSetPoint(variableDebugger.Frames.Title, FRAMEPOINT_TOPLEFT, variableDebugger.Frames.Box, FRAMEPOINT_TOPLEFT, 0, -0.025)
BlzFrameSetPoint(variableDebugger.Frames.Title, FRAMEPOINT_TOPRIGHT, variableDebugger.Frames.Box, FRAMEPOINT_TOPRIGHT, 0, -0.025)
variableDebugger.Frames.Search = BlzCreateFrame("EscMenuEditBoxTemplate", variableDebugger.Frames.BoxPanel, 0, 0)
BlzFrameSetPoint(variableDebugger.Frames.Search, FRAMEPOINT_TOPRIGHT, variableDebugger.Frames.Box, FRAMEPOINT_TOPRIGHT, -0.01, -0.045)
BlzFrameSetSize(variableDebugger.Frames.Search, 0.15, 0.03)
variableDebugger.Frames.SearchLabel = BlzCreateFrame("StandardLabelTextTemplate", variableDebugger.Frames.BoxPanel, 0, 0)
BlzFrameSetPoint(variableDebugger.Frames.SearchLabel, FRAMEPOINT_RIGHT, variableDebugger.Frames.Search, FRAMEPOINT_LEFT, 0.0, 0)
BlzFrameSetText(variableDebugger.Frames.SearchLabel, "Search: ")
variableDebugger.Frames.BoxFilterTitle = BlzCreateFrame("EscMenuTitleTextTemplate", variableDebugger.Frames.BoxFilters, 0, 0)
BlzFrameSetTextAlignment(variableDebugger.Frames.BoxFilterTitle, TEXT_JUSTIFY_MIDDLE, TEXT_JUSTIFY_CENTER)
BlzFrameSetText(variableDebugger.Frames.BoxFilterTitle, "Filter")
BlzFrameSetPoint(variableDebugger.Frames.BoxFilterTitle, FRAMEPOINT_TOPLEFT, variableDebugger.Frames.BoxFilters, FRAMEPOINT_TOPLEFT, 0, -0.015)
BlzFrameSetPoint(variableDebugger.Frames.BoxFilterTitle, FRAMEPOINT_TOPRIGHT, variableDebugger.Frames.BoxFilters, FRAMEPOINT_TOPRIGHT, 0, -0.015)
variableDebugger.createFilterCheckBox("Boolean:", "boolean")
variableDebugger.createFilterCheckBox("AbilityFields:", "abilityintegerfield","abilityrealfield","abilitybooleanfield","abilitystringfield",
"abilitystringfield","abilityintegerlevelfield", "abilityreallevelfield","abilitybooleanlevelfield","abilitystringlevelfield",
"abilitystringlevelfield","abilityintegerlevelarrayfield","abilityreallevelarrayfield","abilitybooleanlevelarrayfield","abilitystringlevelarrayfield")
variableDebugger.createFilterCheckBox("Dialog:", "button","dialog")
variableDebugger.createFilterCheckBox("Destructable:", "destructable")
variableDebugger.createFilterCheckBox("Effect:", "effect")
variableDebugger.createFilterCheckBox("Events:", "event","dialogevent", "widgetevent","gameevent","playerevent","playerunitevent","unitevent","oskeytype","mousebuttontype","limitop")
variableDebugger.createFilterCheckBox("Force:", "force")
variableDebugger.createFilterCheckBox("Frames:", "framehandle","originframetype","framepointtype","textaligntype","frameeventtype")
variableDebugger.createFilterCheckBox("Function:", "function", "boolexpr", "conditionfunc", "filterfunc")
variableDebugger.createFilterCheckBox("Item:", "item")
variableDebugger.createFilterCheckBox("ItemFields:", "itemintegerfield", "itemrealfield","itembooleanfield","itemstringfield")
variableDebugger.createFilterCheckBox("Location:", "location")
variableDebugger.createFilterCheckBox("Number:", "number")
variableDebugger.createFilterCheckBox("Player:", "player")
variableDebugger.createFilterCheckBox("Rect:", "rect","region")
variableDebugger.createFilterCheckBox("String:", "string")
variableDebugger.createFilterCheckBox("Table:", "table")
variableDebugger.createFilterCheckBox("Timer:", "timer")
variableDebugger.createFilterCheckBox("Trigger:", "trigger","triggercondition","triggeraction")
variableDebugger.createFilterCheckBox("Unit:", "unit")
variableDebugger.createFilterCheckBox("UnitGroup:", "group")
variableDebugger.createFilterCheckBox("UnitFields:", "unitintegerfield","unitrealfield","unitbooleanfield","unitstringfield","unitweaponintegerfield","unitweaponrealfield",
"unitweaponbooleanfield","unitweaponstringfield")
local searchTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(searchTrigger, variableDebugger.Frames.Search, FRAMEEVENT_EDITBOX_ENTER)
TriggerAddAction(searchTrigger, function()
xpcall(function()
local text2Search = BlzGetTriggerFrameText()
if text2Search == "." then print("A single '.' is not allowed as search word") return end
print("Search", text2Search)
--clear variableDebugger.Data.Found
while table.remove(variableDebugger.Data.Found) do end
--searches a table in _G?
if _G[text2Search] then
variableDebugger.insertFound(_G, text2Search, text2Search)
if type(_G[text2Search]) == "table" then
--print("Seached Text is a table in _G")
variableDebugger.AddTable(text2Search, _G[text2Search])
end
else
--searches for a table field?
local word = ""
local searchesArrayField = false
for c in text2Search:gmatch"." do
if c == "." then
searchesArrayField = true
break
else
word = word..c
end
end
--this is not a table filed so search everything of _G
if not searchesArrayField then
--print("String.find")
for key, value in pairs(_G)
do
--avoid adding the found-container or _G
if value ~=_G and value ~= variableDebugger.Data.Found then
if string.find(key, text2Search) then
variableDebugger.insertFound(_G, key, tostring(key))
if type(value) == "table" then
variableDebugger.AddTable(key, value)
end
end
end
end
else
--search a tables field
local text2SearchConverted = variableDebugger.convertText2Number(text2Search)
local lastKey = nil
local searchedField, lastKey = variableDebugger.getLastParent(text2SearchConverted)
-- print("Search",text2SearchConverted)
-- print("Converted", searchedField, lastKey)
if searchedField[lastKey] then
variableDebugger.insertFound(searchedField, lastKey, tostring(text2SearchConverted))
if type(searchedField[lastKey]) == "table" then
variableDebugger.AddTable(text2SearchConverted, searchedField[lastKey])
end
end
end
end
variableDebugger.updateBoxes(0)
variableDebugger.updateSlider()
end,variableDebugger.err)
end)
local editTrigger = CreateTrigger()
TriggerAddAction(editTrigger, function()
xpcall(function()
local index = variableDebugger[BlzGetTriggerFrame()]
local indexData = index + (variableDebugger.Frames.BoxEndIndex - variableDebugger.EditBoxesCount)
local key = variableDebugger.Data.Found[indexData].Key
local displayedText = variableDebugger.Data.Found[indexData].DisplayedText
local tableObject = variableDebugger.Data.Found[indexData].Parent
local value = BlzFrameGetText(BlzGetTriggerFrame())
local textFourCC = nil
if value == "false" then
value = false
elseif value == "true" then
value = true
elseif value == "nil" then
value = nil
elseif tonumber(value) then
value = tonumber(value)
elseif string.len(value) == 4 and GetObjectName(FourCC(value)) then
textFourCC = value
value = FourCC(value)
end
tableObject[key] = value
local newObject = "Time: "..os.clock().." " ..displayedText.." = "
if textFourCC then
newObject = newObject..textFourCC
else
newObject = newObject..tostring(value)
end
table.insert(variableDebugger.Data.Changes, newObject)
BlzFrameAddText(variableDebugger.Frames.ChangeLog, newObject)
end,variableDebugger.err)
end)
local monitorButtonTrigger = CreateTrigger()
TriggerAddAction(monitorButtonTrigger, function()
xpcall(function()
local index = variableDebugger[BlzGetTriggerFrame()]
local indexData = index + (variableDebugger.Frames.BoxEndIndex - variableDebugger.EditBoxesCount)
if not variableDebugger.Data.Found[indexData] then return end
local key = variableDebugger.Data.Found[indexData].Key
local displayedText = variableDebugger.Data.Found[indexData].DisplayedText
local tableObject = variableDebugger.Data.Found[indexData].Parent
if not variableDebugger.MonitorRemoveVariable(displayedText) then
print("Start monitoring")
variableDebugger.MonitorAddVariable(tableObject, key, displayedText)
end
if variableDebugger.Data.Monitor[displayedText] then
BlzFrameSetTexture(variableDebugger.EditBoxes[index].MonitorIcon, "ReplaceableTextures\\CommandButtons\\BTNCancel", 0, true)
else
BlzFrameSetTexture(variableDebugger.EditBoxes[index].MonitorIcon, "ReplaceableTextures\\WorldEditUI\\Doodad-Cinematic", 0, true)
end
end,variableDebugger.err)
end)
variableDebugger.Frames.SearchUnit = BlzCreateFrameByType("GLUETEXTBUTTON", "MyButton", variableDebugger.Frames.BoxPanel, "ScriptDialogButton", 0)
BlzFrameSetPoint(variableDebugger.Frames.SearchUnit, FRAMEPOINT_RIGHT, variableDebugger.Frames.SearchLabel, FRAMEPOINT_LEFT, 0, 0)
BlzFrameSetSize(variableDebugger.Frames.SearchUnit, 0.11, 0.03)
BlzFrameSetText(variableDebugger.Frames.SearchUnit, "Search Unit Data")
local searchUnitTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(searchUnitTrigger, variableDebugger.Frames.SearchUnit, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(searchUnitTrigger, function()
xpcall(function()
--print("searchUnitTrigger")
if variableDebugger.Data.SelectedUnit then
tostring(variableDebugger.Data.SelectedUnit)
while table.remove(variableDebugger.Data.Found) do end
variableDebugger.AddUnitDataFromTable("", _G, variableDebugger.Data.SelectedUnit)
variableDebugger.updateBoxes(0)
variableDebugger.updateSlider()
end
end,variableDebugger.err)
end)
local lastSelectedUnitTrigger = CreateTrigger()
TriggerRegisterAnyUnitEventBJ(lastSelectedUnitTrigger, EVENT_PLAYER_UNIT_SELECTED)
TriggerAddAction(lastSelectedUnitTrigger, function()
if GetTriggerPlayer() == GetLocalPlayer() then
--print("Selected Unit", GetTriggerUnit())
variableDebugger.Data.SelectedUnit = GetTriggerUnit()
end
end)
local hoverValueTrigger = CreateTrigger()
TriggerAddAction(hoverValueTrigger, function()
xpcall(function()
--print("hoverValueTrigger")
--do nothing when the field is empty
if BlzFrameGetText(BlzGetTriggerFrame()) =="" then return end
local index = variableDebugger[BlzGetTriggerFrame()]
local indexData = index + (variableDebugger.Frames.BoxEndIndex - variableDebugger.EditBoxesCount)
local key = variableDebugger.Data.Found[indexData].Key
local displayedText = variableDebugger.Data.Found[indexData].DisplayedText
local tableObject = variableDebugger.Data.Found[indexData].Parent
variableDebugger.Data.LastHoveredTable = tableObject
variableDebugger.Data.LastHoveredTableKey = key
variableDebugger.Data.LastHoveredDisplay = displayedText
BlzFrameSetText(variableDebugger.Frames.ValueDetailWindow, variableDebugger.Data.LastHoveredDisplay)
BlzFrameAddText(variableDebugger.Frames.ValueDetailWindow, variableDebugger.GetDetailInfo(tableObject[key]))
end,variableDebugger.err)
end)
local LockValueDetailWindowTargetTrigger = CreateTrigger()
BlzTriggerRegisterFrameEvent(LockValueDetailWindowTargetTrigger, variableDebugger.Frames.LockValueDetailWindowTarget, FRAMEEVENT_CONTROL_CLICK)
TriggerAddAction(LockValueDetailWindowTargetTrigger, function()
if IsTriggerEnabled(hoverValueTrigger) then
DisableTrigger(hoverValueTrigger)
BlzFrameSetText(variableDebugger.Frames.LockValueDetailWindowTarget, "UnLock")
else
EnableTrigger(hoverValueTrigger)
BlzFrameSetText(variableDebugger.Frames.LockValueDetailWindowTarget, "Lock")
end
end)
local prev = nil
for index = 1, variableDebugger.EditBoxesCount, 1
do
local newObject = {}
newObject.Name = BlzCreateFrame("EscMenuEditBoxTemplate", variableDebugger.Frames.BoxPanel, 0, 0)
newObject.Value = BlzCreateFrame("EscMenuEditBoxTemplate", variableDebugger.Frames.BoxPanel, 0, 0)
newObject.Monitor = BlzCreateFrame("EscMenuPopupMenuArrowTemplate", variableDebugger.Frames.BoxPanel, 0, 0)
newObject.MonitorIcon = BlzGetFrameByName("EscMenuPopupMenuArrowBackdropTemplate", 0)
BlzFrameSetTexture(newObject.MonitorIcon, "ReplaceableTextures\\WorldEditUI\\Doodad-Cinematic", 0, true)
variableDebugger[newObject.Value] = index
variableDebugger[newObject.Name] = index
variableDebugger[newObject.Monitor] = index
-- BlzFrameSetEnable(newObject.Name , false)
BlzFrameSetPoint(newObject.Value, FRAMEPOINT_LEFT, newObject.Name, FRAMEPOINT_RIGHT, 0, 0)
BlzFrameSetPoint(newObject.Monitor, FRAMEPOINT_RIGHT, newObject.Name, FRAMEPOINT_LEFT, 0, 0)
if index == 1 then
BlzFrameSetPoint(newObject.Name, FRAMEPOINT_TOPLEFT, variableDebugger.Frames.Box, FRAMEPOINT_TOPLEFT, 0.019, -0.085)
else
BlzFrameSetPoint(newObject.Name, FRAMEPOINT_TOPLEFT, prev, FRAMEPOINT_BOTTOMLEFT, 0, 0.00)
end
BlzFrameSetSize(newObject.Name, 0.203, 0.03)
BlzFrameSetSize(newObject.Value, 0.093, 0.03)
BlzTriggerRegisterFrameEvent(editTrigger, newObject.Value, FRAMEEVENT_EDITBOX_ENTER)
BlzTriggerRegisterFrameEvent(monitorButtonTrigger, newObject.Monitor, FRAMEEVENT_CONTROL_CLICK)
BlzTriggerRegisterFrameEvent(hoverValueTrigger, newObject.Value, FRAMEEVENT_MOUSE_ENTER)
table.insert(variableDebugger.EditBoxes, newObject)
prev = newObject.Name
end
end, variableDebugger.err)
end)








Attachments
Last edited: