[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  trigger help
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

trigger help

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Hazmat   (2 posts)  [Biography] 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

[Go to top] top

Posted by Nick Gammon   Australia  (19,180 posts)  [Biography] 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:


found mob: Knight

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Hazmat   (2 posts)  [Biography] 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..
[Go to top] top

Posted by Nick Gammon   Australia  (19,180 posts)  [Biography] 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
[Go to top] 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.


1,018 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]