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.

ParameterTypeDefaultDescription
keystringCache key, unique within this macro.
config.labelstringkeyTitle shown above the field.
config.placeholderstringHint text shown when the field is empty.
config.defaultstringPre-filled value.
config.invalidateCachebooleanfalseAlways 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.

ParameterTypeDefaultDescription
keystringCache key, unique within this macro.
config.labelstringkeyTitle shown above the field.
config.placeholderstringHint text shown when the field is empty.
config.defaultnumberPre-filled value.
config.min / config.maxnumberNumeric bounds hint.
config.invalidateCachebooleanfalseAlways 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.

ParameterTypeDefaultDescription
keystringCache key, unique within this macro.
config.labelstringkeyTitle shown above the switch.
config.defaultbooleanfalseInitial switch state.
config.invalidateCachebooleanfalseAlways 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.

ParameterTypeDefaultDescription
keystringCache key, unique within this macro.
config.optionsstring[]The choices to display.
config.labelstringkeyTitle shown above the list.
config.defaultstringfirst optionPre-selected option.
config.invalidateCachebooleanfalseAlways 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.

ParameterTypeDefaultDescription
keystringCache key, unique within this macro.
config.labelstringkeyInstruction text shown on the overlay.
config.invalidateCachebooleanfalseAlways 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.

ParameterTypeDefaultDescription
keystringCache key, unique within this macro.
config.labelstringkeyInstruction text shown on the overlay.
config.invalidateCachebooleanfalseAlways 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 with new 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.

ParameterTypeDescription
keystringThe 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.