Trigger "Copy wildcard to Clipboard" happens on failed matches

Posted by WillFa on Sat 18 Oct 2008 10:18 PM — 5 posts, 20,456 views.

USA #0
On the mud I play, walking around briefed shows rooms like:

"On a balcony (n,e)"

and you can set an ansi variable so matching it isn't a problem.


<triggers>
  <trigger
   back_colour="14"
   bold="y"
   clipboard_arg="1"
   enabled="y"
   match="^(.* (\(.*\)))$"
   match_back_colour="y"
   match_bold="y"
   match_inverse="y"
   match_italic="y"
   match_text_colour="y"
   name="RoomGrab"
   regexp="y"
   script="graphExits"
   sequence="100"
   text_colour="15"
  >
  </trigger>
</triggers>


This works as expected.

My hp bar echos output like:
 HP: 756/1013  K: 498/498 SP: 224/224 V: 92% [[ AG:277 O:373 PE:158 B MB HS:18 ]]   | 660637/337621 (92%)

It has multiple ansi codes in it, the first space nor the "HP:" are white on cyan, like the room short echos. Trace shows that it's not matching. However, the entire hpbar ends up on the clipboard. Disabling the RoomGrab trigger stops the behavior. (So it's not a conflicting trigger)

Thanks Nick! :)
Australia Forum Administrator #1
I can't reproduce that. Bear in mind that clipboard_arg="1" means it should copy argument 1 to the clipboard, so the clipboard text would have in it "On a balcony (n,e)" not the HP bar stuff.
USA #2
Simpler test:
<triggers>
  <trigger
   back_colour="14"
   clipboard_arg="1"
   enabled="y"
   match="^(.*?)$"
   match_back_colour="y"
   match_text_colour="y"
   regexp="y"
   send_to="12"
   sequence="100"
   text_colour="15"
  >
  <send>print("Matched")</send>
  </trigger>
</triggers>

In the trigger test box, paste the below:

\1B[46mPassed\1B[0m
Failed

(be sure to have the trailing enter after "Failed")
"Matched" gets noted only once, as expected.
Press ctrl+v. "Failed" is pasted into your input box.

Amended on Sun 19 Oct 2008 05:16 AM by WillFa
Australia Forum Administrator #3
Ah yes I see what you mean. That will be fixed in version 4.38. The code to copy the matching wildcard to the clipboard was after the test for the regular expression match, but before the test for the colour match. I have moved that and it works correctly now.
USA #4
Cool. Thanks Nick. :)