|
BlackSmith Apprentice
Joined: 08 Dec 2002 Posts: 152
|
Posted: Fri Jun 02, 2006 2:56 pm
#AddItem & clearing alias bugs? |
I resently found a nice "bug".
I get this kind of feed from mud
Code: |
,--------------------------------------------------------------------.
| Guild name | Command | Level | Max |
|====================================================================|
| The Conjurers | conjurer | 18 | 25 |
| Denizens of the Underdark | denizens | 5 | 5 |
| Fight Club | fc+ | 0 | 8 |
| Magical background | magical | 10 | 10 |
| Metal Warriors of the World | metal+ | 0 | 1 |
| The Association of Mystical Navigators | navigator | 5 | 5 |
| Default long name | nightlife+ | 0 | 1 |
| The Psionicists | psionicist | 35 | 35 |
| Default long name | turku+ | 0 | 1 |
`--------------------------------------------------------------------' |
Now, i have a nice trigger that executes
Code: |
#Variable guilds "" |
when it finds
Code: |
^| Guild name %s | %s Command | Level | Max | |
from input.
So now i (should) have empty variable called guilds where my trigger
Code: |
^\| (.*)\s+\|\s+([\+a-z]+) \|\s+(\d+) \|\s+(\d+) \|
#AddItem Guilds %2 |
should store all the guild names that i have.
But, alas, i get a empty text variable for time to time.
Ideas where this might come? |
|
_________________ BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient. |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Fri Jun 02, 2006 4:32 pm |
Does it sometimes work correctly?
My guess is that the second trigger is sometimes not firing for some reason. Could be that the format sent by the MUD is slightly different sometimes. Like some extra or missing spaces, for example. |
|
_________________ Kjata |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Fri Jun 02, 2006 6:56 pm |
#IF (!%null(%2)) {#AddItem Guilds %2}
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Jun 02, 2006 10:24 pm |
According to all the information you posted %2 would correlate to the "Command" column and not the "Guild name" column. Also you should get in the practice of using proper delimeters. In this case braces are correct:
#AddItem Guilds {%1}
CMud will do much to eliminate the stricter need for delimeters in certain situations, but it is still a good habit to have.
I can't see any reason for the Regex to fail to match, although there have been some reported, and as yet unresolved possible bugs with white space matching. You might try using a fixed width pattern and then %trim your captured data. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
BlackSmith Apprentice
Joined: 08 Dec 2002 Posts: 152
|
Posted: Mon Jun 05, 2006 1:07 pm |
Kjata wrote: |
Does it sometimes work correctly? |
Maybe once for every ten times on average.
Kjata wrote: |
My guess is that the second trigger is sometimes not firing for some reason. Could be that the format sent by the MUD is slightly different sometimes. Like some extra or missing spaces, for example. |
I actually found the bugging part.
The clearing triggers pattern should have been
^\| Guild name \s+ \| \s+ Command \| Level \| Max \|
I tested it with Echo's and suddenly the clearing trigger started to loop on itself so i suspected incorrect prel.
And so it was.
thanks for all the help
shalimar wrote: |
#IF (!%null(%2)) {#AddItem Guilds %2} |
#ADDITEM wrote: |
Duplicated values are not added using this command. |
Vijilante wrote: |
According to all the information you posted %2 would correlate to the "Command" column and not the "Guild name" column. Also you should get in the practice of using proper delimeters. In this case braces are correct:
#AddItem Guilds {%1} |
No.
I want the command stored so i can use it later. |
|
_________________ BatMUD Best MMORPG around since 1990 telnet://bat.org:23
~ Magic & Mind beats Chrome & Meat anytime ~
Pattern(s) in PERL. Using Cmud 1.34/2.09 & BatClient. |
|
|
|
|
|