disableUserInput: Difference between revisions

From Bohemia Interactive Community
No edit summary
m (Some wiki formatting)
 
(83 intermediate revisions by 14 users not shown)
Line 1: Line 1:
[[Category:Scripting Commands|D]]
{{RV|type=command
[[Category:Scripting Commands OFP 1.97|D]]
[[Category:Scripting Commands OFP 1.46|D]]
[[Category:Scripting Commands ArmA|D]]


back to [[Scripting_Reference#D|COMREF]]
|game1= ofp
|version1= 1.00


<h2 style="color:#000066">'''disableUserInput ''disable'''''</h2>
|game2= ofpe
|version2= 1.00


|game3= arma1
|version3= 1.00


'''Operand types:'''
|game4= arma2
|version4= 1.00


'''disable:''' [[Boolean]]
|game5= arma2oa
|version5= 1.50


'''Type of returned value:'''
|game6= tkoh
|version6= 1.00


[[Nothing]]
|game7= arma3
|version7= 0.50


'''Description:'''
|gr1= Interaction


Disable user input.
|eff= local


This is normally used in cutscenes to disable players controls.
|descr= Disables or enables the keyboard and mouse input. Usually used during cutscenes.{{Feature|warning|Be careful and responsible with the usage of this command. Once the user input is disabled, the only option left is to restart the game. Make sure you provide scripted mechanics to resolve this, should you need to disable user input for any reason.}}


|s1= [[disableUserInput]] state


'''Example:'''
|p1= state: [[Boolean]] - [[true]] to disable, [[false]] to enable


'''disableUserInput''' [[true]]
|r1= [[Nothing]]
 
|x1= <sqf>
disableUserInput true;
// cutscene
disableUserInput false;
</sqf>
 
|x2= Reset user input if a key was pressed:
<sqf>
disableUserInput true; // here e.g W was pressed
sleep 2; // the user releases keys
disableUserInput false; // the game considers W is still pressed as it did not listen to a "KeyUp" event
 
disableUserInput true;
disableUserInput false; // this resets released keys making the issue invisible
 
// this workaround does not fix the mouse input that may get stuck on [[disableUserInput]] call
</sqf>
 
|seealso= [[userInputDisabled]] [[enableSimulation]] [[enableSimulationGlobal]]
}}

Latest revision as of 16:35, 13 April 2025

Hover & click on the images for description

Description

Description:
Disables or enables the keyboard and mouse input. Usually used during cutscenes.
Be careful and responsible with the usage of this command. Once the user input is disabled, the only option left is to restart the game. Make sure you provide scripted mechanics to resolve this, should you need to disable user input for any reason.
Groups:
Interaction

Syntax

Syntax:
disableUserInput state
Parameters:
state: Boolean - true to disable, false to enable
Return Value:
Nothing

Examples

Example 1:
disableUserInput true; // cutscene disableUserInput false;
Example 2:
Reset user input if a key was pressed:
disableUserInput true; // here e.g W was pressed sleep 2; // the user releases keys disableUserInput false; // the game considers W is still pressed as it did not listen to a "KeyUp" event disableUserInput true; disableUserInput false; // this resets released keys making the issue invisible // this workaround does not fix the mouse input that may get stuck on disableUserInput call

Additional Information

See also:
userInputDisabled enableSimulation enableSimulationGlobal

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note