PromptHelper

A utility module for handling prompt interactions, specifically designed to manage hold-mode prompt completions with automatic disabling and re-enabling.

Overview

The PromptHelper provides utilities for safely handling prompt interactions, particularly for hold-mode prompts. It includes built-in safeguards to prevent prompt spam and ensures proper state management.

API Reference

promptHelper:hasPromptHoldModeCompleted(promptId, disableMsOnComplete?)

Checks if a hold-mode prompt has been completed and handles the prompt state safely.

Parameters:

  • promptId (number) - The ID of the prompt to check

  • disableMsOnComplete (number, optional) - Time in milliseconds to disable the prompt after completion (default: 1000ms)

Returns: boolean - true if the prompt was completed and is ready for action, false otherwise

How It Works

The method performs several safety checks and state management operations:

  1. Completion Check: Verifies if the hold mode has been completed

  2. Enabled State Check: Ensures the prompt is currently enabled

  3. Temporary Disable: Disables the prompt immediately after completion

  4. Control Disable: Disables all controls for one frame to prevent input conflicts

  5. Auto Re-enable: Automatically re-enables the prompt after the specified delay

Usage Examples

Basic Usage

Custom Disable Duration

In a Game Loop with Multiple Prompts

Advanced Example with Animation

Safety Features

Automatic Prompt Disabling

After a successful completion, the prompt is automatically disabled for the specified duration to prevent:

  • Accidental repeated activations

  • Input spam

  • Unintended behavior during animations or transitions

Frame-Perfect Control Handling

The system disables all control actions for one frame after prompt completion, ensuring:

  • Clean state transitions

  • Prevention of input conflicts

  • Proper prompt deactivation

State Validation

Multiple checks ensure the prompt is in the correct state:

  • Verifies hold mode completion

  • Checks if prompt is enabled

  • Waits one tick for proper state synchronization

Best Practices

1. Use Appropriate Disable Durations

2. Combine with Scheduler

3. Handle Multiple States

Technical Notes

  • The method includes a Wait(0) to ensure proper tick synchronization

  • All control actions are disabled for exactly one frame after completion

  • The prompt is temporarily disabled and automatically re-enabled

  • Compatible with all PromptBuilder-created prompts in hold mode

  • Thread-safe for use in multiple concurrent game loops

Last updated