starlit

settings

Read Starlit's movement, ESP, chams, glow, world and cosmetic settings, and change them for a moment: animated fog, an ESP element that follows a condition, a movement helper on a key of your own.

settings gives a script the values behind Starlit's own menu rows. A script reads them, and it can override them for as long as it keeps asking. Fade the fog colour, show the enemy box only while you stand still, switch the bunny hop and the air strafe from a key of the script's own. When the script stops, the user's values are back.

Ids and kinds

A setting is named by a lower case dotted id such as world.fog.density or movement.bhop. The full list, with kind and range for each of the 548 ids, is on settings ids. Ids start with movement, visuals (ESP, chams and glow), world or misc, so settings.list("visuals.esp") or settings.list("world.sky") returns one group at a time.

kindget returnsoverride takes
booltrue or falsetrue or false
inta whole numbera number, clamped to min to max and rounded
floata numbera number, clamped to min to max
combothe index of the entry, counted from 0a number, clamped to min to max and rounded
maska whole number, bit i is entry ia whole number, or an array of booleans
colorr, g, b, ar, g, b [, a] or a color object. A missing alpha keeps the setting's own alpha.

22 of the ids are read-only. You can read them with settings.get, settings.base and settings.info, and settings.override answers false for them.

How an override behaves

  • Lifetime. An override lasts 500 ms after the script's last call. Call it every frame, in events.on_paint, for as long as you want it. It also ends when the script unloads, stops with an error or is stopped, when the level changes, and when the user presses reset overrides on the scripts page. The user's value comes back each time.
  • The menu wins. If the user changes a setting that a script holds, the script's calls for it return false until the script has not asked for half a second, or calls settings.clear for it.
  • Keys. A setting the user has bound a key to answers false to settings.override.
  • Several scripts. With two scripts on one setting, the last call wins. The user's value returns when the last one lets go.
  • Not saved. Nothing a script writes goes into the user's config or into share codes.
  • Limits. A script holds at most 64 settings at a time and may make 256 accepted override calls per frame.
  • Wrong values. A wrong type, NaN or infinity gives false. An id that does not exist gives nil from the readers and false from settings.override, and the id is never repeated in a message. A missing argument is the usual type error.

Functions

settings.list

settings.list([prefix [, after]]) -> array of strings
argumenttypemeaning
prefixstringonly ids that start with this text. Leave it out for every id.
afterstringthe last id of the previous page. The list continues behind it.

Returns the ids, sorted, at most 256 per call. A full page means there may be more: call again with after set to the last id.

Cost 40 instructions plus 2 for each id returned.

local fog = settings.list("world.fog")
for _, id in ipairs(fog) do
  local info = settings.info(id)
  log.info(id .. "  " .. info.kind)
end

settings.info

settings.info(id) -> table or nil

Returns { kind = "bool" | "int" | "float" | "color" | "combo" | "mask", min = number, max = number, readonly = boolean }, or nil for an id that does not exist. min and max are the range settings.override clamps to.

Cost 15 instructions.

settings.get

settings.get(id) -> boolean, number or r, g, b, a

Returns the value the setting has right now, which includes what a script holds. A bool gives a boolean, an int, float or combo gives a number, a mask gives its bit mask, a colour gives r, g, b, a. An id that does not exist gives nil.

Cost 15 instructions.

local on = settings.get("movement.bhop")
local r, g, b, a = settings.get("world.fog.color")

settings.base

settings.base(id) -> boolean, number or r, g, b, a

Returns the user's own value. It is the same as settings.get, except that while a script holds the setting it gives what the value was before. Use it to build a value from the user's choice, for example to brighten the user's fog instead of replacing it.

Cost 15 instructions.

settings.override

settings.override(id, value ...) -> boolean
kindarguments after the id
booltrue or false
int, float, comboone number
maskone whole number, or an array of booleans
colorr, g, b [, a], or one color object

Returns true when the value was applied and false when it was refused: an id that does not exist, a read-only id, a setting the user has bound a key to, a setting the user changed while the script held it, a wrong type, a value that is not finite, or the 64 settings of the script already in use.

Cost 30 instructions.

events.on_paint(function()
  settings.override("world.fog.enabled", true)
  settings.override("world.fog.density", 0.35)
end)

settings.clear

settings.clear(id) -> boolean

Gives one setting back to the user at once. Returns true when this script held the setting. A setting that another script holds stays with that script.

Cost 20 instructions.

settings.clear_all

settings.clear_all() -> number

Gives back every setting this script holds. Returns how many it gave back.

Cost 20 instructions plus 2 for each setting given back.

Example: pulse the fog

Fade the fog colour and density with the clock.

events.on_paint(function()
  local t = time.now()
  settings.override("world.fog.enabled", true)
  settings.override("world.fog.color", 128 + 100 * math.sin(t), 160, 220)
  settings.override("world.fog.density", 0.3 + 0.2 * math.sin(t * 0.5))
end)

Example: boxes only while standing still

Show the enemy box only while the local player is standing still.

events.on_paint(function()
  local me = entity.local_player()
  local still = me ~= nil and (me:get("speed") or 0) < 5
  settings.override("visuals.esp.enemy.box", still)
end)

Example: movement on a key of your own

The bunny hop and the air strafe follow a toggle key that belongs to the script. The mask value 3 switches on the first two entries of the air strafe: view angles and movement keys.

local key = ui.keybind("movement helper", "toggle")

events.on_paint(function()
  local on = key:get()
  settings.override("movement.bhop", on)
  settings.override("movement.autostrafe.mode", on and 3 or 0)
end)

previous: resolver · next: settings ids