|
Duindain Novice
Joined: 14 Feb 2003 Posts: 31 Location: Perth, Australia
|
Posted: Fri Jan 09, 2004 4:47 pm
help capturing a line from mud |
hey i know this is a trivial request but im having alot of trouble with it i need to capture the names and mana condition of everyone in my group
this is the mud output
Hit Points Mana Movement Align Exp needed Level
[ 8223/8223 ][ 6464/6464 ][ 1877/1877 ] [ 999] [ 86346314] [177 Wa] Duindain
[ 9048/9048 ][ 6690/6690 ][ 1894/1894 ] [ 468] [ 26171797] [176 Wa] Buxom
[ 7072/7072 ][ 5597/5597 ][ 1888/1888 ] [ 999] [ 2491316] [163 Wa] Luew
is all on seperate lines normally now this is what ive got to capture it
~[ (%d)/(%d) ~]~[ (%d)/(%d) ~]~[ (%d)/(%d) ~] ~[ (%d)~] ~[ (%d)~] ~[(%d) (%w)~] (%w)
now this only works on some chars i belive because of the white space some chars have less xp some have more some alignments are at 1000 some 999 which breaks it and so on ive tried puting white space bits in and it just doesnt work at all can anyone give me a good thing to get every character plz heh |
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Fri Jan 09, 2004 5:36 pm |
You need the %s wildcard, to take up any number of whitespaces. However, I do recall hearing that if there are no whitespaces, %s screws up. So here is an alternative:
~[ (%d)/(%d) ~]~[ (%d)/(%d) ~]~[ (%d)/(%d) ~] ~[(*)~] ~[(*)~] ~[(%d) (%w)~] (%w)
Then to get the numerical amount of xp needed: %number(%8) and numerical amount of alignment: %number(%7) |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Jan 09, 2004 7:01 pm |
First, if all you need are the hitpoints and mana then that's where your pattern should stop. If you also need the name, you can still use a * for everything between the mana and the final word.
Second, as Danlo said, %s matches any amount of whitespace (spaces or tabs). It does require that there be at least ONE whitespace character for a match, and therefore will NOT match zero whitespace (this is not a "screw up", it's intentional). As long as nobody reaches 10000 hit points or 10000 mana, either of the following patterns should work, depending on whether you need the name or not:
^~[%s(%d)/(%d)%s~]~[%s(%d)/(%d)%s~]
^~[%s(%d)/(%d)%s~]~[%s(%d)/(%d)%s~]* (%w)
Third, the little-used wildcard %p matches any punctuation which happens to include both square brackets and spaces, but doesn't include alpha or numeric characters. This provides the best choice because you will always have the brackets even if the numbers get large enough to swallow the spaces.
%p(%d)/(%d)%p(%d)/(%d)%p(%d)/(%d)%p(%d)%p(%d)%p(%d) (%w)~] (%w) |
|
|
|
|
|
|
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
|
|