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
➜ trigger help
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Hazmat
(2 posts) Bio
|
Date
| Tue 24 Jan 2012 09:33 PM (UTC) |
Message
| i am having difficulty getting my second char that i mud with to come out stunning. Currently he comes out assisting then stuns afterwards with triggers. How can i make him come out stunning <mob>? Stunning a mob is critical in retaining hitpoints.
THE PROBLEM:
the problem here is that when i try to use wild cards for <mob>, the retained wildcard isnt always the trigger name of the mob. for example:
<A Dark Knight> - the key here is knight or dark, <a dark knight> isnt a target and doesnt work
there are certain mobs that this does work for though, for example:
<matilda> - key name matches mob.
is there a way to set this up properly? I've tried numerous ways but none worked for mobs with an 'a' or 'the' infront of the mob description.
what would also resolve this would be if its possible to send the same command to both (or all) worlds open. so that i can send 'kill <knight>' and alias "kill" for assasinate for CharA and stun for CharB.
thanks
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 24 Jan 2012 11:34 PM (UTC) |
Message
| In a script you could find the name "A Dark Knight" and do a string.gmatch on it. For example:
function extractMobname (s)
local mobname = ""
for w in string.gmatch (s, "%a+") do
if w:lower () ~= "a" and w:lower () ~= "the" then
mobname = w
end -- if
end -- for
return mobname
end -- extractMobname
print ("found mob:", extractMobname ("A Dark Knight"))
Output:
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Hazmat
(2 posts) Bio
|
Date
| Reply #2 on Wed 25 Jan 2012 11:51 PM (UTC) |
Message
| thanks.. will this one string.gmatch work for other mobs with the same condition? Id probably have to do one for each huh?
eg.
a wilderbeast
the might kraken
etc.. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Thu 26 Jan 2012 09:05 AM (UTC) |
Message
| Yes it should be general. It discards the words "a" and "the" and returns the last word (other than those) found. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
11,181 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top