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
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Fri Jan 17, 2003 9:52 pm   

Proper use of %s?
 
I know this looks really ugly, but I thought it would work if I put the %s in there...anyway, here is what mud output looks like.

 

[ 0] Venom Vheod 0/ 5853 1777729 4
[ 1] Best vheod 0/ 0 504871 4
[ 2] Points Althor 0/ 92431 61876 22
[ 3] Mord'Sith Trak 740/ 125570 84968 23
[ 4] Omega Polander -120/ 6792 51478 9
[ 5] Darkmoon Kalbjorn 50/ 25890 65509 23
[ 6] Warbunnies Niritti 0/ 100 20393 4
[ 7] Exodus Lionar 0/ 31671 54491 17
[ 8] Angels Rodin 50/ 2145 38160 19
[ 9] Oracle Graco 400/ 133235 52158 24
[10] Bakura Lanfear 0/ 17582 17862 20
[11] Phoenix Kinslayer 0/ 24008 40004 21
[12] Riva Rykaj 190/ 9566 24991 24
[13] Han'yake Mystique 0/ 22989 23765 24
[14] Solo Wicket 0/ 6005 2194 11
[15] Raven Itoli 1845/ 57243 34291 21
[16] Legacy Jingading 1120/ 86765 17228 25
[17] Spunk Evilyn 0/ 10350 160 9
[18] Genesis Gabriel 0/ 8141 1808 24


To capture those lines, I have this so far.
~[%s&{clanlistnum}~]&{clanname}%s&{clanleader}%s&{cpthisweek}~/%s&{cptotal}%s&{clanrating}%s&{clanmembers}%s

Then, for output.....

#ECHO @clanname has earned @cpthisweek points this week, which will be added to their total points of @cptotal. @clanname's rating is @clanrating, thanks to their membership of @clanmembers.

Here is what I get...

 

Venom Vheod has earned 0 points this week, which will be added to their total points of 5853 1777729 . Venom Vheod 's rating is , thanks to their membership of .

Any clue how to fix it, or a patter which will work better?

Any help would be appreciated...


Evangelist/Pernius
telnet://phidar.com:9000
Reply with quote
Churlant
Novice


Joined: 17 Oct 2002
Posts: 44
Location: USA

PostPosted: Fri Jan 17, 2003 10:09 pm   
 
I'm not entirely sure about a better structure, but I do know that in my experiences if you have a %s and no spaces at all, it doesn't match... so your first section which reads: ~[%s&{clanlistnum}~] may have an error when the number isn't a single digit (ie it has no space between brackets and numbers). The opposite goes for the space following the brackets and before the clan name.. you have no %s there and it may need one...

>-Churlant-<
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sat Jan 18, 2003 12:00 am   
 
The &{varname} pattern defaults to match *. You change this behavior by specifying another pattern in the form &%w{varname}. By adding the appropiate patterns the %s's will match all the whitespace as oppoesed to a single space.

To address the point Churlant raised, remove the %s there then within the script for the trigger add "clanlistnum=%trim(@clanlistnum)". Alternately if you do not use that information don't capture it to a variable; use the fixed width pattern to improve speed.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jan 18, 2003 3:12 am   
 
If you start your pattern with the number, you don't have to concern yourself with whether there are spaces before it.
Suggested pattern:
&%d{clanlistnum}~]&%x{clanname}%s&%w{clanleader}%s&%n{cpthisweek}~/%s&%d{cptotal}%s&%d{clanrating}%s&%d{clanmembers}

LightBulb
Senior Member
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Sat Jan 18, 2003 3:56 am   
 
I ended up using this pattern.

~[%s&%d{clannum}~]%s&%w{clanname}%s&%w{clanleader}%s&%d{cpthisweek}~/%s&%d{cptotal}%s&%d{clanrating}%s&%d{members}

and

~[&%d{clannum}~]%s&%w{clanname}%s&%w{clanleader}%s&%d{cpthisweek}~/%s&%d{cptotal}%s&%d{clanrating}%s&%d{members}
for the numbers greater then 9.

Now, I am running into two things. It will not capture clans with -numbers, and it will not capture Mord'Sith (I am pretty sure that is because of the ')

Any solutions on the - numbers thing? I can make a single trigger for mord'sith, no problem there.

Thanks for all the help!

Evangelist/Pernius
telnet://phidar.com:9000
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Sat Jan 18, 2003 3:59 am   
 
UPDATE

It's obviously the apostraphe(') in both mord'sith and han'yake. Anyone know ways to get past the apostraphe?

Evangelist/Pernius
telnet://phidar.com:9000
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Sat Jan 18, 2003 4:03 am   
 
Changed from %w to %x per lightbulbs suggestion, now the mord'sith are working okay, but neither of the clans with -cps are :( Leads me to believe the %d isn't taking the - numbers, any suggestions?

Evangelist/Pernius
telnet://phidar.com:9000
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jan 18, 2003 4:13 am   
 
Use %n for numbers that may go negative.

LightBulb
Senior Member
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Sat Jan 18, 2003 4:18 am   
 
hehe, had just tried that before i checked back in. thanks bunches lightbulb!

Evangelist/Pernius
telnet://phidar.com:9000
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