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
➜ catching certain variables possible?
catching certain variables possible?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Kurapiira
(25 posts) Bio
|
Date
| Fri 19 Nov 2010 02:59 AM (UTC) Amended on Fri 19 Nov 2010 03:03 AM (UTC) by Kurapiira
|
Message
| Hi,
trying to make a trigger to catch certain parts of a line.
The 1st hulking troll punches at you
the 2nd mountainous drooling ogre bites at you
The 4th firefly bites you
Harru claws you
Is it possible to save certain parts of the
line as a variable?
I'm trying to catch which one (1st,2nd,3rd)
I'm trying to catch the name preceding the attack type
Also would be nice to have different attack types
(bites|punches|claws)
so No matter what attacks, i can respond in a certain way
kill 1 troll
riposte 2 ogre
counter 4 firefly
claw harru...etc
this isn't working..am I even close?
thanks for any help or info
Kura
Trigger:
^The (.%d?)(.%w?) (.*?) (.%w?) attacks you with (.*?)\, but you evade the strike\!$
| Top |
|
Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
Date
| Reply #1 on Fri 19 Nov 2010 03:41 AM (UTC) |
Message
| In triggers you use backslashes, not % symbols for special classes. This sort-of works, it should get you started:
<triggers>
<trigger
enabled="y"
match="^The (?'which'\d+)(st|nd|rd|th) (?'mob'[a-zA-Z ]+) (?'attack'bites|punches|claws) (at )?you"
regexp="y"
send_to="12"
sequence="100"
>
<send>
print ("which = %<which>")
print ("mob = %<mob>")
print ("attack = %<attack>")
local reply = "kick"
local which = %<which>
local last_mob_word = string.match ("%<mob>", "%%a+$")
Send (string.format ("%s %i %s", reply, which, last_mob_word))
</send>
</trigger>
</triggers>
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Kurapiira
(25 posts) Bio
|
Date
| Reply #2 on Fri 19 Nov 2010 05:49 AM (UTC) |
Message
|
Thanks sooo much, am trying it now..
will post if i can get it going :)
K. | Top |
|
Posted by
| Kurapiira
(25 posts) Bio
|
Date
| Reply #3 on Fri 19 Nov 2010 07:41 AM (UTC) Amended on Fri 19 Nov 2010 08:20 AM (UTC) by Kurapiira
|
Message
| It's working for Mobs that bite/claw/punch AT me,
but not for this...
The 1st animated training dummy attacks you with its simple wooden training sword, but you parry the blow with your claws!
I tried doing this..
...?you(.*?), but you parry the
just not sure how to do it..do i need
2 triggers?..one for natural attacks and one for weapons?
p.s. what is the question mark before YOU for?
Thanks for any help :)
<triggers>
<trigger
enabled="y"
match="^The (?'which'\d+)(st|nd|rd|th) (?'mob'[a-zA-Z ]+) (?'attack'bites|punches|claws|attacks) (at )?you, but you parry the "
regexp="y"
send_to="12"
sequence="100"
>
<send>print ("which = %<which>")
print ("mob = %<mob>")
print ("attack = %<attack>")
local reply = "batt rip"
local which = %<which>
local last_mob_word = string.match ("%<mob>", "%%a+$")
Send (string.format ("%s %i %s", reply, which, last_mob_word))
</send>
</trigger>
</triggers>
| 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.
15,445 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top