Nick Gammon said:
match.regexp? What's that?
Can you paste your code? You are just showing the tiny bits that fail. The reasons why they fail would be more related to seeing the whole.
For example, "mobillengine" - where is that defined?
I'm not using a plugin.
Sorry, I had already copy/pasted the whole mobkillengine function from my script file in a previous message, so I didn't think it was necessary to paste it again.
"mobillengine" was a typo. I'm sorry.
Right now, I believe this function can stand alone ... without any other aliases or triggers.
Per one of you previous messages...
Nick Gammon said: I think you are making a mistake by creating an alias to do what a function really should.
If you make a script file, and put mobkillengine into it as a function (not an alias), then you just call that from the first alias. That way the pauses in mobkillengine will now be incorporated into the first alias, and it will feed the kill commands in slowly.
So my goal with this function is to be able to get the moblist from the alias, and feed it into this function, 1 mob at a time.
But I don't need the alias in order to test if this function is working (fundamentally). If it doesn't work by calling it directly, then it's not going to work by having an alias "on top" of it.
With the typo corrected, the function will now hit a mob 1 time and then return. It isn't looping how I want.
Sorry to be such a pest.
function mobkillengine (mob)
-- If readytokill is disabled, then we skip the
-- whole routine. The main reason readytokill would
-- be disabled would be due to the fact that we are
-- already killing some other mob. We don't want our
-- killing to overlap, so when we start this
-- routine, we set readytokill to off so that
-- if it gets called a second time, the second
-- instance will just ignore it until the first
-- instance is done killing.
if (readytokill) then
-- The first thing we do is set readytokill
-- to false so another instance can't overlap.
readytokill = false
-- This is our failsafe. With enough logic,
-- this should never be needed. But just in
-- case something goes sideways, we can type
-- giveup to force our kill loop to stop.
giveup = false
-- Initialize x variable to nil
local x = nil
-- Our main kill loop
while not (x or giveup) do
-- Keep hitting until the mob is
-- dead or until the mob runs away.
-- Send ("kill %1")
-- Would this be this instead:
Send ("kill " .. mob)
-- So far we have 7 known reasons to
-- quit hitting.
-- 1.) Mob is slain!
-- 2.) Mob has run away.
-- 3.) We have specified an invalid target.
-- 4.) We are trying to attack ourself!
-- 5.) We are trying to attack inside a town.
-- 6.) We did not specify a target.
-- 7.) We died.
x = ("^The .*? (is slain!)|(flees in panic!)|(^There is no .*? here\.$)|(^You can\'t attack yourself!$)|
(^A being clothed in white appears before you\.$)|(^Do what\.?$)|(^The dead have no need to fight\.$)")
end -- while
-- One of our conditions has been met.
-- The mob was killed or it ran away.
-- In either case, we are ready to kill
-- again. So we set the readytokill
-- variable back to true so this routine
-- can be called again.
readytokill = true
end -- end main if statement
end -- function
|