|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Sun Oct 28, 2007 5:33 pm
[2.09] Lua not capturing regex matches? |
Regex trigger pattern: Test \d+
First test as zscript action: #SAY %param(1)
Second text as lua action: print(zs.param(1))
First one works, second doesn't - always prints 0 instead of the actual number
If you change from a regex trigger pattern to a normal one: 'Test (%d)'
then both zscript and lua work fine
Bug or am I doing something silly? |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Sun Oct 28, 2007 5:45 pm |
Weird, it suddenly worked after I remade the trigger. Seeing something else odd though now which makes me think something's weird.
The real trigger was this
Regex Pattern: ^\w+ Messages:\s+(\d+)/(\d+).$
Lua Action: print(zs.param(1))
But it's not behaving consistently... it should simply print the first number, but sometimes it's printing 1 instead.
Btw, the text that's triggering on, in debug mode is
Code: |
<27>[31m-------<27>[0mThe Tome Of Communication<27>[31m-------<27>[0m
General Messages: 6680/6680.
News Messages:<9>528/528.
City Messages:<9>717/717.
Order Messages:<9>27/27.
Guild Messages:<9>59/59. |
So some of the whitespace are tabs |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Oct 29, 2007 10:29 pm |
Tabs get expanded into spaces within the CMUD screen routines, so the trigger should always see spaces and never a tab character. So I don't think that is is. But I'm having a tough time reproducing this, so I don't know what's wrong. Since CMUD triggers get converted into regular expressions, I don't know how they could work differently from Lua.
Can anyone else shed any additional light on this one? |
|
|
|
|
|