A phone has no keyboard: a mod that reacts to keys can put a button on the screen that presses its key, or calls a
function. Buttons show on Android only, drawn over the game's HUD in its colours (a dark disc, a yellow ring and label,
lit while pressed); the finger that presses one never reaches the game (no shot, no turn). On the PC they never show:
the keys are there. So one mod works on both, unchanged on the PC.
Places and sizes are in mod pixels, like draw (on a phone the screen's density makes them the same physical size
as on a PC screen). x / y below 0 count from the right / bottom edge, so x = -100 stays 100 mod pixels from the
right on every screen. Without x / y, buttons line up along the right edge under the game's own buttons.
when says where a button shows: "hunt" (default: in a hunt while nothing covers the 3D view, no menu, map, popup or
statistics, the hunter alive), "menus" (outside hunts) or "always". The buttons go with the mod when the scripts are
reloaded (F9, Reload scripts).
Adds an on-screen button (Android). It needs a key, an onTap function, or both. Without x and y it takes the next free place along the right edge, under the game's own buttons there, with the other buttons placed that way (a column further left when one is full); x / y below 0 count from the right / bottom edge.
Parameter
Type
options
table
label (text), key (a key name: a tap presses it, the mod's keys.bind runs), onTap (fn(id): called on a tap), x, y, size (default 72) or w, h (mod pixels), when ("hunt", "menus", "always")
Changes a button's text (a toggle can show its state).
Parameter
Type
id
integer
a button id
text
string
local god = falselocal button
button = touch.button({label = "GOD: OFF", onTap = function()
god = not god
world.god(god)
touch.label(button, god and"GOD: ON"or"GOD: OFF")
end})