← Go back

Arma 3 - Cool ass looking messages!


Posted on November 05, 2017 at 12:55 (GMT +00:00) by Colin

I've been quite busy this past couple of weeks moving all my gear back into my home office in preparation for the cold winter, but I wanted to make a new post. I am going to show you my "coolmsg" functionality I have written for my Arma 3 missions and upcoming game mode. As per usual, this is very easy for you to add into your mission, just remember to give credit where due.

First create your folder "PX" inside your mission folder if it does not already exist, then create the file px_coolmsg.sqf and place the following code inside:
/////////////////////////////////////////////////////////////////////////////////
//
// Cool Message - part of PixeL_GaMMa library.
// A function that displays a cool fading message log.
// Copyright (c) Colin J.D. Stewart. All rights reserved
// APL-ND License - https://www.bistudio.com/community/licenses/arma-public-license-nd
//
/////////////////////////////////////////////////////////////////////////////////

if (hasInterface) then {
	msglines = [];
		
	func_pxCoolMsg = {			
		disableSerialization;
		_ctrl = (findDisplay 46) ctrlCreate ["RscStructuredText", -1];
		msgLines pushBack _ctrl;
		_ctrl ctrlSetFont "PuristaMedium";					
		_ctrl ctrlSetPosition [safeZoneX, safeZoneY + safeZoneH - 0.05, safeZoneW, safeZoneH];	
		_ctrl ctrlSetStructuredText parseText format["<t align='right'>%1</t>", _this];			
		_ctrl ctrlCommit 0;
		
		_ctrlCount = (count msglines) -1; 
		
		_deleteCount = 0;
		
		_pos = 0.05 + (_ctrlCount * 0.03); //[0,0];
		{
			if (ctrlFade _x == 1) then {
				_deleteCount = _deleteCount + 1;
				ctrlDelete _x;
			} else {
				_x ctrlSetPosition [safeZoneX, safeZoneY + safeZoneH - _pos, safeZoneW, safeZoneH];	
				_x ctrlCommit 1;		
			};
			
			_pos = _pos - 0.03;			
		} foreach msgLines;		

		_ctrl ctrlSetFade 1;
		_ctrl ctrlCommit 20;	
		
		// remove any old...
		msgLines deleteRange [0, _deleteCount];
	};
};

if (isServer) then {
	func_pxSendCoolMsg = {
		_this remoteExec ["func_pxCoolMsg", 0]; 
	};
};


Next, inside your init.sqf file place the following line:

call compileFinal preprocessFile "PX\px_coolmsg.sqf";


Now you're ready to go, to use these functions you use them pretty much the same way as any other function.

// Send hello world to the local client
"Hello <t color='#f0f0f0'>World</t>" call func_pxCoolMsg;

// You can use the helper function for sending over the network to all clients
"Hello <t color='#f0f0f0'>World</t>" call func_pxSendCoolMsg;


Here is a sample below (in this case I have used it for my kill detection scripts:





I hope you enjoy using this script, if you do, please add a credit notice where possible and leave me a comment below! Thanks! :)
/Scripting/Programming/Game Modding

Search
Tags
Accident Adoption Albums Algorithms Altcoins Animal Rescue AnL Aquarium Arma ArmA nd Leg Array Partitioning Arrays Assembler Assembly Atanasovsko Award Bazaar Binary Search Bitcoin Bohemia Bootstrap Bulgaria Bulgaria Za Mladite Burgas C C++ Celerity Charity Chemical Records Chemical Shock Chemlight Code Competition Compiler Contest Converter Covid-19 CPP Crypto Cryptocurrency css Data Recovery Database DataTables Decode Dedicated Dedicated Server Delphi Development Dialogs Divide & Conquer DIY DnB Drum & Bass Earplugs Event Exchange Eyes Fish Floating-point Flood Fog Freeware Function Funny Gallery Game Game Development Game Modding Gaming Garden Gardening Gazebo GERB GitHub Glitch Hamish Harding Happy New Year Heapify HeapSort Helga HTML HTML entities Introduction Jackie JavaScript JQuery Jungle Lake Language Linker Listbox ListNBox lnbSetTooltip MariaDB Maths Merry Christmas Mini Mining Miningpoolhub Mist Modding MPH Multiplayer Music MySql NGO OceanGate One Nature ORCA organisation OverHertz Paludarium Pandemic Pascal Paul-Henri Nargeolet Paws Furever Pergola Persistence Pets Photography Pier Plugin Programming progress bar Project PX Library Quicksort r53 Racing Replace Scripting Searching Server Shahzada Dawood Simulation Simulator Smoke Snippet Social media Software Sorting Source Sourcecode SQF Statistics Stockton Rush String Strings Submarine Suleman Dawood Terrain Detail Text Titan Tool Tragedy tutorial UCS4Char UE4 Unreal Engine Victims View Distance ViewBug web Web Development Website Welcome Woodworking Ziron Zynk