Prompt
Prompt the user for configuration values at runtime, cached per-macro
Script input lets a macro ask the user for a value the first time it runs, then reuse that value on every subsequent run without showing the prompt again. Values are stored per-macro so different macros never share a cache.
Each function blocks script execution until the user responds. Cancelling stops macro execution — and so does leaving a prompt unanswered: after 5 minutes with no response the prompt gives up and aborts the macro exactly as a cancel would. A macro that prompts should not be started and walked away from.
promptText(key, config?)
Shows a single-line text field and returns the entered string.
| Parameter | Type | Default | Description |
|---|---|---|---|
key | string | — | Cache key, unique within this macro. |
config.label | string | key | Title shown above the field. |
config.placeholder | string | — | Hint text shown when the field is empty. |
config.default | string | — | Pre-filled value. |
config.invalidateCache | boolean | false | Always show the prompt, even if a value is cached. |
Returns string
var name = promptText("playerName", { label: "Player name" });
print("Hello,", name);
promptNumber(key, config?)
Shows a numeric keyboard and returns the entered value as a number.
| Parameter | Type | Default | Description |
|---|---|---|---|
key | string | — | Cache key, unique within this macro. |
config.label | string | key | Title shown above the field. |
config.placeholder | string | — | Hint text shown when the field is empty. |
config.default | number | — | Pre-filled value. |
config.min / config.max | number | — | Inclusive numeric bounds. An out-of-range entry is clamped into range before it is returned. |
config.invalidateCache | boolean | false | Always show the prompt, even if a value is cached. |
Returns number
var delay = promptNumber("tapDelay", { label: "Tap delay (ms)", default: 500 });
wait(delay);
promptToggle(key, config?)
Shows an On/Off switch. Always returns a boolean.
| Parameter | Type | Default | Description |
|---|---|---|---|
key | string | — | Cache key, unique within this macro. |
config.label | string | key | Title shown above the switch. |
config.default | boolean | false | Initial switch state. |
config.invalidateCache | boolean | false | Always show the prompt, even if a value is cached. |
Returns boolean
var fast = promptToggle("fastMode", { label: "Fast mode" });
if (fast) wait(100); else wait(500);
promptSelect(key, config)
Shows a scrollable list of buttons and returns the selected option. config.options is required: without it the overlay still opens, on a card with no choices, and dismissing that card returns nothing — which stops the macro.
| Parameter | Type | Default | Description |
|---|---|---|---|
key | string | — | Cache key, unique within this macro. |
config.options | string[] | — | The choices to display. |
config.label | string | key | Title shown above the list. |
config.default | string | first option | Pre-selected option. |
config.invalidateCache | boolean | false | Always show the prompt, even if a value is cached. |
Returns string
var server = promptSelect("server", {
label: "Server region",
options: ["US East", "US West", "EU", "Asia"]
});
print("Server:", server);
promptPosition(key, config?)
Shows a full-screen semi-transparent overlay. The user taps anywhere on screen to record that position, which is returned as a TapPoint in device pixels.
| Parameter | Type | Default | Description |
|---|---|---|---|
key | string | — | Cache key, unique within this macro. |
config.label | string | key | Instruction text shown on the overlay. |
config.invalidateCache | boolean | false | Always show the overlay, even if a position is cached. |
Returns TapPoint — a Match-like point (extends Region) centered on the tap, with tap()/longPress() helpers. Its w/h are 0, so region-scoped searches on it fall back to the full screen — call .expand(n) first to search a real box around the point.
var pos = promptPosition("tapTarget", { label: "Tap the attack button" });
pos.tap(); // tap the recorded position
pos.expand(80).findObject("icon"); // search around it
tapAt(pos.cx, pos.cy); // or use raw coordinates
promptRegion(key, config?)
Shows a full-screen semi-transparent overlay. The user drags a rectangle on screen to define a region, which is returned as a Region object with the drawn coordinates in device pixels.
| Parameter | Type | Default | Description |
|---|---|---|---|
key | string | — | Cache key, unique within this macro. |
config.label | string | key | Instruction text shown on the overlay. |
config.invalidateCache | boolean | false | Always show the overlay, even if a region is cached. |
Returns Region — a Region with x, y, w, h in device pixels
var area = promptRegion("searchArea", { label: "Draw the area to search" });
if (area) {
var match = area.findObject("icon");
if (match) match.tap();
print(area.ocr()); // OCR the drawn region
area.highlight({ duration: 2000 }); // outline it for 2 seconds
}
As a visual Script Input (Region) step, the wholeRegionobject is stored under the step's variable name — not as four separate_x/_y/_w/_hrun-variables. Later coordinate and expression fields take property accessors on it (area.x,area.w,area.expand(10)); a bare${area}in a text field renders the object as JSON.
clearPrompt(key)
Removes the cached value for the given key. The next call with that key will show the prompt again.
| Parameter | Type | Description |
|---|---|---|
key | string | The cache key to clear. |
Returns void
clearPrompt("playerName"); // next run will ask again
clearPrompts()
Removes all cached input values for the current macro. Every input function will show its prompt on the next run.
Returns void
// Useful as a "reconfigure" shortcut:
if (getGlobalVar("reconfigure")) {
clearPrompts();
setGlobalVar("reconfigure", false);
}
Cache scope: values are stored per-macro — two macros with the same key do not share cached values. Uninstalling the app clears the cache.