Engine icon indicating copy to clipboard operation
Engine copied to clipboard

Feature: Player text input receiver

Open HugoBDesigner opened this issue 3 months ago • 0 comments

Which component should be improved?

Other

Describe your feature suggestion in more detail

There could be a scripting bind (or entity) that directly prompts the player for text input. Similar to text chats, it'd let the player write anything they wanted, then "send" via a dedicated key (enter by default). The player's input could be exposed via a dedicated text input window, or it could be custom-made by the mapper/modder.

Some examples of applications:

  • The player could interact with a computer terminal and write "commands" to access files and terminals;
  • The player could "chat" with NPCs and bots in specific events;
  • The player could input a "password" in a door terminal;
  • A new puzzle mechanic that involves "summoning" objects via words.

The simplest and most direct implementation I can think of: a new entity (something like game_input) or an extension of game_ui. It'd have an input to trigger the input receiving (StartInput), one to cancel input (StopInput), and an output for confirmed input (OnInputConfirmed) and one for cancelled input (OnInputCancelled).

Alternatively, it could be triggerable via VScript through a special bind (something like GetPlayer().StartInput()), and the player input could be received through an event, a global variable, or checked through a function (like GetPlayer().IsInputting()).

The actual interface could be made by recycling the co-op chat box. But for the purposes described above, it could simply not exist. The mapper would have to directly update an existing script or entity to display the player's input – for example, through Panorama world panels, or point_worldtext.

Bonus features that would be nice to have:

  • Character filter, so the player can input only specific characters – for example, exclusively letters, or exclusively numbers;
  • Character limit, so the player can only write a specific number of characters;
  • Customizable input confirmation key (could even offer preset keys, like enter, space, escape, tab, etc.);
  • Customizable input cancellation key (escape by default);
  • Allow for input cancellation (if true, the player cancels the input when pressing escape; otherwise, the game just pauses);
  • Lock player camera (if true, the player won't be able to look around; if false, they can look around, but still not move).

HugoBDesigner avatar Sep 14 '25 18:09 HugoBDesigner