I'm working on my auto-basher right now. I've done auto-bashers a trillion times over, especially back in zMud, so the concept isn't a huge deal, but now that I'm getting a better grounding in Lua, I can't help feel that my current approach is way too clumsy.
My current implementation is as follows: On my prompt, it checks to see if autoBashing == 1. If this is true, it basically runs a function called "canAct." canAct currently looks like this:
-- canAct acts as a physical audit to check every possible circumstance
-- (afflictions, prone, etc.) that would keep one from being able to act on
-- either the given balance or both balances. If no balance is given, it
-- checks for both.
function canAct(balance)
-- As we don't currently have any affliction variables created, for
-- now this will just check to make sure they're not 1.
-- Also I obviously need more afflictions.
--
-- NOTE TO SELF: Add functionality for checking an action that only needs one balance!
if BAL == 1 and EQ == 1 and prone == 0 and pacifism ~= 1 and peace ~= 1 then
return true
else
return false
end
end
Now, this works pretty damn well, but as I mentioned, it feels pretty clumsy. I hate "if/then" statements and wish I could somehow do without them, but I feel there could be a better way of going about this than just checking several different variables.
Any ideas?
(And yes, I actually write my comments like that)