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
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: 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... ;)
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: 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... ;)
Reply with quote
Zugg
MASTER


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

PostPosted: 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?
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