[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Improved health bar plugin - can be dragged around

Improved health bar plugin - can be dragged around

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Pages: 1  2  3 4  5  6  7  

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #30 on Mon 04 Jan 2010 12:56 AM (UTC)

Amended on Mon 04 Jan 2010 01:01 AM (UTC) by Twisol

Message
The neat thing about pastebin.com is that you can add whatever gibberish you want for a subdomain, and it'll work. All of the below urls go to different unique pastebins:

mushclient.pastebin.com
www.pastebin.com (aka just pastebin.com)
etaijaeltkjtkjaeta.pastebin.com



Your changes look good! I particularly like how you use the sampled pixel as input to two more WindowGradient() calls, to give it a 3D/glassy look. :)

EDIT: For what it's worth, since you've basically created a new plugin, you might want to give it a new ID, update the written date, and add yourself as the author (all in the <plugin> tag at the top). (Of course, I'd add a comment noting Nick's original as the inspiration, for good measure.)

EDIT 2: You could also move the first WindowGradient() call, the one that creates the gradient line, into OnPluginInstall, because the colors are constant and it's not going to change every time you draw the same gradient.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Keberus   (31 posts)  [Biography] bio
Date Reply #31 on Mon 04 Jan 2010 01:20 AM (UTC)
Message
Alright, applied your suggested changes.

Thanks again,
KeB
[Go to top] top

Posted by Keberus   (31 posts)  [Biography] bio
Date Reply #32 on Thu 07 Jan 2010 12:23 AM (UTC)
Message
I know that I'm still a newb and everything. But, initially I didn't notice this, but now I do. The status box is always one step behind my prompt, upon further testing it's because my prompt doesn't have a newline at the end. So, is there a way to modify the trigger so it will still catch even without the newline, or do I have to put the newline in my prompt if I want the box to be 'up to date'.

Thanks,
KeB
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #33 on Thu 07 Jan 2010 12:27 AM (UTC)
Message
Triggers fire on a newline, so you will have to add one if you want it to be the latest info.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Keberus   (31 posts)  [Biography] bio
Date Reply #34 on Thu 07 Jan 2010 12:32 AM (UTC)
Message
That's what I wanted to know.

Thanks,
[Go to top] top

Posted by forral   USA  (79 posts)  [Biography] bio
Date Reply #35 on Thu 14 Jan 2010 05:00 AM (UTC)

Amended on Thu 14 Jan 2010 05:13 AM (UTC) by forral

Message
Nick,

I was wondering if I could get your help in setting my bar up in the mud I play? (Materia Magica). I've asked numerous times in game but no one has been able to help me.

My prompt looks like this: [*]<2366hp 1595sp 1689st>

the * means I'm affected by invisibility.

Also, would I be able to apply something similar to my ship's remaining hull? Prompt is:

(450hull --dir ANCHOR --wind 100%shld 1190,965)


And also, when I used to use Portal, it had a bar that showed the enemy's remaining health in numerical terms, i.e. it converted the expressions from the game into a % on the graphical bar, are we able to do that in MUSH?

I eagerly wait a reply.

Sincerely,
Forral
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #36 on Thu 14 Jan 2010 10:37 PM (UTC)
Message
The health bar works by knowing your current and maximum HP etc.

Your prompt:


<2366hp 1595sp 1689st>


... only shows the current value, thus it can't display a bar because it doesn't your maximum HP. You need to find a way to show that, for example, by changing your prompt to look more like what was shown on page 1 of this thread.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Basyiel   (10 posts)  [Biography] bio
Date Reply #37 on Thu 11 Feb 2010 12:38 PM (UTC)
Message
Id like to get a nice health/status bar going if someone could help me, new to to this, trying to learn as fast as i can, anyways here's my stats bar in game:


5932 health, 9292 endurance, 276 guile x A:100% -
You are no longer in the throes of combat.
5932 health, 9292 endurance, 275 guile x-



It shows adrenaline % in combat thats the A
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #38 on Thu 11 Feb 2010 06:53 PM (UTC)
Message
To show a bar it needs to know your current and maximum. Just seeing:


5932 health, 9292 endurance, 276 guile x A:100% -


... I wouldn't know if you are almost dead, 50% healthy or 100% healthy.


Can you change your prompt to something like:


5932/6000 health, 9292/11000 endurance, 276/300 guile x A:100% -


Then a simple change to the trigger would pick all that up.

Alternatively, it might have to change to deduce your maximum from the highest figure it ever sees.

For example, if your health is 5932, and is never seen to be higher, it might assume that 5932 is your maximum.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Basyiel   (10 posts)  [Biography] bio
Date Reply #39 on Fri 12 Feb 2010 05:31 AM (UTC)

Amended on Fri 12 Feb 2010 05:51 AM (UTC) by Basyiel

Message
Ugh, I checked all the command prompt options and splitting isnt one of them, asked in game an told it isnt an option, all i could do was add/remove stats and shorten them.. which i did it now looks like:

6280h, 9562e, 274g x A:59% - (in battle)
6280h, 9562e, 277g xb- (out of battle)

all stats are full at the moment.. except Adrenaline at 59%
(I made a level since the last post so now they are all slightly higher.)


---by the way the xb is just x = standing b = balance--


Am i outta luck? no status bar for me then?
[Go to top] top

Posted by Basyiel   (10 posts)  [Biography] bio
Date Reply #40 on Fri 12 Feb 2010 05:57 PM (UTC)

Amended on Fri 12 Feb 2010 09:18 PM (UTC) by Nick Gammon

Message
Ya know.. when you check "score" it lists my stats in the format youre looking for, is it possible to pull the stats from the score and just get the adrenaline from the prompt?



Basyiel (male Northlands Goblin)
You are level 65 (Enshrined) and 1.88% of the way to the next level.
Health:  6280/6280  Endurance:  9562/9562
Guile:  272/278
You are ranked 84th in Midkemia.
You stand tall as a proud Clansman of Sar-Sargoth.
You are a Hatchling in the Clan Raven.
You are a Rogue.
You are a Worldwalker in the Fellowship of Explorers.
You are 17 years old, having been born on the 6th of Yamiev, 12 years before the
Darkness at Sethanon.
You carry 8 copper in Kingdom currency.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #41 on Fri 12 Feb 2010 07:08 PM (UTC)
Message
My first attempt is to assume the maxima are the largest figures you ever see (eg. when you are at full health), like this:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="Health_Bar_Miniwindow2"
   author="Nick Gammon"
   id="78dcd04fc1096e8988f03892"
   language="Lua"
   purpose="Shows stats in a mini window"
   date_written="2010-02-12"
   requires="4.40"
   version="1.0"
   save_state="y"
   >
<description trim="y">
<![CDATA[
Install this plugin to show an info bar with HP, Endurance, 
and Guile points shown as a bar.

The window can be dragged to a new location with the mouse.
]]>
</description>

</plugin>

<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   match="^(\d+)h, (\d+)e, (\d+)g "
   regexp="y"
   script="do_prompt"
   sequence="100"
  >
  </trigger>
</triggers>

<!--  Aliases  -->

<aliases>
  <alias
   match="^maxima (\d+) (\d+) (\d+)$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
max_hp = %1
max_endurance = %2
max_guile = %3

-- draw gauge again if possible
if hp and endurance and guile then
  do_prompt ("", "", { hp, endurance, guile } )
end -- if know hp, endurance and guile

</send>
  </alias>
</aliases>


<!--  Script  -->


<script>
<![CDATA[

GAUGE_HEIGHT = 15

WINDOW_WIDTH = 300
WINDOW_HEIGHT = 65
NUMBER_OF_TICKS = 5

BACKGROUND_COLOUR = ColourNameToRGB "rosybrown"
FONT_COLOUR = ColourNameToRGB "darkred"
BORDER_COLOUR = ColourNameToRGB "#553333"

function DoGauge (sPrompt, Percent, Colour)

  local Fraction = tonumber (Percent)
  
  if Fraction > 1 then Fraction = 1 end
  if Fraction < 0 then Fraction = 0 end
   
  local width = WindowTextWidth (win, font_id, sPrompt)
  
  WindowText (win, font_id, sPrompt, gauge_left - width, vertical, 0, 0, FONT_COLOUR)

  WindowRectOp (win, 2, gauge_left, vertical, WINDOW_WIDTH - 5, vertical + GAUGE_HEIGHT, 
                          BACKGROUND_COLOUR)  -- fill entire box
 
  
  local gauge_width = (WINDOW_WIDTH - gauge_left - 5) * Fraction
  
   -- box size must be > 0 or WindowGradient fills the whole thing 
  if math.floor (gauge_width) > 0 then
    
    -- top half
    WindowGradient (win, gauge_left, vertical, gauge_left + gauge_width, vertical + GAUGE_HEIGHT / 2, 
                    0x000000,
                    Colour, 2) 
    
    -- bottom half
    WindowGradient (win, gauge_left, vertical + GAUGE_HEIGHT / 2, 
                    gauge_left + gauge_width, vertical +  GAUGE_HEIGHT,   
                    Colour,
                    0x000000,
                    2) 

  end -- non-zero
  
  -- show ticks
  local ticks_at = (WINDOW_WIDTH - gauge_left - 5) / (NUMBER_OF_TICKS + 1)
  
  -- ticks
  for i = 1, NUMBER_OF_TICKS do
    WindowLine (win, gauge_left + (i * ticks_at), vertical, 
                gauge_left + (i * ticks_at), vertical + GAUGE_HEIGHT, ColourNameToRGB ("silver"), 0, 1)
  end -- for

  -- draw a box around it
  check (WindowRectOp (win, 1, gauge_left, vertical, WINDOW_WIDTH - 5, vertical + GAUGE_HEIGHT, 
          ColourNameToRGB ("lightgrey")))  -- frame entire box
  
  vertical = vertical + font_height + 3
end -- function

function do_prompt (name, line, wildcards)

  hp = tonumber (wildcards [1])
  endurance = tonumber (wildcards [2])
  guile = tonumber (wildcards [3])
    
  -- guess maxima
  max_hp = math.max (hp, max_hp)
  max_endurance = math.max (endurance, max_endurance)
  max_guile = math.max (guile, max_guile)
  
  local hp_percent = hp / max_hp
  local endurance_percent = endurance / max_endurance
  local guile_percent = guile / max_guile

  -- fill entire box to clear it
  check (WindowRectOp (win, 2, 0, 0, 0, 0, BACKGROUND_COLOUR))  -- fill entire box
  
  -- Edge around box rectangle
  check (WindowCircleOp (win, 3, 0, 0, 0, 0, BORDER_COLOUR, 0, 2, 0, 1))

  vertical = 6  -- pixel to start at

  DoGauge ("HP: ",   hp_percent,    ColourNameToRGB "darkgreen")
  DoGauge ("Endurance: ", endurance_percent,  ColourNameToRGB "mediumblue")
  DoGauge ("Guile: ", guile_percent,  ColourNameToRGB "gold")

  WindowShow (win, true)
  
end -- draw_bar


function OnPluginInstall ()
  
  win = GetPluginID ()
  font_id = "fn"
  
  require "movewindow"  -- load the movewindow.lua module

  -- install the window movement handler, get back the window position
  windowinfo = movewindow.install (win, 7)  -- default to 7 (on right, center top/bottom)
                   
  font_name = "Fixedsys"    -- the font

  -- get maxima from last time
  max_hp, max_endurance, max_guile = 
      tonumber (GetVariable ("max_hp")) or 0,
      tonumber (GetVariable ("max_endurance")) or 0,
      tonumber (GetVariable ("max_guile")) or 0
    
  -- make miniwindow so I can grab the font info
  check (WindowCreate (win, 
                 windowinfo.window_left,
                 windowinfo.window_top,
                 WINDOW_WIDTH, 
                 WINDOW_HEIGHT,  
                 windowinfo.window_mode,   
                 windowinfo.window_flags,   
                 BACKGROUND_COLOUR) )

  -- add the drag handler so they can move the window around
  movewindow.add_drag_handler (win, 0, 0, 0, 0)
                 
  check (WindowFont (win, font_id, font_name, 9, false, false, false, false, 0, 0))  -- normal
  
  font_height = WindowFontInfo (win, font_id, 1)  -- height
  
  -- work out how far in to start the gauge
  gauge_left = WindowTextWidth (win, font_id, "HP: ")
  gauge_left = math.max (gauge_left, WindowTextWidth (win, font_id, "Endurance: "))
  gauge_left = math.max (gauge_left, WindowTextWidth (win, font_id, "Guile: "))
  gauge_left = gauge_left + 5  -- allow gap from edge
  
  if GetVariable ("enabled") == "false" then
    ColourNote ("yellow", "", "Warning: Plugin " .. GetPluginName ().. " is currently disabled.")
    check (EnablePlugin(GetPluginID (), false))
    return
  end -- they didn't enable us last time
 
end -- OnPluginInstall

function OnPluginDisable ()
  WindowShow (win, false)
end -- OnPluginDisable

function OnPluginEnable ()
  WindowShow (win, true)
  -- draw gauge again if possible
  if hp and endurance and guile then
    do_prompt ("", "", { hp, endurance, guile } )
  end -- if know hp, endurance and guile
end -- OnPluginEnable

function OnPluginSaveState ()
   -- save window current location for next time  
  movewindow.save_state (win)
  SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17)))
  SetVariable ("max_hp", max_hp or 0)
  SetVariable ("max_endurance", max_endurance or 0)
  SetVariable ("max_guile", max_guile or 0)
end -- OnPluginSaveState


]]>
</script>

</muclient>


The lines in bold above set your maxima to whatever the largest you ever see is.

This should work OK, but might fail if your health temporarily went higher than usual (eg. a buff). So I added an alias, which you can type to reset the maxima like this:



maxima 6280 9562 274


Just supply the three figures in that order and it remembers them for next time. And if you would rather always do it that way, just comment out the lines in bold (put "--" in front of them).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #42 on Fri 12 Feb 2010 07:22 PM (UTC)
Message
The version below uses the "score" command instead of guesswork. It has a multi-line trigger which matches the two lines:


Health: 6280/6280 Endurance: 9562/9562
Guile: 272/278


That tells it the current and maxima, so it can draw the bar immediately. Afterwards it shows the current from the prompt. Now you only need to type "score" each time you level.

(You could make a trigger that matches whatever it says when you level and automatically send "score").


Template:saveplugin=Health_Bar_Miniwindow2 To save and install the Health_Bar_Miniwindow2 plugin do this:
  1. Copy between the lines below (to the Clipboard)
  2. Open a text editor (such as Notepad) and paste the plugin into it
  3. Save to disk on your PC, preferably in your plugins directory, as Health_Bar_Miniwindow2.xml
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file Health_Bar_Miniwindow2.xml (which you just saved in step 3) as a plugin
  7. Click "Close"



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="Health_Bar_Miniwindow2"
   author="Nick Gammon"
   id="78dcd04fc1096e8988f03892"
   language="Lua"
   purpose="Shows stats in a mini window"
   date_written="2010-02-12"
   requires="4.40"
   version="1.0"
   save_state="y"
   >
<description trim="y">
<![CDATA[
Install this plugin to show an info bar with HP, Endurance, 
and Guile points shown as a bar.

The window can be dragged to a new location with the mouse.
]]>
</description>

</plugin>

<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   match="^(\d+)h, (\d+)e, (\d+)g "
   regexp="y"
   script="do_prompt"
   sequence="100"
  >
  </trigger>
  

  <trigger
   enabled="y"
   lines_to_match="2"
   match="^Health\: (\d+)\/(\d+) Endurance\: (\d+)\/(\d+)\nGuile: (\d+)/(\d+)\Z"
   multi_line="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
  
hp = %1
max_hp = %2
endurance = %3
max_endurance = %4
guile = %5
max_guile = %6

-- draw gauge
do_prompt ("", "", { hp, endurance, guile } )

</send>
  </trigger>
 


</triggers>

<!--  Script  -->


<script>
<![CDATA[

GAUGE_HEIGHT = 15

WINDOW_WIDTH = 300
WINDOW_HEIGHT = 65
NUMBER_OF_TICKS = 5

BACKGROUND_COLOUR = ColourNameToRGB "rosybrown"
FONT_COLOUR = ColourNameToRGB "darkred"
BORDER_COLOUR = ColourNameToRGB "#553333"

function DoGauge (sPrompt, Percent, Colour)

  local Fraction = tonumber (Percent)
  
  if Fraction > 1 then Fraction = 1 end
  if Fraction < 0 then Fraction = 0 end
   
  local width = WindowTextWidth (win, font_id, sPrompt)
  
  WindowText (win, font_id, sPrompt, gauge_left - width, vertical, 0, 0, FONT_COLOUR)

  WindowRectOp (win, 2, gauge_left, vertical, WINDOW_WIDTH - 5, vertical + GAUGE_HEIGHT, 
                          BACKGROUND_COLOUR)  -- fill entire box
 
  
  local gauge_width = (WINDOW_WIDTH - gauge_left - 5) * Fraction
  
   -- box size must be > 0 or WindowGradient fills the whole thing 
  if math.floor (gauge_width) > 0 then
    
    -- top half
    WindowGradient (win, gauge_left, vertical, gauge_left + gauge_width, vertical + GAUGE_HEIGHT / 2, 
                    0x000000,
                    Colour, 2) 
    
    -- bottom half
    WindowGradient (win, gauge_left, vertical + GAUGE_HEIGHT / 2, 
                    gauge_left + gauge_width, vertical +  GAUGE_HEIGHT,   
                    Colour,
                    0x000000,
                    2) 

  end -- non-zero
  
  -- show ticks
  local ticks_at = (WINDOW_WIDTH - gauge_left - 5) / (NUMBER_OF_TICKS + 1)
  
  -- ticks
  for i = 1, NUMBER_OF_TICKS do
    WindowLine (win, gauge_left + (i * ticks_at), vertical, 
                gauge_left + (i * ticks_at), vertical + GAUGE_HEIGHT, ColourNameToRGB ("silver"), 0, 1)
  end -- for

  -- draw a box around it
  check (WindowRectOp (win, 1, gauge_left, vertical, WINDOW_WIDTH - 5, vertical + GAUGE_HEIGHT, 
          ColourNameToRGB ("lightgrey")))  -- frame entire box
  
  vertical = vertical + font_height + 3
end -- function

function do_prompt (name, line, wildcards)

  hp = tonumber (wildcards [1])
  endurance = tonumber (wildcards [2])
  guile = tonumber (wildcards [3])
    
  -- don't know maxima yet? can't proceed
  if max_hp == 0 or 
     max_endurance == 0 or 
     max_guile <= 0 then
    return
  end
   
  local hp_percent = hp / max_hp
  local endurance_percent = endurance / max_endurance
  local guile_percent = guile / max_guile

  -- fill entire box to clear it
  check (WindowRectOp (win, 2, 0, 0, 0, 0, BACKGROUND_COLOUR))  -- fill entire box
  
  -- Edge around box rectangle
  check (WindowCircleOp (win, 3, 0, 0, 0, 0, BORDER_COLOUR, 0, 2, 0, 1))

  vertical = 6  -- pixel to start at

  DoGauge ("HP: ",   hp_percent,    ColourNameToRGB "darkgreen")
  DoGauge ("Endurance: ", endurance_percent,  ColourNameToRGB "mediumblue")
  DoGauge ("Guile: ", guile_percent,  ColourNameToRGB "gold")

  WindowShow (win, true)
  
end -- draw_bar


function OnPluginInstall ()
  
  win = GetPluginID ()
  font_id = "fn"
  
  require "movewindow"  -- load the movewindow.lua module

  -- install the window movement handler, get back the window position
  windowinfo = movewindow.install (win, 7)  -- default to 7 (on right, center top/bottom)
                   
  font_name = "Fixedsys"    -- the font

  -- get maxima from last time
  max_hp, max_endurance, max_guile = 
      tonumber (GetVariable ("max_hp")) or 0,
      tonumber (GetVariable ("max_endurance")) or 0,
      tonumber (GetVariable ("max_guile")) or 0
    
  -- make miniwindow so I can grab the font info
  check (WindowCreate (win, 
                 windowinfo.window_left,
                 windowinfo.window_top,
                 WINDOW_WIDTH, 
                 WINDOW_HEIGHT,  
                 windowinfo.window_mode,   
                 windowinfo.window_flags,   
                 BACKGROUND_COLOUR) )

  -- add the drag handler so they can move the window around
  movewindow.add_drag_handler (win, 0, 0, 0, 0)
                 
  check (WindowFont (win, font_id, font_name, 9, false, false, false, false, 0, 0))  -- normal
  
  font_height = WindowFontInfo (win, font_id, 1)  -- height
  
  -- work out how far in to start the gauge
  gauge_left = WindowTextWidth (win, font_id, "HP: ")
  gauge_left = math.max (gauge_left, WindowTextWidth (win, font_id, "Endurance: "))
  gauge_left = math.max (gauge_left, WindowTextWidth (win, font_id, "Guile: "))
  gauge_left = gauge_left + 5  -- allow gap from edge
  
  if GetVariable ("enabled") == "false" then
    ColourNote ("yellow", "", "Warning: Plugin " .. GetPluginName ().. " is currently disabled.")
    check (EnablePlugin(GetPluginID (), false))
    return
  end -- they didn't enable us last time
 
end -- OnPluginInstall

function OnPluginDisable ()
  WindowShow (win, false)
end -- OnPluginDisable

function OnPluginEnable ()
  WindowShow (win, true)
  -- draw gauge again if possible
  if hp and endurance and guile then
    do_prompt ("", "", { hp, endurance, guile } )
  end -- if know hp, endurance and guile
end -- OnPluginEnable

function OnPluginSaveState ()
   -- save window current location for next time  
  movewindow.save_state (win)
  SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17)))
  SetVariable ("max_hp", max_hp or 0)
  SetVariable ("max_endurance", max_endurance or 0)
  SetVariable ("max_guile", max_guile or 0)
end -- OnPluginSaveState


]]>
</script>

</muclient>


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Basyiel   (10 posts)  [Biography] bio
Date Reply #43 on Fri 12 Feb 2010 08:15 PM (UTC)

Amended on Fri 12 Feb 2010 09:03 PM (UTC) by Basyiel

Message
Thanks a ton for all your effort Nick, really enjoying the MUSHclient, just need to take some time and learn some programming.

After loading the bar didnt come up, after reading boards i noticed normally this happens because something doesnt match, i looked at the triggers and it doesnt mention the xb and adrenaline factors.. could that possibly be the problem?

I also have seen some code for the game others have tried and it includes it in an example such as this:

^(\d+)h, (\d+)e(, (\d+)[mfg])? x?b?( A:(\d+)%)?-$

6280h, 9562e, 274g x A:59% - (in battle)
6280h, 9562e, 277g xb- (out of battle)


ya had mentioned the code was basing it off the score, but does it read the prompt at all too? if so, i think this maybe why it doesnt match.

I replaced the trigger code with what i have above and the window came up but no stats were displayed, so must be on the right track.. just need little help to tweak it

Thanks again :-)
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #44 on Fri 12 Feb 2010 09:18 PM (UTC)
Message
I tried it with that exact prompt and it appeared. The match string:


 match="^(\d+)h, (\d+)e, (\d+)g "


... has no terminating $ so it simply matches anything that starts with something like:


6280h, 9562e, 274g


You know that triggers don't match until a newline? Maybe hit <enter> a couple of times. Also it won't display the bars unless it knows the maximum, so try typing "score" first.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


268,517 views.

This is page 3, subject is 7 pages long:  [Previous page]  1  2  3 4  5  6  7  [Next page]

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]