Watcher classes eliminate the boilerplate of tracking memory value changes across ticks. Rather than manually reading a value, storing a copy from the previous tick, and comparing the two, each watcher manages theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/CryZe/asr-assemblyscript/llms.txt
Use this file to discover all available pages before exploring further.
current / old pair for you. Call update() once per tick with your process handle, then read changed, current, or old to react to state transitions. Watchers also handle module-relative address resolution internally, so you only supply a module name and a relative offset once — at construction time.
Shared Watcher Interface
All typed watcher classes expose the same properties and method:| Member | Type | Description |
|---|---|---|
current | T | The most recently read value from game memory. |
old | T | The value read during the previous update() call. |
changed | bool (getter) | true when current !== old after the most recent update(). |
update(processId) | bool | Reads memory, shifts current → old, stores the new value in current, and returns whether the value changed. |
update method
The handle returned by
Process.attach(). The watcher uses this to call Process.getModuleAddress() and Process.read() internally.bool — true if the value changed this cycle; false otherwise (or if the read failed).
Numeric and Boolean Watcher Classes
All of the following classes share the same constructor signature:The name of the module (executable or DLL) whose base address will be resolved via
Process.getModuleAddress() each tick, e.g. "Celeste.exe".The relative offset from the module’s base address to the memory location you want to read. The watcher adds this to the resolved module base internally.
| Class | AS Type | Buffer size |
|---|---|---|
BoolWatcher | bool | 1 byte |
I8Watcher | i8 | 1 byte |
I16Watcher | i16 | 2 bytes |
I32Watcher | i32 | 4 bytes |
I64Watcher | i64 | 8 bytes |
ISizeWatcher | isize | 4 bytes |
U8Watcher | u8 | 1 byte |
U16Watcher | u16 | 2 bytes |
U32Watcher | u32 | 4 bytes |
U64Watcher | u64 | 8 bytes |
USizeWatcher | usize | 4 bytes |
F32Watcher | f32 | 4 bytes |
F64Watcher | f64 | 8 bytes |
StringWatcher
StringWatcher tracks a fixed-length string in game memory. Because a string requires a length and an encoding to be decoded correctly, its constructor takes two additional parameters compared to the numeric watcher classes.
The module name whose base address is resolved each tick, e.g.
"GameAssembly.dll".The relative offset from the module’s base address to the start of the string buffer in memory.
The number of bytes to read from memory. For UTF-8 strings this is the byte length; for UTF-16 strings this is also the byte length (i.e. twice the character count).
When
true, the raw bytes are decoded as UTF-16. When false (the default), they are decoded as null-terminated UTF-8. Most game strings are UTF-8; use true for games that store strings in UTF-16 (common in Unity/Windows games using wchar_t or C# string representations).current and old properties are both string. The changed getter and update() method work identically to the numeric watchers.