cutRsc: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "Samatra" to "Sa-Matra")
 
(112 intermediate revisions by 16 users not shown)
Line 1: Line 1:
[[Category:Scripting Commands|CUTRSC]]
{{RV|type=command
[[Category:Scripting Commands OFP 1.97|CUTRSC]]
[[Category:Scripting Commands OFP 1.46|CUTRSC]]
[[Category:Scripting Commands ArmA|CUTRSC]]


|game1= ofp
|version1= 1.00


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


|game3= arma1
|version3= 1.00


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


'''effect:''' [[Array]]
|game5= arma2oa
|version5= 1.50


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


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


'''Description:'''
|eff= local


Resource background - arguments in format '''''["name", "type", speed]''''' or '''''["name", "type"]'''''.<br>
|gr1= GUI Control


If speed is not given, 1 is assumed.<br>
|descr= Display a resource defined in RscTitles of the mission's [[Description.ext]], the campaign's description.ext or the global config.
{{Feature|arma3|For greater efficiency and ease of modability, it is recommended to use named layers available with [[String]] and {{Link|#Syntax 2}}.}}
{{Feature|important|To avoid conflicts with existing layers it is recommended to register a layer with [[BIS_fnc_rscLayer]] and to start the name with a TAG:
<sqf>
("TAG_myLayer" call BIS_fnc_rscLayer) cutRsc ["myRsc", "PLAIN"];
"TAG_myLayer" cutRsc ["myRsc", "PLAIN"];</sqf>
}}


Resource can be defined in [[Description.ext|description.ext]].
|s1= [[cutRsc]] [class, effect, speed, showInMap, drawOverHUD]


Also see [[titleRsc]], with these two commands you can show two different resources at once.
|p1= class: [[String]] - the class name of the resource. ("Default" will remove the current resource.)


|p2= effect: [[String]] - one of "PLAIN", "PLAIN DOWN", "BLACK", "BLACK FADED", "BLACK OUT", "BLACK IN", "WHITE OUT" and "WHITE IN". See [[Title Effect Type]]s for more information about these values.


'''Example:'''
|p3= speed: [[Number]] - (Optional, default -1) time in seconds to fade in resource.


'''cutRsc''' ["binocular", "PLAIN"]<br>
|p4= showInMap: [[Boolean]] - (Optional, default [[true]]) [[false]] to hide the text when the map is opened.
'''cutRsc''' ["binocular", "PLAIN", 10]
 
|p5= drawOverHUD: [[Boolean]] - (Optional, default [[true]]) [[false]] to show the resource under in-game HUD
|p5since= arma3 2.16
 
|r1= [[Nothing]]
 
|s2= layer [[cutRsc]] [class, effect, speed, showInMap, drawOverHUD]
 
|p21= layer: [[Number]] or [[String]]
* [[Number]] - layer number on which the effect is shown, where 0 is the back most. Layer number is rounded to the nearest integer and also cannot be negative. Layer 99.5 will be treated as layer 100
* [[String]] - {{GVI|arma3|1.58|size= 0.75}} layer name on which the effect is shown. Layer names are '''CaSe SeNsItIvE'''.
 
|p22= class: [[String]] - the class name of the resource. ("Default" will remove the current resource.)
 
|p23= effect: [[String]] - one of "PLAIN", "PLAIN DOWN", "BLACK", "BLACK FADED", "BLACK OUT", "BLACK IN", "WHITE OUT" and "WHITE IN". See [[Title Effect Type]]s for more information about these values.
 
|p24= speed: [[Number]] - (Optional, default -1) time in seconds to fade in resource.
 
|p25= showInMap: [[Boolean]] - (Optional, default [[true]]) [[false]] to hide the text when the map is opened.
 
|p26= drawOverHUD: [[Boolean]] - (Optional, default [[true]]) [[false]] to show the resource under in-game HUD
|p26since= arma3 2.16
 
|r2= [[Nothing]]
 
|x1= <sqf>
cutRsc ["binocular", "PLAIN"];
cutRsc ["binocular", "PLAIN", 2];
cutRsc ["binocular", "PLAIN", 2, false];
</sqf>
 
|x2= <sqf>2 cutRsc ["binocular", "PLAIN", 2];</sqf>
 
|x3= <sqf>_layer = "layer1" cutRsc ["binocular", "PLAIN", 2];</sqf>
 
|x4= <sqf>
// create IGUI display
// such display can be closed with closeDisplay command or by overwriting the same cut layer with another output.
// note that "Unload" EH for some reason does not work with such display.
"someLayer" cutRsc ["RscTitleDisplayEmpty", "PLAIN"];
private _display = uiNamespace getVariable "RscTitleDisplayEmpty";
</sqf>
 
|seealso= [[allCutLayers]] [[titleRsc]] [[cutText]] [[cutObj]] [[cutFadeOut]] [[setTitleEffect]] [[allActiveTitleEffects]] [[activeTitleEffectParams]]
}}
 
{{Note
|user= Dr_Eyeball
|timestamp= 20080630084400
|text= Using [[cutRsc]] (instead of [[titleRsc]]) for a HUD has the benefits of:
* having the HUD automatically hide itself when you access the map and redisplay itself after closing the map.
* using the 'Direct communication' chat channel messages will not interfere with the HUD by hiding it.
}}
 
{{Note
|user= Killzone_Kid
|timestamp= 20131017163000
|text= Regarding removing current resource with [[cutRsc]] ["Default", "PLAIN"]. If it does't work and it gives you error message that "Default" is not found, add it by yourself to RscTitles in [[Description.ext|description.ext]] so it looks like this:
<syntaxhighlight lang="cpp">
class RscTitles
{
class Default
{
idd = -1;
fadein = 0;
fadeout = 0;
duration = 0;
};
};
</syntaxhighlight>
 
Alternatively, you can use cutText, yes [[cutText]] command to cancel your resources. As Karel Moricky explains: "All 'cut' commands are in the same layer, the same as all 'title' commands are in another one." So to remove cutRsc resource execute cutText on the same layer:
 
<sqf>
cutRsc ["myRsc", "PLAIN"]; // show
cutText ["", "PLAIN"]; // remove
</sqf>
 
<sqf>
10 cutRsc ["myRsc", "PLAIN"]; // show
10 cutText ["", "PLAIN"]; // remove
</sqf>
 
Also if you use layers would be a good idea to register them with [[BIS_fnc_rscLayer]] to avoid possible clashes with other layers:
<sqf>
("myLayerName" call BIS_fnc_rscLayer) cutRsc ["myRsc", "PLAIN"]; // show
("myLayerName" call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; // remove
</sqf>
 
You can also immediately remove resource with [[cutFadeOut]] command:<sqf>123 cutFadeOut 0;</sqf>
}}
 
{{Note
|user= Sa-Matra
|timestamp= 20230413081935
|text= Layer display time seems to be display's "duration" parameter divided by "speed" provided into this command, which also acts as effect time. So to make sure your display doesn't close after a bit, have your ""duration"" at a very high number like <sqf inline>duration = 1e11;</sqf>
}}

Latest revision as of 20:58, 4 July 2024

Hover & click on the images for description

Description

Description:
Display a resource defined in RscTitles of the mission's Description.ext, the campaign's description.ext or the global config.
Arma 3
For greater efficiency and ease of modability, it is recommended to use named layers available with String and Syntax 2.
To avoid conflicts with existing layers it is recommended to register a layer with BIS_fnc_rscLayer and to start the name with a TAG:
("TAG_myLayer" call BIS_fnc_rscLayer) cutRsc ["myRsc", "PLAIN"]; "TAG_myLayer" cutRsc ["myRsc", "PLAIN"];
Groups:
GUI Control

Syntax

Syntax:
cutRsc [class, effect, speed, showInMap, drawOverHUD]
Parameters:
class: String - the class name of the resource. ("Default" will remove the current resource.)
effect: String - one of "PLAIN", "PLAIN DOWN", "BLACK", "BLACK FADED", "BLACK OUT", "BLACK IN", "WHITE OUT" and "WHITE IN". See Title Effect Types for more information about these values.
speed: Number - (Optional, default -1) time in seconds to fade in resource.
showInMap: Boolean - (Optional, default true) false to hide the text when the map is opened.
since Arma 3 logo black.png2.16
drawOverHUD: Boolean - (Optional, default true) false to show the resource under in-game HUD
Return Value:
Nothing

Alternative Syntax

Syntax:
layer cutRsc [class, effect, speed, showInMap, drawOverHUD]
Parameters:
layer: Number or String
  • Number - layer number on which the effect is shown, where 0 is the back most. Layer number is rounded to the nearest integer and also cannot be negative. Layer 99.5 will be treated as layer 100
  • String - Arma 3 logo black.png1.58 layer name on which the effect is shown. Layer names are CaSe SeNsItIvE.
class: String - the class name of the resource. ("Default" will remove the current resource.)
effect: String - one of "PLAIN", "PLAIN DOWN", "BLACK", "BLACK FADED", "BLACK OUT", "BLACK IN", "WHITE OUT" and "WHITE IN". See Title Effect Types for more information about these values.
speed: Number - (Optional, default -1) time in seconds to fade in resource.
showInMap: Boolean - (Optional, default true) false to hide the text when the map is opened.
since Arma 3 logo black.png2.16
drawOverHUD: Boolean - (Optional, default true) false to show the resource under in-game HUD
Return Value:
Nothing

Examples

Example 1:
cutRsc ["binocular", "PLAIN"]; cutRsc ["binocular", "PLAIN", 2]; cutRsc ["binocular", "PLAIN", 2, false];
Example 2:
2 cutRsc ["binocular", "PLAIN", 2];
Example 3:
_layer = "layer1" cutRsc ["binocular", "PLAIN", 2];
Example 4:
// create IGUI display // such display can be closed with closeDisplay command or by overwriting the same cut layer with another output. // note that "Unload" EH for some reason does not work with such display. "someLayer" cutRsc ["RscTitleDisplayEmpty", "PLAIN"]; private _display = uiNamespace getVariable "RscTitleDisplayEmpty";

Additional Information

See also:
allCutLayers titleRsc cutText cutObj cutFadeOut setTitleEffect allActiveTitleEffects activeTitleEffectParams

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
Dr_Eyeball - c
Posted on Jun 30, 2008 - 08:44 (UTC)
Using cutRsc (instead of titleRsc) for a HUD has the benefits of:
  • having the HUD automatically hide itself when you access the map and redisplay itself after closing the map.
  • using the 'Direct communication' chat channel messages will not interfere with the HUD by hiding it.
Killzone_Kid - c
Posted on Oct 17, 2013 - 16:30 (UTC)
Regarding removing current resource with cutRsc ["Default", "PLAIN"]. If it does't work and it gives you error message that "Default" is not found, add it by yourself to RscTitles in description.ext so it looks like this:
class RscTitles
{
	class Default 
	{
		idd = -1;
		fadein = 0;
		fadeout = 0;
		duration = 0;
	};
};

Alternatively, you can use cutText, yes cutText command to cancel your resources. As Karel Moricky explains: "All 'cut' commands are in the same layer, the same as all 'title' commands are in another one." So to remove cutRsc resource execute cutText on the same layer:

cutRsc ["myRsc", "PLAIN"]; // show cutText ["", "PLAIN"]; // remove

10 cutRsc ["myRsc", "PLAIN"]; // show 10 cutText ["", "PLAIN"]; // remove

Also if you use layers would be a good idea to register them with BIS_fnc_rscLayer to avoid possible clashes with other layers:

("myLayerName" call BIS_fnc_rscLayer) cutRsc ["myRsc", "PLAIN"]; // show ("myLayerName" call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; // remove

You can also immediately remove resource with cutFadeOut command:

123 cutFadeOut 0;

Sa-Matra - c
Posted on Apr 13, 2023 - 08:19 (UTC)
Layer display time seems to be display's "duration" parameter divided by "speed" provided into this command, which also acts as effect time. So to make sure your display doesn't close after a bit, have your ""duration"" at a very high number like duration = 1e11;