Capturing Information

by Arak

Back to Mechanic's Corner.

Arak2007-11-01 18:42:33
Basically, this is a problem that has come up in several places for me, most recently with the new score. The problem is that when I try to trigger the level percentage for use in an experience bar of some sort, I just can't do it! The problem is that the actual percent is 1. surrounded by parentheses, which can't be used in the trigger because they have a role in trigger functioning that I'm not entirely clear on, and 2. the number is followed by a percent and has a decimal point in the middle of it, so I can't use a more general wild-card to capture it, but I also can't use a numerical one because it won't get the second part of the number. I'm on Z-Mud by the way. So, can anyone enlighten me as to how this would be done?
Xinael2007-11-01 18:49:02
() are special characters in trigger patterns - they create captures. Anything between () is saved into one of the %1-%99 variables. To tell zMUD that you're looking for the literal characters (), put ~ before them, like so:

~(something~)

Now, to get your decimal point number working, you have a couple of options. You can either do "(%d.%d)~%", which will do a number, followed by a dot, followed by a number, followed by a percent sign (remember that % is a special character too), capturing the number, or you can do "()~%", which will do any amount of numbers and dots, followed by a percent sign. You might also try using the %n wildcard, like "(%n)~%", but I haven't tried that.
Arak2007-11-01 19:16:50
Ok, thanks, it's working now.
Yrael2007-11-02 05:43:52
On that note, could anyone halp? I miss my clan and city tells half the time, would like to dump them into a seperate window?

female.gif

I love that smily.
Xinael2007-11-02 07:42:57
Turn off the server-side word wrap and then it's as simple as:

#trig {^~(%w~): %w says, ~"*.~"$} {#cap windowname}

Wwith server-side word wrap on, this problem's an utter arse requiring multistate triggers.
Unknown2007-11-02 11:09:36
Don't just use %w, though, or you'll miss tells from people off-plane, from mobs (some people don't want these, anyway), or from multi-word channel names.