Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Hazmat
(2 posts) bio
|
| Date |
Tue 24 Jan 2012 09:33 PM (UTC) [ quote
] |
| 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 (18,770 posts) bio
Forum Administrator |
| Date |
Reply #1 on Tue 24 Jan 2012 11:34 PM (UTC) [ quote
] |
| 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) [ quote
] |
| 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 (18,770 posts) bio
Forum Administrator |
| Date |
Reply #3 on Thu 26 Jan 2012 09:05 AM (UTC) [ quote
] |
| 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.
747 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )