| View previous topic :: View next topic |
| Author |
Message |
reality3k
Joined: 11 Feb 2009 Posts: 46
|
Posted: Thu Jun 28, 2012 10:48 am Post subject: Can't escape curly braces |
|
|
#var {test} {\{}
#Unmatched braces error! |
|
| Back to top |
|
 |
reality3k
Joined: 11 Feb 2009 Posts: 46
|
Posted: Thu Jun 28, 2012 11:04 am Post subject: |
|
|
I'm getting similar and more annoying issues with #regexp. Matching things like \{%d\}.
Any chance we could just throw away the lazy match stuff and replace it entirely with PCRE? The way it is now seems sort of a duct tape solution. |
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Thu Jun 28, 2012 1:23 pm Post subject: |
|
|
From #help escape:
\x7B will send the '{' character.
\x7D will send the '}' character.
If I throw out the pre-parser you get a whole new set of annoyances. |
|
| Back to top |
|
 |
reality3k
Joined: 11 Feb 2009 Posts: 46
|
Posted: Thu Jun 28, 2012 1:42 pm Post subject: |
|
|
I'd tried the hex sequences earlier with no luck. It works for #var, but #regexp is still not taking it:
| Code: | #var {test} {\x7B5\x7D}
#regexp $test {\x7B%d\x7D} {#showme {caught}} {#showme {not caught}}
not caught |
To explain the context, I'm trying to catch "Aegis Assembler Model 68-AS attacking you! {5}." and pull out the number in the braces. In the action body, I'm using #regexp to pull the number from %0, basically. |
|
| Back to top |
|
 |
Scandum Site Admin
Joined: 03 Dec 2004 Posts: 3274
|
Posted: Fri Jun 29, 2012 3:49 pm Post subject: |
|
|
The following should work:
#act {%1 attacking you! \{%2\}.}
Might have to use: #line substitute escapes #var {test} {\x7B5\x7D} |
|
| Back to top |
|
 |
reality3k
Joined: 11 Feb 2009 Posts: 46
|
Posted: Sun Jul 01, 2012 5:46 pm Post subject: |
|
|
Yeah, that works in #action. #regexp seems to ignore it. Try that exact same pattern in #regexp and it refuses to match for me.
The reason for using #regexp is that the \{%d\} part from the mud output only occurs if there are multiples of a mob. I imagine making two triggers might work although it's inelegant, and besides I love #regexp. |
|
| Back to top |
|
 |
balthus
Joined: 07 Jul 2009 Posts: 16
|
Posted: Sun Jan 20, 2013 6:36 pm Post subject: |
|
|
Try this:
| Code: | | #ACTION {*(?: \{(\d+)\}|)$} |
One action matches:
and
|
|
| Back to top |
|
 |
|