Notification – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Created page with "Category:Arma_3:_Editing thumb|Notification preview In Arma 3, you can show mission or system notification using BIS_fnc_showNotification f...")
 
m (Example at beginning of page used wrong parameters, leading to the description staying empty and param being ignored)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Arma_3:_Editing]]
[[File:A3_notification.jpg|thumb|Notification preview]]
 
{{arma3}} allows to show mission or system notification using [[BIS_fnc_showNotification]] function:
<sqf>
["TaskSucceeded", ["", "Disable the nuke"]] call BIS_fnc_showNotification;
["ScoreAdded", ["", "Disabled the nuke without triggering an alarm.", 5]] call BIS_fnc_showNotification;
</sqf>
 
Instead of defining every single param over and over again in multiple missions, it is possible to reference a template defined in {{hl|CfgNotifications}} class either in [[Description.ext|mission]] / [[Campaign Description.ext|campaign]] ''Description.ext'' or in global ''config.cpp''.


[[File:A3_notification.jpg|thumb|Notification preview]]
{{Feature|informative|
[[BIS_fnc_showNotification]] only offers possibility to change:
* title
* description
* iconPicture
* iconText
* soundRadio
The rest is {{hl|CfgNotifications}}-dependent.
}}
 
<syntaxhighlight lang="cpp">
class CfgNotifications
{
class Default
{
title = ""; // Title displayed as text on black background. Filled by arguments.
iconPicture = ""; // Small icon displayed in left part. Colored by "color", filled by arguments.
iconText = ""; // Short text displayed over the icon. Colored by "color", filled by arguments.
description = ""; // Brief description displayed as structured text. Colored by "color", filled by arguments.
color[] = {1,1,1,1}; // Icon and text color
duration = 5; // How many seconds will the notification be displayed
priority = 0; // Priority; higher number = more important; tasks in queue are selected by priority
difficulty[] = {}; // Required difficulty settings. All listed difficulties has to be enabled
};
 
// Example 1
class TaskAssigned
{
title = "TASK ASSIGNED";
iconPicture = "\A3\ui_f\data\map\mapcontrol\taskIcon_ca.paa";
description = "%1";
priority = 7;
};
 
// Example 2
class ScoreAdded
{
title = "Score bonus";
iconText = "+%2";
description = "%1";
color[] = {0.5,1,1,1};
priority = 0;
difficulty[] = {"netStats"};
};
};
</syntaxhighlight>


In Arma 3, you can show mission or system notification using [[BIS_fnc_showNotification]] function.
{{GVI|arma3|2.06}} Default version:
["TaskSucceeded",["Disable the nuke"]] call bis_fnc_showNotification;
<syntaxhighlight lang="cpp">
["ScoreAdded",["Disabled the nuke without triggering an alarm.",5]] call bis_fnc_showNotification;
color[] = {
"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"
};
colorIconPicture[] = {
"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"
};
colorIconText[] = {
"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"
};
description = "";
difficulty[] = {};
duration = 3;
iconPicture = "";
iconText = "";
priority = 0;
sound = "defaultNotification"; // Sound to be played upon notification is created. (cfgSounds)
soundClose = "defaultNotificationClose"; // Sound to be played upon notification is collapsed. (cfgSounds)
soundRadio = ""; // Radio message to be played upon notification is created. HQ entity of player side is used. (cfgRadio)
title = "";
</syntaxhighlight>


Instead of defining every single param over and over again in multiple missions, you can simply point to a template defined in ''CfgNotifications'' class either in mission / campaign ''description.ext'' or in global ''config.cpp''.


You can send additional arguments into the template, where they are applied to title, icon or description using format command.
{{GameCategory|arma3|Editing}}
class CfgNotifications
{
class Default
{
title = ""; {{codecomment|// Tile displayed as text on black background. Filled by arguments.}}
iconPicture = ""; {{codecomment|// Small icon displayed in left part. Colored by "color", filled by arguments.}}
iconText = ""; {{codecomment|// Short text displayed over the icon. Colored by "color", filled by arguments.}}
description = ""; {{codecomment|// Brief description displayed as structured text. Colored by "color", filled by arguments.}}
color[] = {1,1,1,1}; {{codecomment|// Icon and text color}}
duration = 5; {{codecomment|// How many seconds will the notification be displayed}}
priority = 0; {{codecomment|// Priority; higher number = more important; tasks in queue are selected by priority}}
difficulty[] = {}; {{codecomment|// Required difficulty settings. All listed difficulties has to be enabled}}
};
 
{{codecomment|// Examples}}
class TaskAssigned
{
title = "TASK ASSIGNED";
iconPicture = "\A3\ui_f\data\map\mapcontrol\taskIcon_ca.paa";
description = "%1";
priority = 7;
};
class ScoreAdded
{
title = "Score bonus";
iconText = "+%2";
description = "%1";
color[] = {0.5,1,1,1};
priority = 0;
difficulty[] = {"netStats"};
};
};

Latest revision as of 12:55, 10 March 2023

Notification preview

Arma 3 allows to show mission or system notification using BIS_fnc_showNotification function:

["TaskSucceeded", ["", "Disable the nuke"]] call BIS_fnc_showNotification; ["ScoreAdded", ["", "Disabled the nuke without triggering an alarm.", 5]] call BIS_fnc_showNotification;

Instead of defining every single param over and over again in multiple missions, it is possible to reference a template defined in CfgNotifications class either in mission / campaign Description.ext or in global config.cpp.

BIS_fnc_showNotification only offers possibility to change:
  • title
  • description
  • iconPicture
  • iconText
  • soundRadio
The rest is CfgNotifications-dependent.
class CfgNotifications
{
	class Default
	{
		title = "";				// Title displayed as text on black background. Filled by arguments.
		iconPicture = "";		// Small icon displayed in left part. Colored by "color", filled by arguments.
		iconText = "";			// Short text displayed over the icon. Colored by "color", filled by arguments.
		description = "";		// Brief description displayed as structured text. Colored by "color", filled by arguments.
		color[] = {1,1,1,1};	// Icon and text color
		duration = 5;			// How many seconds will the notification be displayed
		priority = 0;			// Priority; higher number = more important; tasks in queue are selected by priority
		difficulty[] = {};		// Required difficulty settings. All listed difficulties has to be enabled
	};

	// Example 1
	class TaskAssigned
	{
		title = "TASK ASSIGNED";
		iconPicture = "\A3\ui_f\data\map\mapcontrol\taskIcon_ca.paa";
		description = "%1";
		priority = 7;
	};

	// Example 2
	class ScoreAdded
	{
		title = "Score bonus";
		iconText = "+%2";
		description = "%1";
		color[] = {0.5,1,1,1};
		priority = 0;
		difficulty[] = {"netStats"};
	};
};

Arma 3 logo black.png2.06 Default version:

color[] = {
	"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])",
	"(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])",
	"(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",
	"(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"
};
colorIconPicture[] = {
	"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])",
	"(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])",
	"(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",
	"(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"
};
colorIconText[] = {
	"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])",
	"(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])",
	"(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",
	"(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"
};
description = "";
difficulty[] = {};
duration = 3;
iconPicture = "";
iconText = "";
priority = 0;
sound = "defaultNotification";				// Sound to be played upon notification is created. (cfgSounds)
soundClose = "defaultNotificationClose";	// Sound to be played upon notification is collapsed. (cfgSounds)
soundRadio = ""; // Radio message to be played upon notification is created. HQ entity of player side is used. (cfgRadio)
title = "";