startLoadingScreen: Difference between revisions
Jump to navigation
Jump to search
m (Fix example with 'sleep' instead of 'uiSleep' (freeze in SP)) |
Lou Montana (talk | contribs) (Fix description, Add BIS_fnc_startLoadingScreen link) |
||
Line 9: | Line 9: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Shows loading screen with the given text, using the given resource. While loading screen is shown, simulation and scene drawing is disabled, user control is disabled, mouse cursor is hidden, scripts run at full speed (50ms per frame instead of 3ms per frame for [[Scheduler|Scheduled Scripts]]). | | Shows loading screen with the given text, using the given resource. While loading screen is shown, simulation and scene drawing is disabled, user control is disabled, mouse cursor is hidden, scripts run at full speed (50ms per frame instead of 3ms per frame for [[Scheduler|Scheduled Scripts]]).<br> | ||
By default | {{Informative | | ||
* idc {{=}} 101 | By default, [[startLoadingScreen]] will use "RscDisplayNotFreeze" resource.<br> | ||
* idc {{=}} 103 | A custom resource can be defined in [[Description.ext]], and a full black background will be used by default - the following controls are supported by the engine: | ||
* idc {{=}} 104 | * idc {{=}} 101 - text (type {{=}} 0) or picture (type {{=}} 48). The text will be set to the value provided by the command argument. | ||
* idc {{=}} 103 - progress (type {{=}} 8) or animated texture (type {{=}} 45). This control indicates global hardcoded mission loading progress and is useless after the mission is loaded. | |||
* idc {{=}} 104 - progress (type {{=}} 8). This control's progress is initially set to 0 and can be manipulated with [[progressLoadingScreen]] command. | |||
Resource can be defined in [[Description.ext]]; it must NOT be defined as <tt>RscTitles</tt>! | |||
Resource | |||
<syntaxhighlight lang="cpp"></syntaxhighlight> | <syntaxhighlight lang="cpp"></syntaxhighlight> | ||
<spoiler> | <spoiler text="See config example"> | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
// | // basic defines - pre "import" keyword in v2.02 | ||
class RscText | class RscText | ||
{ | { | ||
Line 83: | Line 34: | ||
font = Zeppelin32; | font = Zeppelin32; | ||
SizeEx = 0.03921; | SizeEx = 0.03921; | ||
colorText[] = {1,1,1,1}; | colorText[] = { 1, 1, 1, 1 }; | ||
colorBackground[] = {0, 0, 0, 0}; | colorBackground[] = { 0, 0, 0, 0 }; | ||
linespacing = 1; | linespacing = 1; | ||
}; | }; | ||
class RscPicture | class RscPicture | ||
{ | { | ||
access=0; | access = 0; | ||
type=0; | type = 0; | ||
idc=-1; | idc = -1; | ||
style=48; | style = 48; | ||
colorBackground[]={0,0,0,0}; | colorBackground[] = { 0, 0, 0, 0 }; | ||
colorText[]={1,1,1,1}; | colorText[] = { 1, 1, 1, 1 }; | ||
font="TahomaB"; | font = "TahomaB"; | ||
sizeEx=0; | sizeEx = 0; | ||
lineSpacing=0; | lineSpacing = 0; | ||
text=""; | text = ""; | ||
}; | }; | ||
class RscLoadingText : RscText | class RscLoadingText : RscText | ||
Line 108: | Line 59: | ||
h = 0.039216; | h = 0.039216; | ||
sizeEx = 0.03921; | sizeEx = 0.03921; | ||
colorText[] = {0.543,0.5742,0.4102,1.0}; | colorText[] = { 0.543, 0.5742, 0.4102, 1.0 }; | ||
}; | }; | ||
class RscProgress | class RscProgress | ||
Line 117: | Line 68: | ||
h = 0.0261438; | h = 0.0261438; | ||
texture = "\ca\ui\data\loadscreen_progressbar_ca.paa"; | texture = "\ca\ui\data\loadscreen_progressbar_ca.paa"; | ||
colorFrame[] = {0,0,0,0}; | colorFrame[] = { 0, 0, 0, 0 }; | ||
colorBar[] = {1,1,1,1}; | colorBar[] = { 1, 1, 1, 1 }; | ||
}; | }; | ||
class RscProgressNotFreeze | class RscProgressNotFreeze | ||
Line 131: | Line 82: | ||
texture = "#(argb,8,8,3)color(0,0,0,0)"; | texture = "#(argb,8,8,3)color(0,0,0,0)"; | ||
}; | }; | ||
// | // end of basic defines | ||
class WIKI_loadingScreen | |||
class | |||
{ | { | ||
idd = -1; | idd = -1; | ||
Line 143: | Line 93: | ||
class controlsBackground | class controlsBackground | ||
{ | { | ||
class | class blueBackground : RscText // covers the black screen | ||
{ | { | ||
x = | x = safezoneXAbs; | ||
y = safezoneY; | y = safezoneY; | ||
w = | w = safezoneWAbs; | ||
h = safezoneH; | h = safezoneH; | ||
text = ""; | text = ""; | ||
colorText[] = {0,0,0,0}; | colorText[] = { 0, 0, 0, 0 }; | ||
colorBackground[] = {0,0, | colorBackground[] = { 0, 0, 1, 1 }; | ||
}; | }; | ||
class nicePic : RscPicture | class nicePic : RscPicture | ||
{ | { | ||
style = 48 + 0x800; // | style = 48 + 0x800; // ST_PICTURE + ST_KEEP_ASPECT_RATIO | ||
x = safezoneX + safezoneW/2 - 0.25; | x = safezoneX + safezoneW/2 - 0.25; | ||
y = safezoneY + safezoneH/2 - 0.2; | y = safezoneY + safezoneH/2 - 0.2; | ||
Line 167: | Line 117: | ||
class Title1 : RscLoadingText | class Title1 : RscLoadingText | ||
{ | { | ||
text = "$STR_LOADING"; // | text = "$STR_LOADING"; // "Loading" text in the middle of the screen | ||
}; | }; | ||
class CA_Progress : RscProgress // | class CA_Progress : RscProgress // progress bar, has to have idc 104 | ||
{ | { | ||
idc = 104; | idc = 104; | ||
type = 8; // | type = 8; // CT_PROGRESS | ||
style = 0; // | style = 0; // ST_SINGLE | ||
texture = "\ca\ui\data\loadscreen_progressbar_ca.paa"; | texture = "\ca\ui\data\loadscreen_progressbar_ca.paa"; | ||
}; | }; | ||
class CA_Progress2 : RscProgressNotFreeze // | class CA_Progress2 : RscProgressNotFreeze // progress bar that will go reverse | ||
{ | { | ||
idc = 103; | idc = 103; | ||
}; | }; | ||
class Name2: RscText // | class Name2: RscText // the text on the top-left | ||
{ | { | ||
idc = 101; | idc = 101; | ||
Line 189: | Line 139: | ||
text = ""; | text = ""; | ||
sizeEx = 0.05; | sizeEx = 0.05; | ||
colorText[] = {0.543,0.5742,0.4102,1.0}; | colorText[] = { 0.543, 0.5742, 0.4102, 1.0 }; | ||
}; | }; | ||
}; | }; | ||
Line 195: | Line 145: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</spoiler> | </spoiler> | ||
</ | }} | ||
{{Warning | | |||
* The loading screen does '''not''' end by itself and absolutely needs a call to [[endLoadingScreen]] command | |||
* Game simulation is disabled during Loading Screen operation (at least in single player): | |||
** be sure '''not''' to put any [[sleep]] command between [[startLoadingScreen]] and [[endLoadingScreen]]! | |||
** [[uiSleep]] can be used instead of [[sleep]] | |||
** [[waitUntil]] ''can'' be used to wait for variable initialisation or script loading | |||
}} | |||
{{Feature arma3 | Use [[BIS_fnc_startLoadingScreen]] to prevent potential usage conflicts.}} |DESCRIPTION= | |||
____________________________________________________________________________________________ | |||
| [[startLoadingScreen]] [text, resource] |SYNTAX= | |||
|p1= text: [[String]] |PARAMETER1= | |||
|p2= resource (Optional): [[String]] |PARAMETER2= | |||
| [[Nothing]] |RETURNVALUE= | |||
|x1= <code>[[startLoadingScreen]] ["Loading My Mission, please wait..."];</code>|EXAMPLE1= | |||
|x2= <code>[[startLoadingScreen]] ["Can't skip loading time...", "MyLoadingRsc"];</code>|EXAMPLE2= | |||
|x3= <code>[[startLoadingScreen]] ["Loading My Mission"]; | |||
{{cc|code}} | |||
[[progressLoadingScreen]] 0.5; | |||
{{cc|code}} | |||
[[endLoadingScreen]];</code>|EXAMPLE3= | |||
|x4= <code>{{cc|this structure prevents error-prone or lengthy code to miss [[endLoadingScreen]].}} | |||
[[private]] _maxTime = [[diag_tickTime]] + 30; {{cc|max 30s of loading}} | |||
[[startLoadingScreen]] ["Loading"]; | |||
[[private]] _handle = [] [[spawn]] { | |||
{{cc|code that may crash or take too long}} | |||
}; | |||
[[waitUntil]] { [[uiSleep]] .1; [[scriptDone]] _handle {{!}}{{!}} [[diag_tickTime]] > _maxTime }; | |||
</ | [[endLoadingScreen]];</code> |EXAMPLE4= | ||
____________________________________________________________________________________________ | |||
| [[endLoadingScreen]], [[progressLoadingScreen]], [[BIS_fnc_startLoadingScreen]], [[import]] |SEEALSO= | |||
}} | |||
<h3 style='display:none'>Notes</h3> | |||
<dl class='command_description'> | |||
<!-- Note Section BEGIN --> | |||
<dd class="notedate">Posted on November 21, 2015 - 18:38 (UTC)</dd> | <dd class="notedate">Posted on November 21, 2015 - 18:38 (UTC)</dd> | ||
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt> | <dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt> | ||
<dd class="note"> | <dd class="note"> | ||
The default {{arma3}} loading screen has no control to display text. | |||
</dd> | </dd> | ||
<!-- Note Section END --> | |||
</dl> | </dl> | ||
< | |||
<h3 style='display:none'>Bottom Section</h3> | |||
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | |||
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]] |
Revision as of 12:26, 11 December 2020
Description
- Description:
- Shows loading screen with the given text, using the given resource. While loading screen is shown, simulation and scene drawing is disabled, user control is disabled, mouse cursor is hidden, scripts run at full speed (50ms per frame instead of 3ms per frame for Scheduled Scripts).
- Groups:
- System
Syntax
- Syntax:
- startLoadingScreen [text, resource]
- Parameters:
- text: String
- resource (Optional): String
- Return Value:
- Nothing
Examples
- Example 1:
startLoadingScreen ["Loading My Mission, please wait..."];
- Example 2:
startLoadingScreen ["Can't skip loading time...", "MyLoadingRsc"];
- Example 3:
startLoadingScreen ["Loading My Mission"]; // code progressLoadingScreen 0.5; // code endLoadingScreen;
- Example 4:
// this structure prevents error-prone or lengthy code to miss endLoadingScreen. private _maxTime = diag_tickTime + 30; // max 30s of loading startLoadingScreen ["Loading"]; private _handle = [] spawn { // code that may crash or take too long }; waitUntil { uiSleep .1; scriptDone _handle || diag_tickTime > _maxTime }; endLoadingScreen;
Additional Information
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
Notes
- Posted on November 21, 2015 - 18:38 (UTC)
- Killzone Kid
- The default Arma 3 loading screen has no control to display text.