MostTornBrain
March 5th, 2022, 16:43
Hi,
Not sure if this is the prpoer forum for this question - I'm trying to modify the token health bar display via an extension and I am seeing a behavior I don't understand. I have created a second white colored health bar widget that will be displayed under the normal percentage health bar, to show the original 100% full bar length. The following code visually does it, but the hover text describing the wound level no longer appears.
if bAddBar then
local widgetHealthBar = aWidgets["healthbar"];
if not widgetHealthBar then
widgetHealthBar = tokenCT.addBitmapWidget("healthbar");
widgetHealthBar.bringToFront();
widgetHealthBar.setName("healthbar");
end
local widgetHealthBarFrame = aWidgets["healthbarframe"];
if not widgetHealthBarFrame then
widgetHealthBarFrame = tokenCT.addBitmapWidget("healthbar");
widgetHealthBarFrame.sendToBack();
widgetHealthBarFrame.setName("healthbarframe");
end
if widgetHealthBar then
widgetHealthBar.bringToFront();
widgetHealthBar.setColor(sColor);
widgetHealthBar.setTooltipText(sStatus);
widgetHealthBar.setVisible(sOptTH == "bar");
updateHealthBarScale(tokenCT, nodeCT, nPercentWounded);
end
if widgetHealthBarFrame then
widgetHealthBarFrame.sendToBack();
widgetHealthBarFrame.setVisible(sOptTH == "bar");
end
end
If I call "sendToBack()" instead of "bringToFront()" for the widgetHealthBar, then the hover text works, but then the real health bar is visually hidden behind the widgetHealthBarFrame. Is the lowest level widget in the drawn stack supposed to be the one that triggers the hover text? If so, I suppose I need to do something different. This is the effect I am trying to create (which currently works, minus the hover text support):
51840
Thank you for any clarification on what I am doing wrong.
Cheers,
Brian
Not sure if this is the prpoer forum for this question - I'm trying to modify the token health bar display via an extension and I am seeing a behavior I don't understand. I have created a second white colored health bar widget that will be displayed under the normal percentage health bar, to show the original 100% full bar length. The following code visually does it, but the hover text describing the wound level no longer appears.
if bAddBar then
local widgetHealthBar = aWidgets["healthbar"];
if not widgetHealthBar then
widgetHealthBar = tokenCT.addBitmapWidget("healthbar");
widgetHealthBar.bringToFront();
widgetHealthBar.setName("healthbar");
end
local widgetHealthBarFrame = aWidgets["healthbarframe"];
if not widgetHealthBarFrame then
widgetHealthBarFrame = tokenCT.addBitmapWidget("healthbar");
widgetHealthBarFrame.sendToBack();
widgetHealthBarFrame.setName("healthbarframe");
end
if widgetHealthBar then
widgetHealthBar.bringToFront();
widgetHealthBar.setColor(sColor);
widgetHealthBar.setTooltipText(sStatus);
widgetHealthBar.setVisible(sOptTH == "bar");
updateHealthBarScale(tokenCT, nodeCT, nPercentWounded);
end
if widgetHealthBarFrame then
widgetHealthBarFrame.sendToBack();
widgetHealthBarFrame.setVisible(sOptTH == "bar");
end
end
If I call "sendToBack()" instead of "bringToFront()" for the widgetHealthBar, then the hover text works, but then the real health bar is visually hidden behind the widgetHealthBarFrame. Is the lowest level widget in the drawn stack supposed to be the one that triggers the hover text? If so, I suppose I need to do something different. This is the effect I am trying to create (which currently works, minus the hover text support):
51840
Thank you for any clarification on what I am doing wrong.
Cheers,
Brian