Pause Bot if mana LOSS is different than X.
I didn't tested the codes that i will post, but people can use it as "start" to adapt for its own needs.
Check for mana LOSS. If your mana's DECREASED value was different than listed values since last run, it will play a sound, flash client and pause bot.
MANA_LOSS_VALUES = { 20, 25 } means it will check if your lost mana value is equal to 20 or 25. If it's not then it will pause bot.
ACCEPTABLE_MISSING_VALUE set script to doesn't triggers if the missing value is equal to the table value minus this value.
Pay attention: The verification is based on last time the script run, so watch your Persistent Interval.
Example: If persistent interval is 1000ms then it will work like this: (SCRIPT RUNS) -> waits 1000ms -> (SCRIPT RUNS). So the script will check if you lost X mana in last seconds (1000ms), that means if you set a high Persistent Interval then it may not work properly. TEST IT BEFORE LEAVING AFK!
If you are casting exura only then setup MANA_LOSS_VALUES = { 25 }. Because you would lose 25 mana after casting exura.
If you are casting exura and utevo lux then setup MANA_LOSS_VALUES = { 20, 25 }. Because you would lose 20 or 25 mana after casting those spells.
ACCEPTABLE_MISSING_VALUE: This serves as a safety parameter because of the persistent delay.
Example: Without this parameter, if your spell requires 20 mana and after you cast it, you suddenly heals 1 mana, you would lose 19 mana, not 20, so it would trigger pause. But if you setup ACCEPTABLE_MISSING_VALUE = 2, the script would not trigger pause if you lost 20, 19 or 18 mana.
Think that it's like a mistake margin!
I didn't tested the codes that i will post, but people can use it as "start" to adapt for its own needs.
Check for mana LOSS. If your mana's DECREASED value was different than listed values since last run, it will play a sound, flash client and pause bot.
MANA_LOSS_VALUES = { 20, 25 } means it will check if your lost mana value is equal to 20 or 25. If it's not then it will pause bot.
ACCEPTABLE_MISSING_VALUE set script to doesn't triggers if the missing value is equal to the table value minus this value.
Pay attention: The verification is based on last time the script run, so watch your Persistent Interval.
Example: If persistent interval is 1000ms then it will work like this: (SCRIPT RUNS) -> waits 1000ms -> (SCRIPT RUNS). So the script will check if you lost X mana in last seconds (1000ms), that means if you set a high Persistent Interval then it may not work properly. TEST IT BEFORE LEAVING AFK!
If you are casting exura only then setup MANA_LOSS_VALUES = { 25 }. Because you would lose 25 mana after casting exura.
If you are casting exura and utevo lux then setup MANA_LOSS_VALUES = { 20, 25 }. Because you would lose 20 or 25 mana after casting those spells.
ACCEPTABLE_MISSING_VALUE: This serves as a safety parameter because of the persistent delay.
Example: Without this parameter, if your spell requires 20 mana and after you cast it, you suddenly heals 1 mana, you would lose 19 mana, not 20, so it would trigger pause. But if you setup ACCEPTABLE_MISSING_VALUE = 2, the script would not trigger pause if you lost 20, 19 or 18 mana.
Think that it's like a mistake margin!
local MANA_LOSS_VALUES = { 20, 25 } -- If mana LOSS different than this values then pause. You should insert the amount of required mana to cast your spells.
local ACCEPTABLE_MISSING_VALUE = 2 -- Doesnt triggers if the missing value is equal to the table value minus this value. This serves as a safety parameter because of the persistent delay. If your spell requires 20 mana, but you lose 19 or 18 (20 - 1 and 20 - 2), this is acceptable.
if connected() then
LAST_MANA = LAST_MANA or mp()
local current_mana = mp()
local lostMana = LAST_MANA - current_mana
if lostMana > 0 then
local flag = false
for _, possibleManaLoss in ipairs(MANA_LOSS_VALUES) do
if type(possibleManaLoss) == 'string' then
possibleManaLoss = tonumber(possibleManaLoss)
end
if type(possibleManaLoss) == 'number' and (lostMana == possibleManaLoss or (lostMana >= (possibleManaLoss - ACCEPTABLE_MISSING_VALUE) and lostMana <= possibleManaLoss)) then
flag = true
break
end
end
if not flag then
playsound('default')
flashclient()
pausebot(true)
end
end
LAST_MANA = current_mana
else
LAST_MANA = nil
end