Configurable Heal With Setup
Store settings, expose setup fields, and cast only when conditions match.
local key = "example_heal"
storage[key] = storage[key] or {
spell = "exura",
hp = 80,
mana = 10,
hotkey = ""
}
local config = storage[key]
local heal = macro(100, "Example Heal", config.hotkey, function()
if hppercent() <= tonumber(config.hp) and manapercent() >= tonumber(config.mana) and canCast(config.spell) then
castSpell(config.spell)
delay(1000)
end
end)
heal:setSetup(function()
UI.Section("Heal Settings")
UI.Field("Spell", config.spell, function(value)
config.spell = value
end)
UI.NumberField("HP <=", config.hp, function(value)
config.hp = math.max(1, math.min(100, tonumber(value) or 80))
end)
UI.NumberField("Mana >=", config.mana, function(value)
config.mana = math.max(0, math.min(100, tonumber(value) or 10))
end)
UI.HotkeyField("Hotkey", config.hotkey, function(combo)
config.hotkey = combo
heal:setHotkey(combo)
end)
end)