Dialog:showIfNeeded()
Shows the dialog only when a question still needs an answer. Otherwise it returns straight away, and the macro uses the saved answers.
Signature
Dialog:showIfNeeded(): void
Returns
void
Description
Use it for setup the user does once, such as picking where buttons are. The dialog shows when:
- the user has never confirmed a question, for example on the first run, or after you add a new question in an update
- a pick or recording no longer fits the screen, for example on another phone
- the user pressed Ask again under Setup questions in the macro's settings
Questions hidden by showWhen or hideWhen don't count. When the dialog does show, it behaves like Dialog:show(), starting at the first page with something to answer.
Example
Dialog:init()
Dialog:add(TapPicker(1, "Tap the Attack button"))
Dialog:showIfNeeded()
Screen:click(Dialog:getValueById(1), ClickParams())