PDA

View Full Version : Combat Tracker on top



MagpieManny
July 20th, 2017, 20:46
Hello there,
Is there a way to have the combat tracker always be on top?

Zacchaeus
July 20th, 2017, 21:26
No, you can't do anything as fancy as that with the windows. Whatever you open opens on top of whatever is already there.

Nickademus
July 20th, 2017, 22:53
It is possible with an extension. Set a function on the handler Interface.onWindowOpened and have it run the code

if User.isHost() then
Interface.findWindow("combattracker_host", "combattracker").bringToFront();
else
Interface.findWindow("combattracker_client", "combattracker").bringToFront();
end

celestian
July 20th, 2017, 23:31
It is possible with an extension. Set a function on the handler Interface.onWindowOpened and have it run the code

if User.isHost() then
Interface.findWindow("combattracker_host", "combattracker").bringToFront();
else
Interface.findWindow("combattracker_client", "combattracker").bringToFront();
end

I actually played around with this because I wasn't aware of it and found this works.

Created windowmanager.lua, included it in base.xml as


<script name="WindowManagerADND" file="scripts/windowmanager.lua" />

windowmanager.lua contents


function onInit()
Interface.onWindowOpened = ctOnTopAlways;
end

-- keep the combat tracker on top all the time
function ctOnTopAlways(window)
if User.isHost() then
if Interface.findWindow("combattracker_host", "combattracker") then
Interface.findWindow("combattracker_host", "combattracker").bringToFront();
end
else
if Interface.findWindow("combattracker_client", "combattracker") then
Interface.findWindow("combattracker_client", "combattracker").bringToFront();
end
end
end



It "works" of sorts. Windows initially opened will appear below them but if you select them they will be placed over it.

Thanks for the details on this Nick.

Nickademus
July 21st, 2017, 01:55
No problem. Though I'm not sure why anyone would want the CT permanently on top of the window they are working with. This keeps it easy to find though.

Oh, to follow up: if you want the CT opened when FG starts as well, you'll want to add another handler.

Interface.onDesktopInit = ctOnTopAlways;

celestian
July 21st, 2017, 02:21
No problem. Though I'm not sure why anyone would want the CT permanently on top of the window they are working with. This keeps it easy to find though.

Yeah, I'm gonna try it out for a bit and see how I like it. As I said it does put the window on top and when other windows open they go below it BUT if you select those other windows they will go over it.

MagpieManny
July 21st, 2017, 10:42
So not as tech savy as u guys are, how do inplement this?

Why I want this? I run a home game with a touch screen. At the moment whenever you move the map you move the window. So it will be above the ct each time you move it.

I could put it in the buttom bar. But stuff wilnalso go over that bar ...

Nickademus
July 21st, 2017, 11:11
FG will always have the window with focus on top. So if you move the map, it will put it above the CT regardless of any extension. It might be possible to program the imagecontrol to put the CT back on top, but I don't know of a handler that fires when the map view is moved.

Ken L
July 21st, 2017, 11:14
if there was a focus lost/gained hook this would be trivial.