Jump to content
fortun

Link to website in Briefing

Recommended Posts

Is this possible? Want to link to my Workshop in my briefing, so when i click on it i will be transported to my workshops homepage. However, is this even possible to do? Wants this because i want to tell player to go there to get the newest update of a mission.

  • Like 1

Share this post


Link to post
Share on other sites

Subscribed workshop missions update automatically.

Share this post


Link to post
Share on other sites
On 8/21/2017 at 12:42 PM, taskmaster065 said:

Did anyone work out how to do this?

 

Maybe a little bit late to the party, but I just had a thought to achieve the same thing and got it working. Steps I took were:

 

1. Create a .sqf in your mission (e.g. links.sqf) with a copyToClipboard of your link:

copyToClipboard "https://youtu.be/2ZpStHUFQ-4";

2. Declare the .sqf in your description.ext:

class CfgFunctions
{
	class MIL
	{
		class Common {
			class links {file = "links.sqf";};
		};
};

3. In your diary record include the command <execute expression='code'>text</execute> in the same way that you'd use a marker link as part of a sentence or something else:

bla bla bla <execute expression='nul = [] spawn MIL_fnc_links'>(Copy YouTube link to clipboard)</execute> more bla bla bla

 

I hope that is easy to understand. I'm running on a full day after very little sleep last night, so if the explanation is a bit off please let me know and I'll fix it up, because I got it working for myself pretty easily.

  • Like 1

Share this post


Link to post
Share on other sites

Most buttons now support a URL and when clicked will open a users web browser at the given page. It should be possible to inject a button into the diary subject area when the user opens the map.

For example...

Spoiler

 

description.ext


#include "baseDefines.hpp"  //call BIS_fnc_exportGUIBaseClasses
#include "openWebpage.hpp"

openWebPage.hpp


class myWebpageButton : ctrlButton {
	url = "https://forums.bohemia.net/forums/topic/169501-link-to-website-in-briefing/";

	colorSelect[] = { 0, 1, 0, 1 };
	soundSelect[] = {};
};

initPlayerLocal.sqf



player createDiarySubject[ "MyMod", "My Mod" ];
player createDiaryRecord[ "MyMod", [ "Mod Info", "" ] ];

addMissionEventHandler [ "Map", {
	params[ "_isOpen" ];

	if ( _isOpen ) then {
		//1001, 1002, 1013

		disableSerialization;

		_display = uiNamespace getVariable "RscDiary";

		_diaryList = _display displayCtrl 1001;
		_diarySubList = _display displayCtrl 1002;

		TAG_fnc_showSelection = {
			disableSerialization;
			params[ "_ctrl", "_index" ];

			_display = ctrlParent _ctrl;

			_diarySubList = _display displayCtrl 1002;
			waitUntil{ ctrlShown _diarySubList };
			_diaryEntry = _display displayCtrl 1013;

			if ( _diarySubList lbText ( lbCurSel _diarySubList ) == "Mod Info" ) then {
				if ( isNull ( _diaryEntry controlsGroupCtrl 10001 ) ) then {
					_btnHeight = 0.02 * safeZoneH;

					//Hide diary entry html
					_contentHtml = _diaryEntry controlsGroupCtrl 1003;
					_contentHtml ctrlSetFade 1;
					_contentHtml ctrlCommit 0;

					//Inject button
					ctrlPosition _diaryEntry params[ "_entryX", "_entryY", "_entryW", "_entryH" ];
					_ctrl = _display ctrlCreate [ "myWebpageButton", 10001, _diaryEntry ];
					_ctrl ctrlSetPosition[ 0, 0, _entryW / 3, _btnHeight ];
					_ctrl ctrlCommit 0;
					_ctrl ctrlSetText "Click Me";
				};
			}else{
				//If its not the mod info entry
				//AND the injected button exists
				if !( isNull ( _diaryEntry controlsGroupCtrl 10001 ) ) then {
					//Delete injected button
					ctrlDelete ( _diaryEntry controlsGroupCtrl 10001 );
					//Unhide entry html
					_contentHtml = _diaryEntry controlsGroupCtrl 1003;
					_contentHtml ctrlSetFade 0;
					_contentHtml ctrlCommit 0;
				};
			};
		};

		_diaryList ctrlAddEventHandler [ "LBSelChanged", {
			_this spawn TAG_fnc_showSelection;
		}];

		_diarySubList ctrlAddEventHandler [ "LBSelChanged", {
			_this spawn TAG_fnc_showSelection;
		}];
	};
}];

 

 

 

TEST MISSION

May need some fineness to look right/work properly but will do as a quick example.

  • Like 3
  • Thanks 2

Share this post


Link to post
Share on other sites

Great Find, thank you Larrow.

If you use missioneventhandler oneachframe, this will allow the link to work in the initial briefing, not after the mission has started

 

Am dabbling with this and have success passing an auto start teamspeak and link to my teamspeak button

Need to remove the oneachframe EH after succesfully adding the button and some more tweaking

 

EDIT.

 

Now have a working example for easy integration into your missions..

 

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×