[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]  Issue with targeting one word for a variable when line can have multiple words
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

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

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


Pages: 1  2 

Posted by Whisk3rz   (17 posts)  [Biography] bio
Date Reply #15 on Mon 07 Mar 2011 03:01 AM (UTC)  quote  ]
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>
[Go to top] top

Posted by Whisk3rz   (17 posts)  [Biography] bio
Date Reply #16 on Mon 07 Mar 2011 03:03 AM (UTC)  quote  ]

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!!]
[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.


4,691 views.

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

[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]