Lua · Examples
UI
Saved settings with ui.*, a full page with menu.*, and notepads.
Each snippet runs as-is: copy it, press From Clipboard on the Lua page, turn it on. Quick start
#Saved settings
Create at the top, read with ui.get. Shown on the script's page.
ui_1.lua
ui.checkbox("on", "Enabled", true)
ui.slider("size", "Size", 10, 40, 18)
ui.combo("pos", "Position", { "Top", "Middle", "Bottom" }, 1)
ui.color("col", "Colour", color(255, 255, 255))
ui.keybind("key", "Hide key", 0)
function on_frame()
if not ui.get("on") then return end
if ui.get("key") ~= 0 and input.key_down(ui.get("key")) then return end
local w, h = draw.screen()
local ys = { 0.1, 0.5, 0.9 }
draw.text(40, h * ys[ui.get("pos")], "Hello", ui.get("col"), ui.get("size"))
end#A page of your own
Immediate mode: value in, value out.
ui_2.lua
local name, count, mode = "player", 0, 1
function on_menu()
menu.section("MY TOOL")
name = menu.input("Name", name)
mode = menu.combo("Mode", mode, { "Soft", "Hard" })
if menu.button("Add") then count = count + 1 end
menu.same_line()
if menu.button("Clear") then count = 0 end
menu.tooltip("Sets the counter back to zero")
menu.progress("Count", count / 10)
end#A notepad that saves
Save calls on_notepad_save.
ui_3.lua
function on_menu()
if menu.button("Edit message") then
notepad.open("msg", "Message", db.get("msg") or "gg")
end
end
function on_notepad_save(id, text)
if id == "msg" then db.set("msg", text) end
endFull scripts
Complete scripts with a header and settings, ready to use or change.