Skip to content

Connection#

Defined in Core.hpp. Network latency queries and game-level button injection.

GetClientPing#

int GetClientPing();

Returns the client-side network ping in milliseconds. Returns 0 if the connection component is not available.

int ping = GetClientPing();

GetServerPing#

int GetServerPing();

Returns the server-side network ping in milliseconds. Returns 0 if the connection component is not available.

int serverPing = GetServerPing();

PressGameButton#

void PressGameButton(uint32_t bit);

Presses a game-level button. The button remains pressed until ReleaseGameButton() is called with the same bit.

Parameter Type Description
bit uint32_t Button bit from GameButton namespace
PressGameButton(GameButton::Jump);
// ... later ...
ReleaseGameButton(GameButton::Jump);

Warning

Always pair PressGameButton with ReleaseGameButton. Forgetting to release will keep the button held indefinitely.


ReleaseGameButton#

void ReleaseGameButton(uint32_t bit);

Releases a previously pressed game button.

Parameter Type Description
bit uint32_t Button bit from GameButton namespace

PulseGameButton#

void PulseGameButton(uint32_t bit, uint32_t holdMs = 50);

Presses a game button and schedules an automatic release after holdMs milliseconds measured from the successful backend press. Use it for simple, one-step edge-triggered inputs (Skill1, Skill2, Ult, Reload, Interact, Melee).

The game fires these abilities once on the button's rising edge. A plain PressGameButton without a matching release keeps the bit held and blocks every subsequent cast — the plugin looks like it's "not activating the spell". PulseGameButton owns the press/release timing on the host side so plugins don't have to manage a per-bit timer. The host also keeps make and break in separate command phases and, with the GameMemory backend, waits for the dispatcher to consume the make when that can be observed.

Parameter Type Description
bit uint32_t Button bit from GameButton namespace
holdMs uint32_t Hold duration after the emitted press. 0 uses the 50 ms default; values above 2000 are clamped.
// Fire Tracer blink once:
PulseGameButton(GameButton::Skill2);

// Fire pulse bomb, slightly longer hold to be safe across ticks:
PulseGameButton(GameButton::Ult, 80);

Continuous inputs (LMouse, RMouse, Jump, Crouch) are still best expressed with PressGameButton / ReleaseGameButton because you want the bit held for as long as the condition is true.

Placement and other multi-stage abilities

A transport receipt cannot prove that the game entered a placement, targeting, or cast state. For flows such as ability preview followed by LMouse confirm, submit the ability pulse first, wait for a live-validated hero/game-state signal that the preview is active, and only then submit a new confirm pulse. Submitting both from one callback can put both edges in the same game command and the confirm may be evaluated before the preview state exists.

// State-machine outline for a placement ability.
if (stage == StartPreview)
{
    previewRequest = PulseGameButtonTracked(GameButton::Skill2, 50);
    stage = WaitForPreview;
}
else if (stage == WaitForPreview && IsSkill2Active())
{
    confirmRequest = PulseGameButtonTracked(GameButton::LMouse, 50);
    stage = WaitForPlacementResult;
}

Validate the hero-specific preview signal before relying on it. Confirm the result through preview exit, cooldown transition, or spawned-object state; InputConsumed alone is not placement confirmation.


GetGameCommandTick#

uint32_t GetGameCommandTick();

Returns the current game command tick. Versioned aim results and tracked input receipts use this counter so a plugin can order command-side events.

Warning

A command tick does not by itself identify a render frame, shot, cast completion, or projectile-spawn frame. Comparing command ticks establishes command-side ordering only.


PressGameButtonTracked#

uint64_t PressGameButtonTracked(uint32_t bit);

Submits a press and returns a request ID that can be queried with GetInputReceipt().

Tracked calls accept exactly one action bit. Passing 0, an unsupported bit, or a multi-action value such as GameButton::ScopedShoot returns 0. Queue-full rejection is different: it returns a nonzero request ID whose receipt state is InputRequestStateV1::Rejected.

Pair a tracked continuous press with ReleaseGameButton(bit) when the hold should end.


PulseGameButtonTracked#

uint64_t PulseGameButtonTracked(uint32_t bit, uint32_t holdMs = 50);

Tracked equivalent of PulseGameButton. It accepts one action bit, returns 0 only for invalid/multi-action input, and schedules the release on the host. A nonzero request can still become Rejected or Superseded, so always query its receipt.

uint64_t requestId = PulseGameButtonTracked(GameButton::Skill2, 50);
if (requestId == 0)
    LogError("invalid tracked input bit");

GetInputReceipt#

bool GetInputReceipt(uint64_t requestId, InputReceiptV1& out);

Reads the latest lifecycle snapshot for a tracked request. Returns false if the request ID is unknown or expired.

The host retains the latest 2048 tracked requests. Ordinary PressGameButton / PulseGameButton traffic does not consume that retention window.

State Meaning
Unknown No known request state
Queued Accepted into the host request queue
Applied Applied to the host's action intent
EdgeWritten The press edge was written to the input backend
InputConsumed The GameMemory backend observed the game input dispatcher consume the edge
Released The host wrote/completed the release lifecycle
Rejected The request could not be queued or applied
Superseded The request was coalesced/replaced; it may have emitted or still affect a live held/timed action

InputReceiptV1 contains requestId, state, queuedCommandTick, edgeWrittenCommandTick, inputConsumedCommandTick, releasedCommandTick, and backend. Use IsSuperseded() to distinguish replacement from rejection; both are terminal, but Superseded is not a safe retry signal because the action may have emitted or may still affect a live held/timed lifecycle. Milestone helpers are sticky when their observed tick is available: for example, IsInputConsumed() remains true after the receipt advances to Released.

Backend Value Receipt behavior
InputBackendV1::GameMemory 0 Writes the game's action mirrors and can observe InputConsumed when the dispatcher clears the edge
InputBackendV1::KernelDriver 1 Emits keyboard/mouse packets; cannot observe action-table consumption, so inputConsumedCommandTick remains 0 and the receipt normally advances from EdgeWritten to Released

Use GetBackend(), UsesGameMemory(), and UsesKernelDriver() to inspect the backend. A milestone tick is 0 until that stage occurs or when the backend event crossed a command boundary / no stable nonzero command tick was available. The host brackets tracked writes and driver packets as tightly as possible, but those fields are observations rather than exact injection, firing, or projectile-spawn frames. GameMemory publishes InputConsumed only from mirror reads bracketed by the same stable, nonzero command tick.

InputConsumed is not ShotConfirmed

On GameMemory, InputConsumed proves only that the game's input dispatcher consumed the injected edge. It does not prove that a weapon fired, an ability cast completed, or a projectile spawned. Cooldowns, weapon state, cast startup, and server acceptance happen later and may reject or delay the action. KernelDriver receipts never report InputConsumed because that backend cannot observe the game action table.

Keep aiming through the hero/weapon-specific cast or projectile-spawn window. Stop only after an appropriate game-state confirmation, not merely when the receipt reaches InputConsumed.

static uint64_t castRequest = 0;

AimStepResultV1 aim{};
if (AimAtPositionEx(targetPoint, 80.f, 0.01f, aim))
{
    if (castRequest == 0 && aim.IsSettled() && aim.settledCommandTicks >= 2)
        castRequest = PulseGameButtonTracked(GameButton::Skill2, 50);

    InputReceiptV1 receipt{};
    if (castRequest != 0 && GetInputReceipt(castRequest, receipt))
    {
        // Continue AimAtPositionEx every command tick, including after this.
        if (receipt.IsInputConsumed())
        {
            // Wait for ability cooldown/active state, a projectile-spawn event,
            // or a known cast-startup duration before releasing aim ownership.
        }
    }
}

GameButton Constants#

See Constants — Game Buttons for the full table of button bits.