Register forum user name Search FAQ

Gammon Forum

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 ➜ Issue with targeting one word for a variable when line can have multiple words

Issue with targeting one word for a variable when line can have multiple words

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by Whisk3rz   (17 posts)  Bio
Date Reply #15 on Mon 07 Mar 2011 03:01 AM (UTC)
Message
I THINK I HAVE IT!

So far this works perfect for me. I think this is what I was looking for.

Thank you all for your help and it did help. Thanks Nick for the Trigger line, that really pulled it all together once I figured out the if/then statements. Taught me a little bit about this HUGE language I don't know...yet. :-P


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   group="HuntGY"
   keep_evaluating="y"
   match="^In this room you see\: 1st ([A-Za-z ]+)"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>

--Command to kill robber if match is made
if "%1" == "grave robber" then
Send ("kill " .. "robber")
--Sets target variable to mob for further fighting.
  Execute ("t ".. "robber")
--Displays target in bottom left
SetStatus ("Target: %1")
end --if

--Command to kill imp if match is made
if "%1" == "grave imp" then
Send ("kill " .. "imp")
--Sets target variable to mob for further fighting.
  Execute ("t ".. "imp")
--Displays target in bottom left
SetStatus ("Target: %1")
end --if

--Command to kill zombie if match is made
if "%1" == "zombie" then
Send ("kill " .. "zombie")
--Sets target variable to mob for further fighting.
  Execute ("t ".. "zombie")
--Displays target in bottom left
SetStatus ("Target: %1")
end --if

--Command to flee if match is made
if "%1" == "Master Zombie" then
ColourNote ("black", "red", "RUN FOR YOUR LIFE!")
world.EnableGroup ("HuntGY", 0)
end --if</send>
  </trigger>
</triggers>
Top

Posted by Whisk3rz   (17 posts)  Bio
Date Reply #16 on Mon 07 Mar 2011 03:03 AM (UTC)

Amended on Mon 07 Mar 2011 03:12 AM (UTC) by Whisk3rz

Message
Nick Gammon said:

Well, mobname = "big fat ugly grave robber" was purely a test case to demonstrate the idea.

Change:


mobname = "grave robber"


to:


mobname = "%1"





OR, I could write all that code I just wrote! Same result, different path, I guess! Thanks again! [And please excuse the double post!!]
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.


65,767 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.