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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4787
Location: Pensacola, FL, USA

PostPosted: Fri Nov 23, 2007 4:20 am   

[2.13 Pro] Variable not matching
 
#VAR currentBox {simple copper box}

#TR {After careful inspection, you fail to see any traps on your @currentBox.}

Then use this in the test pattern tab of the trigger:

After careful inspection, you fail to see any traps on your simple copper box.

Even if i enclose the variable in {} it still fails.
_________________
Discord server
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Fri Nov 23, 2007 6:57 am   
 
This works for me. I tested with a #SHOW line in a blank session.
_________________
Asati di tempari!
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4787
Location: Pensacola, FL, USA

PostPosted: Fri Nov 23, 2007 9:35 pm   
 
Odd, cause i get this message on the compiled tab of the trigger:

Error compiling script:
illegal property: $


Aha, now i see why, using the $ to force matching the end of line makes this trigger fail, without it, it works.
_________________
Discord server
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Nov 26, 2007 4:55 pm   
 
Please show us the *exact* pattern that is failing. Your example above didn't have any $ character in it. Or, go to the XML tab and paste the XML code here (using a [code] tag)
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4787
Location: Pensacola, FL, USA

PostPosted: Mon Nov 26, 2007 7:51 pm   
 
it was


#TR {After careful inspection, you fail to see any traps on your @currentBox.$}

i had just somehow missed putting the $ in
_________________
Discord server
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Nov 26, 2007 9:56 pm   
 
I've seen similar problems with my score triggers, where I use @char to represent a person's name (since %char didn't seem to work in CMUD trigger patterns). I have three score triggers, all for different versions of the score display; one worked fine, one didn't match any lines, and one matched the first 10 states out of 12 and then gave up (weird). I replaced the @char with my actual character name and the triggers suddenly began working as I intended.

Code:

#VAR char %char
#REGEX {^.*?@char.*?} {} "" {line=6}
#COND {^  Sex\s+\: (?:Male|Female)\s+Race\s+\: .+$} {} {regex|within|param=1}
#COND {^  Level\s+\: (\d+) \((\d+)\%\)\s+Rank\s+\: (.+?)$} {
level = %1
tonextlevel = %2
levelname = %3
} {regex|within|param=1}
#COND {^  Health\s+\: (\d+)\/(\d+)\s+Endurance\s+\: (\d+)\/(\d+)$} {
health = %1
max_health = %2
endurance = %3
max_endurance = %4
} {regex|within|param=1}
#COND {^  Mana\s+\: (\d+)\/(\d+)\s+Willpower\s+\: (\d+)\/(\d+)$} {
mana = %1
max_mana = %2
willpower = %3
max_willpower = %4
} {regex|within|param=1}
#COND {^  Ego\s+\: (\d+)\/(\d+)\s+Reserves\s+\: (\d+)\%$} {
ego = %1
max_ego = %2
reserves = %3
} {regex|within|param=1}
#COND {^  Karma\s+\: (\d+)\%\s+Esteem\s+\: (\d+)\%$} {
karma = %1
esteem = %2
sip_health = (@max_health*17/100)
sip_mana = (@max_mana*17/100)
sip_ego = (@max_ego*17/100)
medbag_health = (@sip_health*3/2)
sparkle_health = (@max_health/10)
sparkle_mana = (@max_mana/10)
sparkle_ego = (@max_ego/10)
scroll_health = (@max_health/5)
scroll_mana = (@max_mana/5)
scroll_ego = (@max_ego/5)
} {regex|within|param=1}
#COND {^You are ranked (\d+)\a\a in Lusternia\.$} {
rank = %1
} {regex|within|param=1}
#REGEX {^\| .*?@char.*? \-+\|$} {}
#COND {^\|\-{66} VITALS\|$} {} {regex}
#COND {^\| Health \: (\d+)\/(\d+)\s+Endurance \: (\d+)\/(\d+)\s+Power    \: \d+p\s+\|$} {
health = %1
max_health = %2
endurance = %3
max_endurance = %4
} {regex|within|param=1}
#COND {^\| Mana   \: (\d+)\/(\d+)\s+Willpower \: (\d+)\/(\d+)\s+Reserves \: (\d+)\%\s+\|$} {
mana = %1
max_mana = %2
willpower = %3
max_willpower = %4
reserves = %5
} {regex|within|param=1}
#COND {^\| Ego    \: (\d+)\/(\d+)\s+Mindset   \: \w+\s+Esteem   \: (\d+)\%\s+\|$} {
ego = %1
max_ego = %2
esteem = %3
} {regex|within|param=1}
#COND {^\|\-{67} KARMA\|$} {} {regex|within|param=1}
#COND {^\| Karma  \: (\d+)\%\s+\|$} {
karma = %1
} {regex|within|param=1}
#COND {^\|\-{67} STATS\|$} {} {regex}
#COND {^\| Strength     \:\s+(\d+)\s+Dexterity \:\s+(\d+)\s+Constitution \:\s+(\d+)\s+\|$} {
str = %1
dex = %2
con = %3
} {regex|within|param=1}
#COND {^\| Intelligence \:\s+(\d+)\s+Size      \:\s+(\d+)\s+Charisma     \:\s+(\d+)\s+\|$} {
int = %1
size = %2
cha = %3
} {regex|within|param=1}
#COND {^\|\-{64} RANKINGS\|$} {} {regex}
#COND {^\| Experience \: \#(\d+).+?Level \: (\d+) \(\s*(\d+\.\d+)\%\)\s+\|$} {
rank = %1
level = %2
tonextlevel = %3
sip_health = (@max_health*17/100)
sip_mana = (@max_mana*17/100)
sip_ego = (@max_ego*17/100)
medbag_health = (@sip_health*3/2)
sparkle_health = (@max_health/10)
sparkle_mana = (@max_mana/10)
sparkle_ego = (@max_ego/10)
scroll_health = (@max_health/5)
scroll_mana = (@max_mana/5)
scroll_ego = (@max_ego/5)
} {regex|within|param=1}
#REGEX {^\| .*?@char.*? \-+ \#(\d+) \|$} {rank = %1}
#COND {^\| Level  \:\s+(\d+) \(\s*(\d+\.\d+)\%\)\s+Power\:\s+\d+p \(\s*(\d+)\%\)\s+Karma\:\s+(\d+)\%\s+Esteem\:\s+(\d+)\%\s+\|$} {
level = %1
tonextlevel = %2
reserves = %3
karma = %4
esteem = %5
} {regex|within|param=1}
#COND {^\| Health \:\s+(\d+)\/(\d+)\s+Mana \:\s+(\d+)\/(\d+)\s+Ego  \:\s+(\d+)\/(\d+).+?\|$} {
health = %1
max_health = %2
mana = %3
max_mana = %4
ego = %5
max_ego = %6
sip_health = (@max_health*17/100)
sip_mana = (@max_mana*17/100)
sip_ego = (@max_ego*17/100)
medbag_health = (@sip_health*3/2)
sparkle_health = (@max_health/10)
sparkle_mana = (@max_mana/10)
sparkle_ego = (@max_ego/10)
scroll_health = (@max_health/5)
scroll_mana = (@max_mana/5)
scroll_ego = (@max_ego/5)
} {regex|within|param=1}
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Nov 27, 2007 1:42 am   
 
One thing to check is to always make sure there isn't a space after the $ in the pattern field. This seems to happen easily, and since the space can't be seen, it's hard to spot unless you put the cursor at the end of the pattern. If there is a space after it, then the $ becomes the newline character for a multiline trigger, instead of matching the end of the line.

I'm actually considering trimming any spaces from the end of the pattern and forcing people to use %s for trailing spaces to prevent this kind of problem.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4787
Location: Pensacola, FL, USA

PostPosted: Tue Nov 27, 2007 2:09 am   
 
Can you not have it default to using a %q instead?

The reason the $ was on there in the is from my hitting that little spot right in front of the line that will highlight the whole line in the scrollback buffer.

That technique inserts the $ automatically.

Back on topic, I just double checked to be sure, and there are no trailing spaces being sent by the mud.

And another test shows that technique would grab them anyway and place the $ appropriately.
_________________
Discord server
Reply with quote
hogarius
Adept


Joined: 29 Jan 2003
Posts: 221
Location: islands.genesismuds.org

PostPosted: Tue Nov 27, 2007 2:51 am   
 
Shalimar, I think Zugg meant to check for spaces at the end of your pattern in the trigger, after the $ sign, not in the text you receive from the MUD.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4787
Location: Pensacola, FL, USA

PostPosted: Tue Nov 27, 2007 3:59 am   
 
I did that too, no trailing spaces.
_________________
Discord server
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Nov 27, 2007 6:02 am   
 
I figured out what happened and it's really simple. The '.' is causing a parsing bug. If you quote it using
Code:
#TR {After careful inspection, you fail to see any traps on your @currentBox~.$}
then it works fine.

[Edit] After thinking about it, I don't think I will consider this a parsing bug. The '.' after the variable name is special character that tells CMUD to look the second part of a record variable reference, but since the '.' in this case is meant to be a literal, it should be quoted.
_________________
Asati di tempari!
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Tue Nov 27, 2007 12:21 pm   
 
Oooo. Good find, Tech! Thanks!
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Nov 27, 2007 9:03 pm   
 
Thanks for finding this Tech! That helps me a lot! You are exactly right. It is still a bug because there isn't a valid key reference after it, so I should be able to fix that.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Nov 27, 2007 11:40 pm   
 
BTW, it's actually pretty easy to see this problem if you go into the settings editor, select the trigger, and click the Compiled Pattern tab. It will show the error: "illegal property: $". If a trigger pattern doesn't compile, then it might have problems working.

Just a reminder that those "Compiled..." tabs can be useful in helping to track down bugs and to report problems. This would have also shown up in the compatibility report. So be sure to use those tools when you are having trouble with scripts.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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