Prompt trigger doesn't fire "alone" (noob)

Post Reply
XCan
Posts: 1
Joined: Sun Aug 16, 2009 4:24 pm

Prompt trigger doesn't fire "alone" (noob)

Post by XCan »

I just downloaded Mudlet and started to check it out. So far it seems the project has lots of potential.

Anyway, to my question, I probably missed something trivial. The first thing I did was of course to try out the scripting engine, what better way to test it out than attempting to grab my prompt which looks like this

Code: Select all

555 hps| 222 sp| 100 mp >
Thus I set out and wrote a pattern as follows

Code: Select all

^(\d+) hps| (\d+) sp| (\d+) mp>
The above trigger fires and grabs the right numbers with matches[]. However, it only fires if the prompt is not shown alone. It's kind of hard to explain, if I just type <enter> in the mud, the prompt shows up, but the trigger does not fire. It only fires if the prompt shows up due to some other messages, for example, mud messages, i.e., the following output from the mud fires the trigger:

Code: Select all

555 hps| 222 sp| 100 mp > Autosave.
whereas

Code: Select all

555 hps| 222 sp| 100 mp >
does not.

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Prompt trigger doesn't fire "alone" (noob)

Post by Heiko »

^(\d+) hps\| (\d+) sp\| (\d+) mp>

The character "|" is a special regex symbol and needs to be escaped in regex patterns unless you want the meaning "or".

Mudlet has now reached a state where you can expect the main mudding related functionality to work perfectly. Some GUI elements - especially the button section - still need to be improved, but most of Mudlet is pretty close to a stable version.

Post Reply