local inv = require("inventory_utils") local player = require("player") local keys = require("keys") -- Config start local keybind = keys.KEY_F -- (X key) -- https://www.glfw.org/docs/latest/group__keys.html https://www.glfw.org/docs/3.3/group__buttons.html local delay_back_min = 2 local delay_back_max = 4 -- Config end local last_slot = nil local function get_healing_wand() local item = inv.findItemInHotbar("MANA_FLUX_POWER_ORB") if not item then item = inv.findItemInHotbar("OVERFLUX_POWER_ORB") end if not item then item = inv.findItemInHotbar("PLASMAFLUX_POWER_ORB") end return item end local pressed = false local tick = 0 registerKeyEvent(function(key, action) if action == "Press" and key == keybind then local item = get_healing_wand() if item then last_slot = player.input.getSelectedSlot() player.input.setSelectedSlot(item) player.input.useItem() pressed = true tick = math.random(delay_back_min, delay_back_max) end end end) registerClientTick(function() if pressed then if tick <= 0 then player.input.setSelectedSlot(last_slot) pressed = false else tick = tick - 1 end end end)