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

Gammon Software Solutions 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?
(New message)
Subject: Improved health bar plugin - can be dragged around
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1  2  3  4  5 6  7  

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Sun 11 Mar 2012 04:22 AM (UTC)  quote  ]
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

Posted by Fiendish   USA  (849 posts)  [Biography] bio   Global Moderator
Date Sun 11 Mar 2012 03:03 AM (UTC)  quote  ]
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.

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Jsportive-Thalanvor   Netherlands  (71 posts)  [Biography] bio
Date Sat 10 Mar 2012 11:57 PM (UTC)  quote  ]
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  (849 posts)  [Biography] bio   Global Moderator
Date Thu 19 Jan 2012 09:15 PM (UTC)  quote  ]
Message
Quote:
I don't have a mud output...

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

http://aardwolfclientpackage.googlecode.com/
[Go to top] top

Posted by Hianastu   (2 posts)  [Biography] bio
Date Thu 19 Jan 2012 07:54 PM (UTC)  quote  ]
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 Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Thu 19 Jan 2012 07:10 PM (UTC)  quote  ]
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 Thu 19 Jan 2012 01:27 AM (UTC)  quote  ]
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 Aralia Faal   (25 posts)  [Biography] bio
Date Fri 23 Sep 2011 06:22 PM (UTC)  quote  ]
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 Aralia Faal   (25 posts)  [Biography] bio
Date Fri 23 Sep 2011 06:18 PM (UTC)  quote  ]

Amended on Fri 23 Sep 2011 11:14 PM (UTC) by Nick Gammon

Message
I've edited the script to need one to type score and the prompt formatting. I load it and it type score and hit enter a few times and get no errors but the miniwindow does not display.



Prompt:
[Fury: 100]
[PL: 84,587,890][KI: 83,331,246][STA: 83,316,014][TNL: 21,025,070][ 7 PM][Zen: 5,263]>

Score:
O==========================={  Health  }==============================O
|CUR Pl: [   84,587,890] CUR KI: [   83,331,246] CUR STA: [   83,316,014]
|MAX Pl: [   84,587,890] MAX KI: [   83,331,246] MAX STA: [   83,316,014]


Script:
To follow
[Go to top] top

Posted by Zylo4   USA  (9 posts)  [Biography] bio
Date Thu 16 Jun 2011 06:40 PM (UTC)  quote  ]
Message
Ah, apologies. I was under the impression that I could pull variables like I usually do (I usually do all of my work inside the world, with only minor projects in plugins).

With GetPluginVariable, it works beautifully. Thank you very much for the help, as well as for the link up to the functions' page. Much appreciated on both counts!
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Thu 16 Jun 2011 07:26 AM (UTC)  quote  ]
Message
Well you didn't exactly mention that you were trying to get a variable inside a plugin that exists outside the plugin. Each plugin, and the main world, have independent script and variable "spaces".

However it can be done.

Template:function=GetPluginVariable GetPluginVariable

The documentation for the GetPluginVariable script function is available online. It is also in the MUSHclient help file.



If you call that with an empty string as the plugin ID then you will get the main world variable. eg.


maxend = GetPluginVariable ("", "MaxEnd")


You don't need to use tostring, GetVariable always returns strings (or nil if the variable doesn't exist).

- Nick Gammon

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

Posted by Zylo4   USA  (9 posts)  [Biography] bio
Date Thu 16 Jun 2011 01:32 AM (UTC)  quote  ]
Message
Yes, I do.

And if I execute
ColourNote("","",tostring(GetVariable("MaxEnd")))
It does respond appropriately. So the variable itself seems to be okay, as long as I'm executing it from the world and not the plugin.
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Thu 16 Jun 2011 01:27 AM (UTC)  quote  ]
Message
If you open world configuration, and near the bottom at the Variables tab, do you see the variable "MaxEnd"?

- Nick Gammon

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

Posted by Zylo4   USA  (9 posts)  [Biography] bio
Date Thu 16 Jun 2011 12:51 AM (UTC)  quote  ]
Message
I've got the code and got it working with a few minor modifications. Works beautifully, save for one thing.

I, too, have a prompt which does not define the maximum values. At present, I have them hard coded in. Due to the way that I've been building up my system, I DO have the values readily available in variables.

But I can't seem to CALL them. Tried several variations of a standard getvariable line, to no avail. Is there a way to call a variable into this script, and if so, how does one do it?

What I've got at present is as follows:
max_endurance = world.GetVariable ("MaxEnd") or 402

It's picking up the 402, so if nothing else I'm pretty certain that I have the line in the right area of the script.

Any assistance you can give me would be much appreciated.
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Thu 02 Jun 2011 07:31 AM (UTC)  quote  ]
Message
I don't have the resources to actually code plugins for individual players, for each one of the 1000 or so MUDs around.

I try to distribute examples and explain how they work. If they work without change, that's great. Hopefully the changes needed to make them work on a different MUD are minor.

And indeed it sounds like you got it to work for your MUD as well. But to make major changes like incorporating members of a group, for a MUD I don't play (and I don't think you mentioned the name of), requires some work by you, the player.

You will learn a lot more, and empower yourself to make even better plugins, by trying to do things yourself. If I do it, you haven't learned anything, and tomorrow you will want me to do something else.

If you aren't sure, try reading the "Programming in Lua" online book:

http://www.lua.org/pil/

Experiment with the Immediate window to see how simple script commands work.

I've done a number of YouTube videos showing how to do things, like scripting, making aliases, triggers and plugins:

http://www.gammon.com.au/forum/?bbtopic_id=120

It validates the time I have taken to produce those, if people look at them, and experiment with the ideas shown there.

- 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.


43,957 views.

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

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]