SplitScript reference / Language / whileAttached
whileAttached
lifecycle block
whileAttached { ... }
Runs on every initialized attached update.
State and settings data has already refreshed when this action runs. The initialization poll is deliberately skipped. This action may use await or retry; at most one invocation is in flight for an attachment, it is polled once per attached update, and process closure cancels it. While it is pending, every timer-decision action is skipped. Completion does not start another invocation until the next update. Falling through or returning true continues to the timer-decision actions; returning false skips all of them for the completion update.
Examples
Use whileAttached
let marker
onAttach {
marker = await process.scanMemory(sig"10 08 ?? ??")
}
whileAttached {
if (process.read<u16>(marker) else 0) != 0x0810 {
marker = await process.scanMemory(sig"10 08 ?? ??")
return false
}
}
Related
| Symbol | Description |
|---|---|
| onAttach | Initializes one state-provider attachment. |
| await | Waits for an asynchronous value and yields its result. |
| retry | Retries synchronous fallible work until it succeeds. |