Fix this explitive!?

by Simimi

Back to Mechanic's Corner.

Simimi2007-09-01 13:58:26
Well, I am working on more plugins to add to the free plugins thread (shameless plug). I have a recharge and a magic user targeting plugin to add. I want something people can really use, so I decided to put my autosipper in as a plugin, but it has one bug that I can not figure out. If I get hit for like, 80% my total hp in damagae, it panics and chugs pots.

Here is an excerpt of the script that is relevent. Please note it is much longer than this, but this seems to be where the problem is...
CODE
function autosipper()
  if bals == "curing" or nil then
    return
  end

if var.priority == "health" then
      if tonumber (var.health) <= (.90 * tonumber (var.maxhealth)) then
        if bals == true then
          Send ("drink health")
         end
      end
    end


Now then. Sipping a vial sets potion balance to "nil", getting a curing message from a vial sets potion balance to "curing", chugging the sip (it slides down your throat) sets potion balance to "nil".

Notice how it is not supposed to do -anything- if it is nil or curing? Yet it will still sip eventhough potion balance is non existant... I don't have this problem with other balances, just potion for some reason...

Ideas so I can fix this explitive thing and get the plugin in? I'm getting a bit frustrated now...
Xinael2007-09-02 00:00:21
I'm pretty sure that "if bals == "yes" or nil" is wrong - it either means "If bals == yes is true or if nil is true" or "if bals == ("yes" or nil)" and the expression ""yes" or nil" will always return "yes". In the tests I did, the expression was false even when the variable was nil.

So what you want is probably "if bals == "yes" or bals == nil".
Simimi2007-09-02 00:06:51
Wow got it, thanks! Knew it was some sort of lame syntax thing sleep.gif;
Arix2007-09-02 02:45:13
WHERE THE censor.gif ARE THE censor.gif ING EXPLETIVES? I WAS PROMISED EXPLETIVES, DAMMIT!
Simimi2007-09-02 02:54:48
I'm sorry dear, how is this.

SOD THIS SODDING SODDED SOD ?
Arix2007-09-02 02:59:50
Those aren't expletives sad.gif
Gaetele2007-09-06 14:20:26
censor.gif your censor.gif ing mom because she's a censor.gif ing censor.gif who has nothing censor.gif better to do but censor.gif ing censor.gif at little kids.