disableUserInput: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<sqf>([^↵][^<]*↵[^<]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(68 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| ofp |= Game name
|game1= ofp
|version1= 1.00


|1.00|= Game version
|game2= ofpe
|version2= 1.00


|eff= local |= Effects in MP
|game3= arma1
____________________________________________________________________________________________
|version3= 1.00


| Disable and enable the keyboard and mouse input, usually used during cutscenes.
|game4= arma2
|version4= 1.00


Be careful with the usage of this command, always remember to enable the user input again, as once the user input is disabled, you can only shut down OFP but not exit the mission with escape |= Description
|game5= arma2oa
____________________________________________________________________________________________
|version5= 1.50


| '''disableUserInput''' state |= Syntax
|game6= tkoh
|version6= 1.00


|p1= state: [[Boolean]] |= Parameter 1
|game7= arma3
|version7= 0.50


| [[Nothing]] |= Return value
|gr1= Interaction
____________________________________________________________________________________________
 
|x1= <pre>disableUserInput true
; cutscene


disableUserInput false</pre> |= Example 1
|eff= local
____________________________________________________________________________________________


| |= See also
|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
|p1= state: [[Boolean]] - [[true]] to disable, [[false]] to enable
|r1= [[Nothing]]
|x1= <sqf>
disableUserInput true;
// cutscene
disableUserInput false;
</sqf>
|seealso= [[userInputDisabled]] [[enableSimulation]] [[enableSimulationGlobal]]
}}
}}


<h3 style="display:none">Notes</h3>
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
 
<!-- Note Section END -->
<dt></dt>
<dd class="notedate">Posted on 14 March 2014</dd>
<dt class="note">[[User:Killzone_Kid|Killzone_Kid]]</dt>
<dd class="note">
Sometimes, when [[disableUserInput]] [[true]] command is invoked while the user is holding a button, when [[disableUserInput]] [[false]] is called and the user is no longer holding the button, the input will resume as if the user is still holding the button. To reset this behaviour, disable and enable user input again in the same frame:
<sqf>
disableUserInput true;
//do something
disableUserInput false;
disableUserInput true;
disableUserInput false;
</sqf>
Unfortunately, if the user is moving mouse when [[disableUserInput]] [[true]] command is invoked, the mouse input will get stuck for the whole duration of disabled user input but will reset as soon as [[disableUserInput]] [[false]] is called. I was unable to find workaround for this one.
<br><br>
UPDATE: There is now [[userInputDisabled]] command, which allows one to check if user input is still disabled after enabling it, so that one can retry until enabling is successful.
</dl>
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|DISABLEUSERINPUT]]
[[Category:Scripting Commands OFP 1.96|DISABLEUSERINPUT]]
[[Category:Scripting Commands OFP 1.46|DISABLEUSERINPUT]]
[[Category:Scripting Commands ArmA|DISABLEUSERINPUT]]
[[Category:Command_Group:_GUI_Control|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Interaction|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]

Latest revision as of 19:42, 3 September 2024

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;

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
Posted on 14 March 2014
Killzone_Kid
Sometimes, when disableUserInput true command is invoked while the user is holding a button, when disableUserInput false is called and the user is no longer holding the button, the input will resume as if the user is still holding the button. To reset this behaviour, disable and enable user input again in the same frame:
disableUserInput true; //do something disableUserInput false; disableUserInput true; disableUserInput false;
Unfortunately, if the user is moving mouse when disableUserInput true command is invoked, the mouse input will get stuck for the whole duration of disabled user input but will reset as soon as disableUserInput false is called. I was unable to find workaround for this one.

UPDATE: There is now userInputDisabled command, which allows one to check if user input is still disabled after enabling it, so that one can retry until enabling is successful.