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.
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 | — | Numeric bounds hint. |
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.
| 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 {x, y} 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 Match — a zero-size Match centered on the tapped point
var pos = promptPosition("tapTarget", { label: "Tap the attack button" });
pos.tap(); // tap the recorded position
pos.expand(80).find("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.find("icon");
if (match) match.tap();
print(area.ocr()); // OCR the drawn region
area.highlight(2000); // outline it for 2 seconds
}
The result is stored in four run-variables:key_x,key_y,key_w,key_h. You can use them directly in subsequent steps or reconstruct the region withnew Region(key_x, key_y, key_w, key_h).
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.