trigger help

Posted by Hazmat on Tue 24 Jan 2012 09:33 PM — 4 posts, 14,768 views.

#0
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

Australia Forum Administrator #1
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:


found mob: Knight
#2
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..
Australia Forum Administrator #3
Yes it should be general. It discards the words "a" and "the" and returns the last word (other than those) found.