BIS fnc deltaTime: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{Function|= Comments " to "{{Function|Comments= ")
(Page filling)
Line 1: Line 1:
{{Function|Comments=
{{Function|= Comments


| arma3 |Game name=
| arma3 |Game name=
Line 5: Line 5:
|1.00|Game version=
|1.00|Game version=


<!---|arg= local |Multiplayer Arguments=--->
| Calculates and returns the time's delta between previous and current call to this function.


<!---|eff= local |Multiplayer Effects=--->
{{Informative | This commands internally uses [[time]]. For accurate-critical time measurement, use [[diag_tickTime]].}} |Description=


| <pre>/*
| [id, clear] call [[BIS_fnc_deltaTime]] |Syntax=
Author: Nelson Duarte <@Nelson_G_Duarte>


Description:
|p1= id: [[String]] - (Optional, default "generic") used to not create conflicts between different systems calling this function, each system can calculate delta time since it last ticked. Will be a [[missionNamespace]] variable |Parameter 1=
Calculates and returns delta time


Parameter(s):
|p2= clear: [[Boolean]] - (Optional, default [[false]]) if set to [[true]], will delete the [[missionNamespace]] variable (defined by ''id'')
_this select 0: String - The id, used to not create conflicts between different systems calling this function, each system can calculate delta time since it last ticked
_this select 1: Bool - Whether to clear, if true it will return SMALL_NUMBER


Returns:
| [[Number]] - the delta time - 0.001 if ''clear'' is [[true]] |Return value=
The delta time
*/</pre>{{placeholder}}<!-- Remove this after fill-in --> |Description=


|[] call [[BIS_fnc_deltaTime]]|Syntax=
|x1= <code>["TAG_duration"] [[call]] [[BIS_fnc_deltaTime]]; {{cc|Defines the starting point}}
{{cc|...}}
[[private]] _duration1 = ["TAG_duration"] [[call]] [[BIS_fnc_deltaTime]]; {{cc|Gets time between starting point and now}}
{{cc|...}}
[[private]] _duration2 = ["TAG_duration"] [[call]] [[BIS_fnc_deltaTime]]; {{cc|Gets time between _duration1 and now}}
["TAG_duration", [[true]]] [[call]] [[BIS_fnc_deltaTime]]; {{cc|deletes the global variable "TAG_duration"}}</code> |Example 1=


|p1= parameter: Datatype - (Optional, default defValue) description |Parameter 1=
| [[diag_tickTime]] [[diag_deltaTime]] |See also=
 
|Datatype - description|Return value=
 
|x1= <code></code>|Example 1=
 
| |See also=
}}
}}


[[Category:Function Group: Math|{{uc:deltaTime}}]]
[[Category:Function Group: Math|{{uc:deltaTime}}]]
[[Category:Functions|{{uc:deltaTime}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:deltaTime}}]]

Revision as of 12:07, 26 June 2020

Hover & click on the images for description

Description

Description:
Calculates and returns the time's delta between previous and current call to this function.
This commands internally uses time. For accurate-critical time measurement, use diag_tickTime.
Execution:
call
Groups:
Uncategorised

Syntax

Syntax:
[id, clear] call BIS_fnc_deltaTime
Parameters:
id: String - (Optional, default "generic") used to not create conflicts between different systems calling this function, each system can calculate delta time since it last ticked. Will be a missionNamespace variable
clear: Boolean - (Optional, default false) if set to true, will delete the missionNamespace variable (defined by id)
Return Value:
Number - the delta time - 0.001 if clear is true

Examples

Example 1:
["TAG_duration"] call BIS_fnc_deltaTime; // Defines the starting point // ... private _duration1 = ["TAG_duration"] call BIS_fnc_deltaTime; // Gets time between starting point and now // ... private _duration2 = ["TAG_duration"] call BIS_fnc_deltaTime; // Gets time between _duration1 and now ["TAG_duration", true] call BIS_fnc_deltaTime; // deletes the global variable "TAG_duration"

Additional Information

See also:
diag_tickTime diag_deltaTime

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