Re: More scripting

May 24, 2015 11:12AM
I don't remember exactly the syntax since I haven't been mudding in a while. I think you're using a different kind of regex (I use PCRE) but what I'd do is:

pattern: ^dm( *)(\w*)$
First capturing group finds the space after dm. * quantifier allows 0 spaces to unlimited spaces.
Second capturing group finds the name after the space. * quantifier allows 0 letters to unlimited letters.

So when you do 'dm' it correctly matches the pattern, with both capturing groups getting empty strings.

If you do 'dm shapa' for example it will have 'shapa' in the second capturing group. So just send c dispel magic on the correct match for 'shapa'.

If you do 'dm' then your code should have an IF to catch the case of empty strings in the two captured groups. IF first capturing group == '' for example, or IF length(first capturing group) == 0, or something like that. Then it should send c dispel magic.
Subject Author Posted

Basic Mudlet/Lua alias setup questions

Unnamed_ May 22, 2015 11:48AM

Re:Regular Expressions

starbright May 23, 2015 01:49AM

More scripting

starbright May 23, 2015 08:23AM

Re: More scripting

Unnamed_ May 24, 2015 07:07AM

Re: More scripting

starbright May 24, 2015 11:12AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 111
Record Number of Users: 5 November 04, 2022
Record Number of Guests: 358 August 31, 2022