---
name: "BIS_fnc_holdKey"
type: function
status: ok
groups: ["Interaction"]
arma3_since: "1.78"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_holdKey
revid: 341505
updated: 2023-06-05T20:02:15Z
---

# BIS_fnc_holdKey

*Function · Interaction · Arma 3 v1.78*

Locality: executed with **spawn**

## Description

Function that executes code when a key has been held down for a long enough time - "Hold X to Advance" text is displayed when any key is pressed.

All other keys (but <kbd>Esc</kbd>) are deactivated until the conditions are met - only mouse controls work (character rotation and fire).

## Syntax

```sqf
[display, key, time, code, control] call BIS_fnc_holdKey
```

**Parameters:**

- `display`: [Display](../topics/Display.md) - (Optional, default `findDisplay 12` for map display) display the event is attached to. By default it is the map display
- `key`: [Number](../topics/Number.md) - (Optional, default 57 for <kbd>Space</kbd>) what key to press - see DIK KeyCodes
- `time`: [Number](../topics/Number.md) - (Optional, default 3) how long the key has to be held down in seconds
- `code`: [Code](../topics/Code.md) - (Optional, default `{}`) [scheduled](../topics/Scheduler.md#scheduled-environment) code to be executed when key is held down for long enough
- `control`: [Control](../topics/Control.md) - (Optional, default [controlNull](../commands/controlNull.md)) text control to be used in place of the default "Press X to skip" control.

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
[findDisplay 46, 36, 5, { hint "Key 'J' pressed for 5 seconds" }] spawn BIS_fnc_holdKey; // action is added to the mission display
```

## See also

[BIS_fnc_holdActionAdd](../functions/BIS_fnc_holdActionAdd.md) · [addAction](../commands/addAction.md) · [BIS_fnc_keyHold](../functions/BIS_fnc_keyHold.md)

<sub>Source: [BI Community Wiki — BIS fnc holdKey](https://community.bistudio.com/wiki/BIS_fnc_holdKey) (revision 341505).</sub>
