Trigger to take numbers and send

Posted by Wimbley on Mon 07 Sep 2015 04:52 PM — 7 posts, 30,389 views.

#0
So I want the trigger to match Enemy 1: 2, 8, 19

and to send - lock 2, 8, 19

the coordinates and enemy name will be changing.

Thank you for any help!
#1
its been my past experience on these forums that they usually want you to show your own attempt at making this. my experience is pretty limited on these forums though (less than 50 posts)

edit: i've no idea what you are really wanting but im not a very good coder anyway.
Amended on Tue 08 Sep 2015 04:27 AM by Helpless
Australia Forum Administrator #2
There are quite a few informational posts and videos in the "Getting Started" section:

http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=120

It would indeed help to at least try to make such a trigger, and post what you came up with. Otherwise if we just write if for you, you haven't learned anything.

It seems on the face of it that a simple trigger with one or two wildcards would do it.
#3
My appologies, didn't want to seem like a freeloader. So, I am still experimenting now with the guides and stuff but haven't been able to get the wild cards to work, or the trigger part reliably.

^. \d \d \d \d$ is what I am focused around for the trigger portion. The first part(the name of target) will change depending on the persons name. The Next part of it is where I am becoming confused. it may have 1 number to identify the target or none at all, then the 3 digit coordinate. I don't need to send it back with commas.

For the send portion I have:
lock %1 %2 %3

but since I am struggling with part 1, I can't really begin to test the wildcards properly. Any hints/fingers in the right direction would be appreciated. Thank you.
Australia Forum Administrator #4
OK, post what you have tried.

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
#5
Maybe something like this...


^(.+?)(?: (\d*))?\: (\d+)\, (\d+)\, (\d+)$



Using your example of "Enemy 1: 2, 8, 19" the captures would be


%1 Enemy
%2 1
%3 2
%4 8
%5 19



Using example "Anything: 2, 8, 19" the captures would be


%1 Anything
%2 would be an empty string, ""
%3 2
%4 8
%5 19


Then you might send


lock %3, %4, %5
Amended on Sun 13 Sep 2015 03:54 PM by Donecce
#6
Thank you for the help! it is working with the test function, and now I will need to put it through some testing and see if it screws up on anything. it was my lack of understanding with the () and other spacers that was throwing it off from me getting it working.