Counting mobs in a room.

Posted by AnalogConspiracy on Mon 22 Apr 2013 07:32 PM — 1 posts, 8,570 views.

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