autosipper

by Lilia

Back to Mechanic's Corner.

Lilia2010-09-14 02:44:09
I have an autosipper, I think Jules made it, which occasionally sips twice. I've looked at the code and it tracks sip balance using true and false. I've seen some before that use 1 and 0 with a .5 sent, I think, when the system sips. Is possible to simply replace the true and false with 1 and 0, and where do I add the .5 or whatever it is? I'm using Mudlet.
Mirami2010-09-14 03:08:32
(Not entirely sure, but) I do remember back in the day that his autosipper was built into both the system and the separate autosipper module, and that disabling the module fixed the problem. Not sure if this is your problem or not, but I know that was the problem in the past.
Unknown2010-09-14 11:44:58
Generally, you have an alias that matches on "sip health" to set your balance to 0.5, and then when you get the sip message, you check for the 0.5 to set it to 1. If it's at 0 when you get the message, then it's an illusion. Of course, you'll also want a timer failsafe to set the 0.5 back to 0 after a second or three.
Lilia2010-09-14 22:19:12
This is what I have currently in the script:
CODE
function MantisAutoSipper()
if mantis.autosipper.balance == true then
if mantis.stats.currentHealth <= (mantis.stats.maxHealth * mantis.autosipper.sipAt) then
send("sip health")
elseif mantis.stats.currentEgo <= (mantis.stats.maxEgo * mantis.autosipper.sipAt) then
send("sip bromides")
elseif mantis.stats.currentMana <= (mantis.stats.maxMana * mantis.autosipper.sipAt) then
send("sip mana")
end
end
end


So I should change it to:
CODE
function MantisAutoSipper()
if mantis.autosipper.balance == 1 then
if mantis.stats.currentHealth <= (mantis.stats.maxHealth * mantis.autosipper.sipAt) then
send("sip health")
mantis.autosipper.ballance = 0.5
elseif mantis.stats.currentEgo <= (mantis.stats.maxEgo * mantis.autosipper.sipAt) then
send("sip bromides")
mantis.autosipper.ballance = 0.5
elseif mantis.stats.currentMana <= (mantis.stats.maxMana * mantis.autosipper.sipAt) then
send("sip mana")
mantis.autosipper.ballance = 0.5
end
end
end


The trigger for off balance is currently:
CODE
mantis.autosipper.balance = false


It should be changed to

CODE
if mantis.autosipper.balance == 0.5
mantis.autosipper.balance = 0
end


I'll be really surprised if I got this right the first time, but I think I understand what you're saying.
Unknown2010-09-14 23:47:03
Looks pretty close. Make sure you spell "balance" consistently, and don't forget to set that timer failsafe, if you can.
Lilia2010-09-15 21:22:08
It worked! I'm not sure where to put the timer though. I'm not really worried about illusions yet, I do very little PvP, do I really need a timer?
Ssaliss2010-09-15 21:26:07
You'd put the timer after:

send("sip health")
mantis.autosipper.ballance = 0.5

Personally, I'd suggest a timer even if you're not worried about illusions. There are other things that can muck with sipping, such as stupidity, stun, aeon etc.

EDIT: You would, of course, need to add the timer at all three points where the balance is put to 0.5. Possibly excluding manual sipping, but I'd put it there even then.
Lilia2010-09-15 21:59:07
So just: tempTimer( 3, ])

What's the point of this again? The system sends the sip command, but I don't receive the sipping message, so I tell the system I don't have sip balance anyways? This seems counter intuitive in the case of stupidity, where I would still have sip balance if the command didn't go through. But I can see where it would be needed if I didn't see the sip message, like blackout or something... I think I just confused myself.

Thank you all for being so helpful and patient!
Ssaliss2010-09-15 22:21:26
No no, the other way around.

The system tries to sip, sets the balance to 0.5 and starts the timer. When the timer reaches the end, it should check of the balance is 0.5, and if so, set it back to 1 (i.e. you tried to sip but didn't succeed, so you should still have sip balance). If it's 0, leave it be.
Lilia2010-09-15 23:48:19
Okay, i think I got it. Thanks so much guys!