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 ➜ Lua ➜ Counting mobs in a room.

Counting mobs in a room.

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


Posted by AnalogConspiracy   (9 posts)  Bio
Date Mon 22 Apr 2013 07:32 PM (UTC)
Message
I have this code I made the necessary altercations to, and it works. I know what my next step is, but I don't know how to implement this.
Is there way I can make this send to Output as well?

<triggers>
  <trigger
   back_colour="8"
   enabled="y"
   group="Mobs"
   ignore_case="y"
   keep_evaluating="y"
   match="^(.+)$"
   match_back_colour="y"
   match_text_colour="y"
   name="killall"
   regexp="y"
   send_to="12"
   sequence="100"
   text_colour="10"
  >
  <send>mobname = "%1"

specialMobs = {
  { desc = "A bumblebee darts around as it goes from flower to flower.", send = "kill bee", infight = true },
  { desc = "*An unusually large mosquito is flying about .", send = "kill mos", infight = true },
  { desc = "A narwhal is here, being awesome.", send = "kill narwhal", infight = true },

-- add more here ...

  }  -- end of table

for k, v in ipairs (specialMobs) do
  if string.find (mobname, v.desc, 1, true) then
    Send(v.send)
    return
  end -- if found
end -- for each table item

Note("No mobs, carry on.")

</send>
  </trigger>
  <trigger
   enabled="y"
   group="Mobs"
   ignore_case="y"
   keep_evaluating="y"
   match="^You enter into combat with .+.$"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>EnableGroup("Mobs",false)</send>
  </trigger>
</triggers>


I can't make that last trigger my prompt, because it constantly disables my script. Maybe I could make an alias to EnableGroup("Mobs", true) that, after combat, I use with Execute. Maybe the "look" command, to disable the prompt (if I implement this again) trigger, and re-enable the trigger I've named "killall" And then in the table inside that, I'll just add the disable that killall trigger.
But as it stands, I need to find some way to count mobs. It sends the kill command on every matching mob it sees.

I wouldn't know where to start with this... FoundMobs.count + 1 or something right?

Thank you for any assistance that can be given.
Also, how easy is it to convert scripts from zScript to Lua?

-- Analog
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.


8,216 views.

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.