Difference between revisions of "VN fnc holdActionAdd"

From Savage Game Design Wiki
Jump to navigation Jump to search
m (Text replacement - " |e=" to " |a= |e=")
m (Text replacement - "call VN_" to "call [[VN_")
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
 
{{Function
 
{{Function
  
 
|v= 1.00
 
|v= 1.00
  
|author= Jiri Wainar
+
|author= Jiri Wainar, edited by Ethan Johnson
  
|a=
+
|a= global
  
|e=
+
|e= local
  
 
|g1= vn_hold_functions
 
|g1= vn_hold_functions
  
|d= <pre>/*
+
|d= Add a hold action. If the hold actions are not initialized yet, initialize the system first. See {{Biki|BIS_fnc_holdActionAdd}}.
Original Author: Jiri Wainar
+
 
Edit Author: Ethan Johnson
+
|s= [target, title, iconIdle, iconProgress, condShow, condProgress, codeStart, codeProgress, codeCompleted, codeInterrupted, arguments, duration, priority, removeCompleted, showUnconscious, showWindow] call [[VN_fnc_holdActionAdd]]
 +
 
 +
|p1n= target
 +
|p1t= object
 +
|p1d= object action is attached to
 +
|p1v= {{Biki|objNull}}
 +
 
 +
|p2n= title
 +
|p2t= string
 +
|p2d= action title text shown in action menu
 +
|p2v= "MISSING TITLE"
 +
 
 +
|p3n= iconIdle
 +
|p3t= {{Biki|String}} or {{Biki|Code}}
 +
|p3d= idle icon shown on screen; if {{Biki|Code}} is used, it needs to return the path to icon
 +
|p3v= "\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa"
 +
 
 +
|p4n= iconProgress
 +
|p4t= {{Biki|String}} or {{Biki|Code}}
 +
|p4d= progress icon shown on screen; if {{Biki|Code}} is used, it needs to return the path to icon
 +
|p4v= "\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa"
 +
 
 +
|p5n= condShow
 +
|p5t= string
 +
|p5d= condition for the action to be shown; special variables passed to the script code are <tt>_target</tt> (unit to which action is attached to) and <tt>_this</tt> (caller/executing unit)
 +
|p5v= "true"
 +
 
 +
|p6n= condProgress
 +
|p6t= string
 +
|p6d= condition for the action to progress; if {{Biki|false}} is returned action progress is halted; arguments passed into it are: <tt>_target</tt>, <tt>_caller</tt>, <tt>_id</tt> and <tt>_arguments</tt>
 +
|p6v= "true"
 +
 
 +
|p7n= codeStart
 +
|p7t= code
 +
|p7d= code executed on start; arguments passed ''via'' the <tt>_this</tt> variable are <tt>[target, caller, ID, arguments]</tt>:
 +
* target: {{Biki|Object}} - (_this select 0) the object which the action is assigned to
 +
* caller: {{Biki|Object}} - (_this select 1) the unit that activated the action
 +
* id: {{Biki|Number}} - (_this select 2) id of the activated action (same as ID returned by {{Biki|addAction}})
 +
* arguments: {{Biki|Array}} - (_this select 3) - arguments given to the script if the extended syntax is used
 +
|p7v= {}
 +
 
 +
|p8n= codeProgress
 +
|p8t= code
 +
|p8d= code executed on every progress tick; arguments <tt>[target, caller, ID, arguments, currentProgress]</tt>; max progress is always 24
 +
|p8v= {}
  
Description:
+
|p9n= codeCompleted
Add a hold action. If the hold actions are not initialized yet, initialize the system first.
+
|p9t= code
 +
|p9d= code executed on completion; arguments <tt>[target, caller, ID, arguments]</tt>
 +
|p9v= {}
  
Parameters:
+
|p10n= codeInterrupted
0: OBJECT - object action is attached to
+
|p10t= code
1: STRING - action title text shown in action menu
+
|p10d= code executed on interrupted; arguments <tt>[target, caller, ID, arguments]</tt>
2: STRING or CODE - idle icon shown on screen; if CODE is used the code needs to return the path to icon
+
|p10v= {}
3: STRING or CODE - progress icon shown on screen; if CODE is used the code needs to return the path to icon
 
4: STRING - condition for the action to be shown; special variables passed to the script code are _target (unit to which action is attached to) and _this (caller/executing unit)
 
5: STRING - condition for action to progress; if false is returned action progress is halted; arguments passed into it are: _target, _caller, _id, _arguments
 
6: CODE - code executed on start; arguments passed into it are [target, caller, ID, arguments]
 
0: OBJECT - target (_this select 0) - the object which the action is assigned to
 
1: OBJECT - caller (_this select 1) - the unit that activated the action
 
2: NUMBER - ID (_this select 2) - ID of the activated action (same as ID returned by addAction)
 
3: ARRAY - arguments (_this select 3) - arguments given to the script if you are using the extended syntax
 
7: CODE - code executed on every progress tick; arguments [target, caller, ID, arguments, currentProgress]; max progress is always 24
 
8: CODE - code executed on completion; arguments [target, caller, ID, arguments]
 
9: CODE - code executed on interrupted; arguments [target, caller, ID, arguments]
 
10: ARRAY - arguments passed to the scripts
 
11: NUMBER - action duration; how much time it takes to complete the action
 
12: NUMBER - priority; actions are arranged in descending order according to this value
 
13: BOOL - remove on completion (default: true)
 
14: BOOL - show in unconscious state (default: false)
 
15: BOOL - show on screen; if false action needs to be selected from action menu to appear on screen (default: true)
 
  
Example:
+
|p11n= arguments
[_target,_title,_iconIdle,_iconProgress,_condShow,_condProgress,_codeStart,_codeProgress,_codeCompleted,_codeInterrupted,_arguments,_duration,_priority,_removeCompleted,_showUnconscious] call bis_fnc_holdActionAdd;
+
|p11t= array
 +
|p11d= arguments passed to the scripts
 +
|p11v= []
  
Returns:
+
|p12n= duration
Action ID, can be used for removal or referencing from other functions.
+
|p12t= number
*/
+
|p12d= action duration; how much time it takes to complete the action
 +
|p12v= 10
  
params
+
|p13n= priority
[
+
|p13t= number
["_target",objNull,[objNull]],
+
|p13d= actions are arranged in descending order according to this value
["_title","MISSING TITLE",[""]],
+
|p13v= 1000
["_iconIdle","\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa",["",{}]],
 
["_iconProgress","\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa",["",{}]],
 
["_condShow","true",[""]],
 
["_condProgress","true",[""]],
 
["_codeStart",{},[{}]],
 
["_codeProgress",{},[{}]],
 
["_codeCompleted",{},[{}]],
 
["_codeInterrupted",{},[{}]],
 
["_arguments",[],[[]]],
 
["_duration",10,[123]],
 
["_priority",1000,[123]],
 
["_removeCompleted",true,[true]],
 
["_showUnconscious",false,[true]],
 
["_showWindow",true,[true]]
 
</pre><small>''(Placeholder description extracted from the function header by '''LM_exportFunctionsToWiki.sqf''')''</small>
 
  
|s= [] call [[VN_fnc_holdActionAdd]];
+
|p14n= removeCompleted
 +
|p14t= boolean
 +
|p14d= remove on completion
 +
|p14v= {{Biki|true}}
  
|p1n=
+
|p15n= showUnconscious
|p1t=
+
|p15t= boolean
|p1d=
+
|p15d= show in unconscious state
|p1v=
+
|p15v= {{Biki|false}}
  
|p2n=
+
|p16n= showWindow
|p2t=
+
|p16t= boolean
|p2d=
+
|p16d= show on screen; if false action needs to be selected from action menu to appear on screen
|p2v=
+
|p16v= {{Biki|true}}
  
|r1t=
+
|r1t= number
|r1d=
+
|r1d= action id that can be used for removal or referencing from other functions
  
|x1= <code>-</code>
+
|x1= <code>[
 +
player,
 +
"Don't hold this action!",
 +
nil,
 +
nil,
 +
nil,
 +
nil,
 +
"hint 'please don't...",
 +
nil,
 +
{ hint 'I -told- you!'; player setDamage 1 },
 +
{ hint "phew, you didn't."; (_this select 0) removeAction (_this select 2) },
 +
nil,
 +
6
 +
] call [[VN_fnc_holdActionAdd
 +
</code>
 
}}
 
}}

Latest revision as of 09:14, 27 February 2021

{{Function

|v= 1.00

|author= Jiri Wainar, edited by Ethan Johnson

|a= global

|e= local

|g1= vn_hold_functions

|d= Add a hold action. If the hold actions are not initialized yet, initialize the system first. See BIS_fnc_holdActionAdd.

|s= [target, title, iconIdle, iconProgress, condShow, condProgress, codeStart, codeProgress, codeCompleted, codeInterrupted, arguments, duration, priority, removeCompleted, showUnconscious, showWindow] call VN_fnc_holdActionAdd

|p1n= target |p1t= object |p1d= object action is attached to |p1v= objNull

|p2n= title |p2t= string |p2d= action title text shown in action menu |p2v= "MISSING TITLE"

|p3n= iconIdle |p3t= String or Code |p3d= idle icon shown on screen; if Code is used, it needs to return the path to icon |p3v= "\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa"

|p4n= iconProgress |p4t= String or Code |p4d= progress icon shown on screen; if Code is used, it needs to return the path to icon |p4v= "\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa"

|p5n= condShow |p5t= string |p5d= condition for the action to be shown; special variables passed to the script code are _target (unit to which action is attached to) and _this (caller/executing unit) |p5v= "true"

|p6n= condProgress |p6t= string |p6d= condition for the action to progress; if false is returned action progress is halted; arguments passed into it are: _target, _caller, _id and _arguments |p6v= "true"

|p7n= codeStart |p7t= code |p7d= code executed on start; arguments passed via the _this variable are [target, caller, ID, arguments]:

  • target: Object - (_this select 0) the object which the action is assigned to
  • caller: Object - (_this select 1) the unit that activated the action
  • id: Number - (_this select 2) id of the activated action (same as ID returned by addAction)
  • arguments: Array - (_this select 3) - arguments given to the script if the extended syntax is used

|p7v= {}

|p8n= codeProgress |p8t= code |p8d= code executed on every progress tick; arguments [target, caller, ID, arguments, currentProgress]; max progress is always 24 |p8v= {}

|p9n= codeCompleted |p9t= code |p9d= code executed on completion; arguments [target, caller, ID, arguments] |p9v= {}

|p10n= codeInterrupted |p10t= code |p10d= code executed on interrupted; arguments [target, caller, ID, arguments] |p10v= {}

|p11n= arguments |p11t= array |p11d= arguments passed to the scripts |p11v= []

|p12n= duration |p12t= number |p12d= action duration; how much time it takes to complete the action |p12v= 10

|p13n= priority |p13t= number |p13d= actions are arranged in descending order according to this value |p13v= 1000

|p14n= removeCompleted |p14t= boolean |p14d= remove on completion |p14v= true

|p15n= showUnconscious |p15t= boolean |p15d= show in unconscious state |p15v= false

|p16n= showWindow |p16t= boolean |p16d= show on screen; if false action needs to be selected from action menu to appear on screen |p16v= true

|r1t= number |r1d= action id that can be used for removal or referencing from other functions

|x1= [ player, "Don't hold this action!", nil, nil, nil, nil, "hint 'please don't...", nil, { hint 'I -told- you!'; player setDamage 1 }, { hint "phew, you didn't."; (_this select 0) removeAction (_this select 2) }, nil, 6 ] call [[VN_fnc_holdActionAdd }}