Question on "improved health bar plugin"

Posted by Hidelensman on Sat 23 Nov 2024 03:27 AM — 6 posts, 10,387 views.

#0
Dear all,

I followed Nick's illustration in this post (https://mushclient.com/forum/bbshowpost.php?id=9270&page=4) and revised for the Mud I played.

Generally the revised plugin runs smoothly, only one thing doesn't work as expected is the part about showing percentage in balloons - my revised version still shows "Drag to move windows" when I mouse-over.

The following is my code and appreciate any guidance/advice. Thanks!

https://ufile.io/0i89ooby (cannot directly include in the post since more than 6000 characters)

P.S. The Mud I play is a Chinese one, hence some Chinese characters included in the code.
Australia Forum Administrator #1
The code that does the tooltip is this:


-- store numeric values in case they mouse over it
  WindowHotspotTooltip(win, sPrompt, string.format ("%s\t%i / %i (%i%%)", 
                        sPrompt, current, max, Fraction * 100) )


I can't seem to download your file because of ad blockers, etc. How about posting it as a gist on GitHub?

Can you confirm that your function DoGauge does do the code above?
#2
Nick Gammon said:


I can't seem to download your file because of ad blockers, etc. How about posting it as a gist on GitHub?



Thanks. Sure, please see if this link works: https://github.com/hidelensman/WarinField/blob/178f72429b1d46f01ff823404028442a905bf6c2/WF_health_bar_miniwindow_v3%20.xml

Nick Gammon said:

Can you confirm that your function DoGauge does do the code above?


Yes, the DoGauge function includes that part - here is a screenshot for reference: https://github.com/hidelensman/WarinField/blob/178f72429b1d46f01ff823404028442a905bf6c2/Health%20bar_plugin.jpg
Amended on Mon 25 Nov 2024 02:58 PM by Hidelensman
Australia Forum Administrator #3
I'm going to take a guess that the Unicode characters in the bar names are interfering with the hotspot drawing. Just to confirm this, try changing the Chinese characters below to Western ones (eg. the English equivalent) just as a test:


  DoGauge ( "精" .. "(" .. psp .. "%): ",     sp,       max_sp,   ColourNameToRGB "darkgreen")
  DoGauge ( "氣" .. "(" .. php .. "%): ",     hp,       max_hp,  ColourNameToRGB "mediumblue")
  DoGauge ( "神" .. "(" .. pmp .. "%): ",     mp,       max_mp,        ColourNameToRGB "gold")
  DoGauge (                     "靈力: ",   mana,   2*max_mana,        ColourNameToRGB "grey")
  DoGauge (                     "內力: ",  force,  2*max_force,         ColourNameToRGB "red")
  DoGauge (                     "法力: ",  magic,  2*max_magic,      ColourNameToRGB "orange")
#4
Nick Gammon said:

I'm going to take a guess that the Unicode characters in the bar names are interfering with the hotspot drawing. Just to confirm this, try changing the Chinese characters below to Western ones (eg. the English equivalent) just as a test:


  DoGauge ( "精" .. "(" .. psp .. "%): ",     sp,       max_sp,   ColourNameToRGB "darkgreen")
  DoGauge ( "氣" .. "(" .. php .. "%): ",     hp,       max_hp,  ColourNameToRGB "mediumblue")
  DoGauge ( "神" .. "(" .. pmp .. "%): ",     mp,       max_mp,        ColourNameToRGB "gold")
  DoGauge (                     "靈力: ",   mana,   2*max_mana,        ColourNameToRGB "grey")
  DoGauge (                     "內力: ",  force,  2*max_force,         ColourNameToRGB "red")
  DoGauge (                     "法力: ",  magic,  2*max_magic,      ColourNameToRGB "orange")



Ah-ha, Nick your guess is right - I changed these characters to English and now the percentages showing in balloons. Thanks Nick for the insight.

While is there any method to keep using Chinese characters but making the function still work? The Mud I'm playing is related to Chinese Wuxia hence it's a bit hard to find English words close to the original meaning of these characters lol
Australia Forum Administrator #5
Get rid of the bar name from the tooltip, and just see the percentages, eg.


-- store numeric values in case they mouse over it
  WindowHotspotTooltip(win, sPrompt, string.format ("%i / %i (%i%%)", 
                        current, max, Fraction * 100) )