pointerX
Canonical ID: events.pointerX. Nederlands: aanwijzerX.
Returns the horizontal x coordinate, a position measured in the scene’s own units, saved when the current pointer event happened. This is a snapshot, not the pointer’s live position. Moving the pointer afterwards does not change it.
The same event block can still read this position after waiting or calling a function. A separately queued block, such as a message handler, does not inherit it. Calling outside a pointer-event block or its function calls produces E4020. See press, release, and click positions for why a release position may be negative.
Signature
pointerX()
Arguments
This call takes no arguments. Always write the parentheses.
Return value
Number.
Example
# language: en
when pointerClicked("primary"):
let position = pointerX()
wait(0.01)
say position == pointerX()
Each accepted click prints true, even if the pointer moves during the wait.
Notes and common mistakes
Use the function name for your source language. Its canonical ID is a shared documentation label; you do not type that ID as a call. Giving your own variable or function the same name can hide the built-in. Supply the documented arguments and value types. Pliro reports mismatches when checking can detect them, or when the call runs.
An event descriptor selects the event in a top-level when header, outside other blocks (E3201–E3203). A reporter is an ordinary function that returns a value, such as pointerX; broadcast is an ordinary call too. A handler is the block reacting to an event. Key and pointer handlers keep a run ready for future input and need host support (E4019). Pointer reporters need the current pointer event (E4020). The whole run has a shared event-work limit (E4018). Ordinary setup must finish before handlers get turns. See event rules and pointer positions.
Related entries
started · after · messageReceived · keyPressed · pointerPressed · Programming guides · Host support · Calls and arguments
