Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Plugins ➜ Question on "improved health bar plugin"

Question on "improved health bar plugin"

You need to log onto the forum to reply or create new threads.

  Refresh page


Posted by Hidelensman   (13 posts)  Bio
Date Sat 23 Nov 2024 03:27 AM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 23 Nov 2024 06:29 AM (UTC)
Message
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?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Hidelensman   (13 posts)  Bio
Date Reply #2 on Sat 23 Nov 2024 11:59 AM (UTC)

Amended on Mon 25 Nov 2024 02:58 PM (UTC) by Hidelensman

Message
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
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 24 Nov 2024 03:39 AM (UTC)
Message
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")

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Hidelensman   (13 posts)  Bio
Date Reply #4 on Sat 07 Dec 2024 06:44 AM (UTC)
Message
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
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #5 on Sat 07 Dec 2024 11:22 PM (UTC)
Message
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) )

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


931 views.

You need to log onto the forum to reply or create new threads.

  Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.