PDA

View Full Version : In LUA, how do I tell if a character sheet window is visible or not?



SilentRuin
July 17th, 2020, 06:06
I forgot character sheet is a tabbed window for main and the rest. I need something done to charsheet (portrait area etc.) but only want it done when the main is up. Unfortunately doing



window.parentcontrol.window.main.isVisible()


Is not doing anything. Looking in Dev guide I don't really see an isVisible() for windows. How do I tell if the above described window is currently displayed?

Moon Wizard
July 17th, 2020, 06:22
For windows, if they exist, then they are accessible through control/window traversal.

You probably want something like:
if window.parentcontrol.window.main.subwindow then
<do something>
end

Alternately, you could look for character window using Interface.findWindow.
local windowChar = Interface.findWindow("charsheet", <charpath>)
if windowChar and windowChar.main.subwindow then
<do something>
end

Sort of depends where you are starting or triggering from.

Regards,
JPG

SilentRuin
July 17th, 2020, 15:40
For windows, if they exist, then they are accessible through control/window traversal.

You probably want something like:
if window.parentcontrol.window.main.subwindow then
<do something>
end

Alternately, you could look for character window using Interface.findWindow.
local windowChar = Interface.findWindow("charsheet", <charpath>)
if windowChar and windowChar.main.subwindow then
<do something>
end

Sort of depends where you are starting or triggering from.

Regards,
JPG

Sadly this did not work :(

If there is not way to do this then I'll just have to let other extensions that use this suffer the wrath of mine. Tried to be nice...



-- Insure this is one of the known tabs (so we don't break someone adding in a new one)
local bProcess = false;
if window.parentcontrol.window.main.subwindow or
window.parentcontrol.window.skills.subwindow or
window.parentcontrol.window.abilities.subwindow or
window.parentcontrol.window.inventory.subwindow or
window.parentcontrol.window.notes.subwindow or
window.parentcontrol.window.logs.subwindow or
window.parentcontrol.window.actions.subwindow then
bProcess = true;
end