Health Bars...again..

Posted by Dekotis on Tue 24 Jul 2007 04:00 AM — 13 posts, 43,093 views.

#0
Ok, I read all the forums on the health bars and I have tried everything I could imagine and nothing worked.
This is the 4th line of the plugin:
"^\<HP\:[*/*] Jakai\:[*/*] Stam\:[*/*] TNL\:[*] Yen\:[*]\>(.*?)$" >

and this is what My prompt looks like:
HP:[4,081/4,081] Jakai:[4,305/8,269] Stam:[1,215/1,215] TNL:[1,344,844] Yen:[3,532]

Can any1 help me out plz...
USA #1
The problem is with the commas being in there. If you're using Lua, convert them by doing this, using hp just as an example variable.

hp = string.gsub( hp, ",", "" )
Australia Forum Administrator #2
You need a backslash before the square brackets.
#3
Ok, I put in the backslashes:
<!ENTITY trigger_match
"^\&lt;HP\:\[*\/*\] Jakai\:\[*\/*\] Stam\:\[*\/*\] TNL\:\[*\] Yen\:\[*\]\&gt;(.*?)$" >

and it still doesnt work...and as far as the commas, That is put in automaticly by the mud. So, if I need to put that into the code, where does it go?

Thx for the help though.
USA #4
  <!ENTITY trigger_match 
   "^HP:[([\d\,]+)\/([\d\,]+)] Jakai:[([\d\,]+)\/([\d\,]+)] Stam:[([\d\,]+)\/([\d\,]+)\(.*?)$" >

That should capture the prompt correctly. This next part may not work, since I'm quite unfamiliar with vbscript, but it should at least give a starting point. Find the part with the three DoGauge lines in a row, and replace it with this:
  DoGauge "  HP: ", Replace(wildcards (1), ",", "" ), Replace(wildcards (2), ",", "" ), "darkgreen", "maroon"
  DoGauge "  Jakai: ", Replace(wildcards (3), ",", "" ), Replace(wildcards (4), ",", "" ), "mediumblue", "mediumblue"
  DoGauge "  Stam: ", Replace(wildcards (5), ",", "" ), Replace(wildcards (6), ",", "" ), "gold", "gold"
#5
didn't work...I copied both of them into place...still nothing...sorry for all the hastle though...
USA #6
Are there any error messages? Is the info bar popping up at all? Is it partially working? Did you test to see if the trigger was being called at any point?

Giving some more information than "It didn't work" might help a bit more to track down where the problem is.
#7
It doesn't give me any error messages at all. The info bar is there, but its just a grey bar. It says nothing besides that...

I added the plugin to the global preferences and got no error messages, removed it from there, added it to the individual world and still nothing. So either way it's like its not even there.

ok, did something more simple.

HP:4,707/5,541 Jakai:2,120/11,223 Stam:1,795/1,795

changed:
<!ENTITY trigger_match
"^HP:(\d\,+)\/(\d\,+) Jakai:(\d\,+)\/(\d\,+) Stam:(\d\,+)\/(\d\,+)\(.*?)$" >

still got nothing..
Amended on Wed 25 Jul 2007 02:22 AM by Dekotis
USA #8
Try a more simple prompt for now.
Australia Forum Administrator #9
You need to read up a bit on how regular expressions work.

For one thing, trying that in a trigger gave an error (unmatched parentheses) because of this part at the end:


\(.*?)


I took out the backslash, but it still didn't match. This is because you had this:


(\d\,+)


What that matches is a single digit (\d) followed by one or more commas (\,+). So that would match something like "1,,,,,,".

You need to make a "set" like this:


([\d\,]+)


That matches the set of digits and commas, one or more times.

In fact, you don't need a backslash in front of the comma. This matched for me on your test data:


<!ENTITY trigger_match
"^HP:([\d,]+)\/([\d,]+) Jakai:([\d,]+)\/([\d,]+) Stam:([\d,]+)\/([\d,]+)(.*?)$" >
Amended on Wed 25 Jul 2007 06:25 AM by Nick Gammon
Australia Forum Administrator #10
With that as the trigger match, and the change suggested by Shaun, namely:


  DoGauge "  HP: ", Replace(wildcards (1), ",", "" ), Replace(wildcards (2), ",", "" ), "darkgreen", "maroon"
  DoGauge "  Jakai: ", Replace(wildcards (3), ",", "" ), Replace(wildcards (4), ",", "" ), "mediumblue", "mediumblue"
  DoGauge "  Stam: ", Replace(wildcards (5), ",", "" ), Replace(wildcards (6), ",", "" ), "gold", "gold"


For me, the health bars came out looking OK.
Australia Forum Administrator #11
You should be able to add the plugin to the individual world, and then use Ctrl+Shift+F12 to push through a prompt (like in your example), to test it. Make sure you put newlines around the test prompt by hitting Ctrl+Enter.
#12
Yes, My apologies, I haven't done programming in 3 years, and I guess I haven't got myself back in that frame of mind.
I do want to say Thanks for all the help Nick and Shaun, I sincerly do appriciate it. I got working now, btw. :D