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

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Improved health bar plugin - can be dragged around
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

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 Aralia Faal   (25 posts)  [Biography] bio
Date Reply #90 on Fri 23 Sep 2011 06:22 PM (UTC)
Message
It wont let me add the entire thing so i'm adding only the parts that I changed.

<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   match="^[PL\: (\d+)][KI\: (\d+)][STA\: (\d+)] "
   regexp="y"
   script="do_prompt"
   sequence="100"
  >
  </trigger>
  

  <trigger
   enabled="y"
   lines_to_match="2"
   match="^\|CUR Pl\: [(\d+)] CUR KI\: [(\d+)] CUR STA\: [(\d+)]\n|MAX Pl\: [(\d+)] MAX KI\: [(\d+)] MAX STA\: [(\d+)]"
   multi_line="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
  
hp = %1
max_hp = %4
endurance = %2
max_endurance = %5
guile = %3
max_guile = %6

-- draw gauge
do_prompt ("", "", { pl, ki, sta } )



function do_prompt (name, line, wildcards)

  pl = tonumber (wildcards [1])
  ki = tonumber (wildcards [2])
  sta = tonumber (wildcards [3])
    
  -- don't know maxima yet? can't proceed
  if max_pl == 0 or 
     max_ki == 0 or 
     max_sta <= 0 then
    return
  end
   
  local pl_percent = pl / max_pl
  local ki_percent = ki / max_ki
  local sta_percent = sta / max_sta



  DoGauge ("PL: ",   pl_percent,    ColourNameToRGB "red")
  DoGauge ("KI: ", ki_percent,  ColourNameToRGB "mediumblue")
  DoGauge ("STA: ", sta_percent,  ColourNameToRGB "gold")

  WindowShow (win, true)
  

  -- get maxima from last time
  max_pl, max_ki, max_sta = 
      tonumber (GetVariable ("max_pl")) or 0,
      tonumber (GetVariable ("max_ki")) or 0,
      tonumber (GetVariable ("max_sta")) or 0
    


function OnPluginEnable ()
  WindowShow (win, true)
  -- draw gauge again if possible
  if pl and ki and sta then
    do_prompt ("", "", { pl, ki, sta } )
  end -- if know pl, ki and sta
end -- OnPluginEnable

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


]]>
</script>

</muclient>
[Go to top] top

Posted by Hianastu   (2 posts)  [Biography] bio
Date Reply #91 on Thu 19 Jan 2012 01:27 AM (UTC)
Message
Hi, I'm new to this whole plugin/scripting thing, and I'm trying to figure out how I would get this to work to capture the prompt bar from a trigger.

In the plugin script it says
- <triggers>
<trigger enabled="y" match="^.*?\[(\d+)\/(\d+)hp\|(\d+)\/(\d+)mp\|(\d+)\/(\d+)mv\]$"

I'm not sure if I'm getting this right but in there I'd create a Trigger, like one with the name Promptbar, that would be the trigger to match on instead of the actual promt text itself, then I could modify what the trigger fires on, right?

so instead it would read

- <triggers>
<trigger enabled="y" match="promptbar"

Then I would make a trigger called promptbar and have it fire on

HP%1/%2 M%3/%4 MV%5/%6 ST%7/%8

That would work if my staus bar read as above, right?
[Go to top] top

Posted by Nick Gammon   Australia  (21,407 posts)  [Biography] bio   Forum Administrator
Date Reply #92 on Thu 19 Jan 2012 07:10 PM (UTC)
Message
I'm not sure I understand the question. The whole thread is about capturing from a trigger to make health bar.

Can you explain in more detail? Like, give actual MUD output?

- Nick Gammon

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

Posted by Hianastu   (2 posts)  [Biography] bio
Date Reply #93 on Thu 19 Jan 2012 07:54 PM (UTC)
Message
Nick Gammon said:

I'm not sure I understand the question. The whole thread is about capturing from a trigger to make health bar.

Can you explain in more detail? Like, give actual MUD output?


I don't have a mud output, I'm trying to figure out how to get this to work with Armageddon Mud, and was wondering how I get this to read my promptbar. I noticed in the script it said 'get trigger=' then a group of variables.
Is this a trigger I write if so how? How do I change the plugin to read it, then use it?

For instance, I use a prompt format of:~

HP%H/%h ST%T/%t MV%V/%v\n %A/%n/%E/%e >

%H/h Health %T/t Stun
%V/v Movement \n New line
%A Armed status %n name
%E Encumberance level %e time of day

the parts I'd want to grab are Health Stun and Movement (with an extra option for a mana addition to the prompt bar)

So seeing as the Prompt values vary between PC and PC I'd need a trigger that read my first line of prompt values as wildcards, right?

so something like HP%1/%2 ST%3/%4 MV%5/%6

This would fire every-time my health, stun, movement, and mana if present are sent to Mush-client, correct?

I'm new at this, and this would be the first bit of scripting past single command aliases I've ever done, so getting it from the MUD to the script is getting me stuck.



[Go to top] top

Posted by Fiendish   USA  (1,662 posts)  [Biography] bio   Global Moderator
Date Reply #94 on Thu 19 Jan 2012 09:15 PM (UTC)
Message
Quote:
I don't have a mud output...

Uhhh...yes you do. Copy and paste what the game sends you.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Reply #95 on Sat 10 Mar 2012 11:57 PM (UTC)
Message
what lines would i have to add to show an hunger bar and a thirst bar in the same window?
[Go to top] top

Posted by Fiendish   USA  (1,662 posts)  [Biography] bio   Global Moderator
Date Reply #96 on Sun 11 Mar 2012 03:03 AM (UTC)
Message
Quote:

what lines would i have to add to show an hunger bar and a thirst bar in the same window?


It's not clear that you can do that with this particular plugin idea, since Aardwolf does not send hunger or thirst through the prompt. You'd have to read those values another way.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Reply #97 on Sun 11 Mar 2012 04:22 AM (UTC)
Message
ah, i see. that would mean an updating plugin using some invisible 'hunger' syntax every tick :P fun to look into.
would make a nice first assignment.
[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.


99,864 views.

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

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 FutureQuest]