Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Problems repeating trigger on same line

Problems repeating trigger on same line

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Larkin   (278 posts)  Bio
Date Fri 22 Aug 2008 02:26 PM (UTC)
Message
I wanted to simplify my code for capturing the contents of my rift (Lusternia) from a regex with three groups, two of them optional, to just one group that repeats. The repeat on same line option had no effect at all, however. Can anyone tell me if I'm doing something wrong?

Rift output shows:
Glancing into the Rift, you see:
  [  23] yarrow             [ 588] colewort           [ 144] wormwood
  [ 192] kombu              [ 158] reishi             [ 103] arnica
  [1305] coltsfoot          [ 201] yellowtint         [ 251] pearl
  [ 304] moonstone          [1077] platinum           [1200] gold
  [ 425] greentint          [ 297] marble             [1497] wood
  [ 502] rope               [  90] redtint            [ 279] amethyst
  [ 188] jade               [ 359] bloodstone         [ 298] bluetint
  [ 240] ruby               [ 105] turquoise          [ 351] beryl
  [ 260] emerald            [ 405] onyx               [ 300] gems
  [ 281] opal               [ 244] purpletint         [ 399] cloth
  [ 225] coral              [ 880] steel              [ 288] garnet
  [ 303] sapphire           [  21] goldtint           [ 100] coal
  [ 678] salt               [ 600] sulfur             [ 169] pennyroyal
  [ 682] sparkleberry       [ 152] earwort            [1056] marjoram
  [ 107] rosehips           [  11] sage               [ 180] silver
  [ 129] myrtle             [ 170] horehound          [  39] galingale
  [ 909] calamus            [ 174] kafe               [  29] merbloom
  [ 385] iron               [  26] juniper            [ 416] mistletoe
  [ 219] spices             [ 436] diamond            [ 328] leather
  [ 165] chervil            [ 200] sargassum


Trigger I tried that doesn't work:
<triggers>
  <trigger
   enabled="y"
   match="\s+[\s*(\d+)] (\w+)"
   regexp="y"
   repeat="y"
   send_to="12"
   sequence="10000"
  >
  <send>gear:rift("%2", %1)</send>
  </trigger>
</triggers>

(Also tried it with keep_evaluating="y" and that had no effect.)

Trigger I'm using that does work:
<triggers>
  <trigger
   enabled="y"
   match="^  [\s*(\d+)] (\w+)(?:\s+[\s*(\d+)] (\w+))?(?:\s+[\s*(\d+)] (\w+))?$"
   regexp="y"
   send_to="12"
   sequence="10000"
  >
  <send>gear:rift("%2", %1)
if #"%4" > 0 then
  gear:rift("%4", %3)
  if #"%6" > 0 then
    gear:rift("%6", %5)
  end
end</send>
  </trigger>
</triggers>
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #1 on Fri 22 Aug 2008 02:39 PM (UTC)

Amended on Fri 22 Aug 2008 02:45 PM (UTC) by Worstje

Message
That is because "Repeat on same line" isn't meant for that. "Repeat on same line" only affects the colouring options of the trigger, not the scripting part.

Likewise: your trigger is botched. You should atleast try to escape the [] ones, since now it is treating them as a character class and not as literal characters.

Edit: if you want I can get you the triggers I use for Aetolia later. I think I used three seperate triggers, but I made them years ago when I just started scripting.
Top

Posted by Larkin   (278 posts)  Bio
Date Reply #2 on Fri 22 Aug 2008 03:19 PM (UTC)
Message
Ah. Okay. Didn't realize it was only for colors. :(

I do have the brackets escaped in my pattern. The forum stripped out the backslashes because of forum codes. Good eye, though!

Thanks for the help.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,425 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.