Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Mr. Kristopher
Newbie


Joined: 14 Aug 2003
Posts: 5
Location: USA

PostPosted: Fri Jan 27, 2006 2:49 pm   

Trigger problem with brackets and spaces
 
I'm trying to extract the numbers from the following prompt:

Hp: 1662(1662) Gp: 253(253) Xp: 56048

I don't, however, want to extract anything when the prompt looks like this (my combat monitor):

Hp: 1435 (1662) Gp: 230 (253) Xp: 46013

First number is current hp, second is max hp, third is current gp, forth is max gp, and fifth is total xp.

The problems I'm running into are ( and ) characters because they're right next to the numbers, and also the two spaces in between the max hp and "gp:" (also appearing between max gp and "xp:")

What I have tried so far is something that looks like:
Hp: %d(%d)*Gp: %d(%d)* Xp: %d

It does trigger, but the info stored into %1 is only the last digit of the current hp. (I didn't check the remaining variables because the first one was wrong and I didn't see the point.)

I also tried this but it doesn't trigger at all:
Hp: %d~(%d~)*Gp: %d~(%d~)* Xp: %d

Any idea what I'm doing wrong?
Reply with quote
Pseudo
Wanderer


Joined: 25 Oct 2005
Posts: 99

PostPosted: Fri Jan 27, 2006 4:11 pm   
 
Here's my suggestion:
Code:
#REGEX {Hp:\s(\d*)\((\d*)\)\sGp:\s(\d*)\((\d*)\)\sXp:\s(\d*)} {#SHOW HP=%1/%2 GP=%3/%4 XP=%5} "" {nocr|prompt}


or

Code:
#ACTION {Hp: (%d)~((%d)~) Gp: (%d)~((%d)~) Xp: (%d)} {#SHOW HP=%1/%2 GP=%3/%4 XP=%5} "" {nocr|prompt}
Reply with quote
Mr. Kristopher
Newbie


Joined: 14 Aug 2003
Posts: 5
Location: USA

PostPosted: Sat Jan 28, 2006 2:00 pm   
 
Thank you, it worked perfectly! I think my problem was that I didn't include the extra brackets needed for the variables (whoops!).
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net