Jump to content
Purzel

Open picture from intel file possible?

Recommended Posts

Hi Folks,

is ist possible to open a picture ingame from an intel file to its full size (512 x 512 pixels)?

Init of the intel file:

this setVariable ["RscAttributeDiaryRecord_texture","pictures\code.paa", true];    
data = [this,"RscAttributeDiaryRecord",["Top Secret","Comrade radio operator, these are the requested encryption codes, do not let them fall into the wrong hands...","pictures\code.paa"]] call bis_fnc_setServerVariable;

I have this (in .paa-format)

code7husi.jpg

but when I found the intel file and open it, it becomes like this:
(and it is not possible to read the picture to break the code!
the picture below is a snippet based on the original size under full HD-monitor resolution)

code1huu8.jpg

 

I already tried this:

player createDiaryRecord ["Diary",["Funkcode", "Code-Tabelle"<br/><br/><img image='pictures\code.paa' width='512' height='512'/> <br/>"]];

but no effect - it won´t work... :(

 

Is ist possible to open a picture ingame from an intel file to its full size (512 x 512 pixels)?
Or can I bring up the picture anyhow in its origin size, with putting it on a big commercial-sign, whiteboard or something like this?
 

Thanks for your help!
Greetz Purzel

PS: By the way - it´s the 

Beaufort Cipher

  • Like 1

Share this post


Link to post
Share on other sites

OK, I´ve tried around with that stuff, watched a tutorial about GUI-Editor.
Learned how to build an background and a "close"-Button.

 

I´ve build the "codedialog.hpp" and intergrated it (and the "defines.hpp") into the description.ext before the classes.
But I need a defines.hpp, so I copied one from another mission, in hope that this could work.

Of course it did not...
After all I desperate on the "defines.hpp", because that part is not treated in the tutorial

and I don´t have any clue, how to build a "defines.hpp" by myself.

Maybe someone could help me with that.


I have a picture 512 x 512 pixels called "code.paa" in the missions pictures-Folder.
Maybe someone could build that above stuff (Picture in 512x512 size with a simple "Close"-Button) for me.
I´v tried around, but there no light at the end of the tunnel.
I´m no native english-speaker so sometimes its hard to understand some tutorials.

Share this post


Link to post
Share on other sites

You can get the defines in the GUI Editor by pressing CRTL+P, they will be copied to your clipboard.

Or if you want something quick and simple as per GOMs post use ctrlCreate.

In your intel init..

this setVariable ["RscAttributeDiaryRecord_texture","pictures\code.paa", true];    
data = [this,"RscAttributeDiaryRecord",["Top Secret","Comrade radio operator, these are the requested encryption codes, do not let them fall into the wrong hands...<br /><execute expression='call TAG_fnc_documentViewer'>View the Document</execute>","pictures\code.paa"]] call bis_fnc_setServerVariable;

TAG_fnc_documentViewer = {
	disableSerialization;
	_display = [] call BIS_fnc_displayMission;
	if ( isNil { _display getVariable "document" } ) then {
		_pic = _display ctrlCreate [ "RscPictureKeepAspect", 1000 ];
		_pic ctrlSetText "pictures\code.paa";
		_pic ctrlSetPosition[ 0.5 - ( 256 * pixelW ), 0.5 - ( 256 * pixelH ), 512 * pixelW, 512 * pixelH ];
		_pic ctrlCommit 0;
			
		_display setVariable[ "document", _pic ];
		
		addMissionEventHandler [ "EachFrame", {
			if !( visibleMap ) then {
				ctrlDelete (( [] call BIS_fnc_displayMission ) getVariable "document" );
				( [] call BIS_fnc_displayMission ) setVariable [ "document", nil ];
				removeMissionEventHandler[ "EachFrame", _thisEventHandler ];
			};
		}];
	};
};

Share this post


Link to post
Share on other sites

:D I did state it was quick :P Keep forgetting about all these nice new EHs, Ah well gives OP something to do..

  • Like 1

Share this post


Link to post
Share on other sites

@Grumpy Old Man:
Thanks a lot, it´s a good idea for dialogs...

@KK:
Is it somehow possible to use the "map" as carrier for the code-picture?
 

@Larrow:

Thanks for that hint with CTRL+P, but i´ll first try the other part...

 

Share this post


Link to post
Share on other sites

Hell yeah!

 

 

It works fine... buuuuut:
I´ve got another picture (Pictures\codemail.paa) called from a second object file, but if I open that second file the first picture (code.paa) from first file will be shown.
So I decided to change the variables "document" and "_pic" to "document1" and "_pic1", but even after a reload of the mission, the first picture will be shown below...

code7husi.jpg<<<   code.ppa  versus  codemail.paa   >>>   codemailnpyzg.jpg

 

 

Do I have to change another variable?

Do I need to change the first lines "RscAttributeDiaryRecord_texture" to another name?
 

Below is the code from the second file init:
 

this setVariable ["RscAttributeDiaryRecord_texture","pictures\codemail.paa", true];     
data = [this,"RscAttributeDiaryRecord",["eMail to comrade commandant","GeniearK1eimiMneieesKadwrdnBseLfl2izaefamSeenudtnscrinsomatwrdeidLuK4nrnreSenirnrhlSehetomneisApKgnlheaib<br /><execute expression='call TAG_fnc_documentViewer'>eMail öffnen</execute>","pictures\codemail.paa"]] call bis_fnc_setServerVariable;
 
TAG_fnc_documentViewer = {
 disableSerialization;
 _display = [] call BIS_fnc_displayMission;
 if ( isNil { _display getVariable "document1" } ) then {
  _pic1 = _display ctrlCreate [ "RscPictureKeepAspect", 1000 ];
  _pic1 ctrlSetText "pictures\codemail.paa";
  _pic1 ctrlSetPosition[ 0.5 - ( 256 * pixelW ), 0.5 - ( 256 * pixelH ), 512 * pixelW, 512 * pixelH ];
  _pic1 ctrlCommit 0;
    
  _display setVariable[ "document1", _pic1 ];
   
  addMissionEventHandler [ "EachFrame", {
   if !( visibleMap ) then {
    ctrlDelete (( [] call BIS_fnc_displayMission ) getVariable "document1" );
    ( [] call BIS_fnc_displayMission ) setVariable [ "document1", nil ];
    removeMissionEventHandler[ "EachFrame", _thisEventHandler ];
   };
  }];
 };
};

Thanks for your help!

Share this post


Link to post
Share on other sites

Alternatively:

 

Place one enemy soldier named HVT,

init.sqf or wherever you seem fit:

//define the function to add the dialog
GOM_fnc_addIntel = {
	params ["_killed","_unit"];
	_unit createDiarySubject ["IntelDrop","Intel - HVT"];
	_unit createDiaryRecord ["IntelDrop",["Intel of Black Grizzly","This is the last known image of codename <execute expression='[] spawn GOM_fnc_showImage'>'Black Grizzly'</execute>"]];
};

GOM_fnc_shownImage = false;
GOM_fnc_showImage = {

	if (GOM_fnc_shownImage) exitWith {false};
	GOM_fnc_shownImage = true;
	with uiNamespace do {
		 intelIMG = findDisplay 46 ctrlCreate ["RscPicture", -1];
		 intelIMG ctrlSetPosition [0.15,0.15,1,1];//adjust these to fit your own image
		 intelIMG ctrlCommit 0;
		 intelIMG ctrlSetText "textures\doc_CA.paa";//your intel image path here
	};
	//wait until other diary record is selected or map is closed, to delete the image
	waitUntil {!visibleMap};
	with uiNamespace do {
		ctrlDelete intelIMG;
	};
	GOM_fnc_shownImage = false;

};

HVT addAction ["Loot Intel",{
	params ["_unit","_caller","_ID"];
	_unit removeAction _ID;
	hint "Intel received, check diary!";
	_this call GOM_fnc_addIntel;
},[],0,true,true,"","!alive _target AND _this isEqualTo vehicle _this",2];

 

Demo mission

 

Creates a diary entry containing the info about intel,

in the diary entry you can click on the text to launch the dialog with the bigger intel image mid-screen.

No need for eventhandlers or similar since it's being processed through diary entry as in your example.

 

Edit: Added safety check so image can only be opened once

 

Cheers

  • Like 4

Share this post


Link to post
Share on other sites

Thank you!!!!

very very much!

Share this post


Link to post
Share on other sites

I see GOM has given you a nice UI option but just for completeness I will answer your problems with the ctrlCreate method as options are always good.

 

I´ve got another picture (Pictures\codemail.paa) called from a second object file, but if I open that second file the first picture (code.paa) from first file will be shown.

As the function is defined in the intels inits, one function will overwrite the other depending on which one is run last.

To get over this the function should be defined as a stand alone function via the functions library to which each intel will pass along the picture to display.

description.ext

class CfgFunctions
{
	class Intel
	{
		tag = "TAG";
		class documentViewer
		{
			file = "functions";
			class ViewDocument {};
		};
	};
};
functions\fn_viewDocument.sqf

disableSerialization;
params[ "_picture" ];

//Get the main display
_display = [] call BIS_fnc_displayMission;
//Get any current document reference
_document = _display getVariable "document";

//If we dont have a current document OR the document picture is different
if ( isNil "_document" || { !( ctrlText _document isEqualTo _picture ) } ) then {
	
	//If there is no current document
	if ( isNil "_document" ) then {
		
		//Create the picture control
		_document = _display ctrlCreate [ "RscPictureKeepAspect", 1000 ];
		//Center it in the middle of the screen
		_document ctrlSetPosition[
			0.5 - ( 256 * pixelW ),
			0.5 - ( 256 * pixelH ),
			512 * pixelW,
			512 * pixelH
		];
		//Commit the position change
		_document ctrlCommit 0;
		
		//Save a reference to the document on the main display
		_display setVariable[ "document", _document ];
		
		//Add event for when the map is closed
		addMissionEventHandler [ "Map", {
			params[ "_mapOpen" ];
			
			//If the map is closed
			if !( _mapOpen ) then {
				//Delete the picture control
				ctrlDelete (( [] call BIS_fnc_displayMission ) getVariable "document" );
				//Set the saved reference to nil
				( [] call BIS_fnc_displayMission ) setVariable [ "document", nil ];
				//Remove this EH
				removeMissionEventHandler[ "Map", _thisEventHandler ];
			};
		}];
	};
	
	//Set the current document picture
	_document ctrlSetText _picture;
	
};
And then your intel inits would change to pass in the needed picture e.g

this setVariable ["RscAttributeDiaryRecord_texture","pictures\code.paa", true];    
data = [this,"RscAttributeDiaryRecord",["Top Secret","Comrade radio operator, these are the requested encryption codes, do not let them fall into the wrong hands...<br /><execute expression='""pictures\code.paa"" call TAG_fnc_viewDocument'>eMail öffnen</execute>","pictures\code.paa"]] call bis_fnc_setServerVariable;
this setVariable ["RscAttributeDiaryRecord_texture","pictures\codemail.paa", true];     
data = [this,"RscAttributeDiaryRecord",["eMail to comrade commandant","GeniearK1eimiMneieesKadwrdnBseLfl2izaefamSeenudtnscrinsomatwrdeidLuK4nrnreSenirnrhlSehetomneisApKgnlheaib<br /><execute expression='""pictures\codemail.paa"" call TAG_fnc_viewDocument'>eMail öffnen</execute>","pictures\codemail.paa"]] call bis_fnc_setServerVariable;
  • Like 4

Share this post


Link to post
Share on other sites

Great !
I´ll try both solutions...!

Share this post


Link to post
Share on other sites

Unfortunatly the above solution from Larrow does only work on the player, who found the intel file.
If he´s shot or has a connection lost, all data would be gone.
The best solution would be if all players get the picture...

Any suggestions?

Greetz and THX!

Share this post


Link to post
Share on other sites

As with any manually created Intel Object you have to set the recipients on the object.

this setvariable [ "recipients", west ];
this setVariable ["RscAttributeDiaryRecord_texture","pictures\code.paa", true];
data = [this,"RscAttributeDiaryRecord",["Top Secret","Comrade radio operator, these are the requested encryption codes, do not let them fall into the wrong hands...<br /><execute expression='""pictures\code.paa"" call TAG_fnc_viewDocument'>eMail öffnen</execute>","pictures\code.paa"]] call bis_fnc_setServerVariable;

Where recipients is a value that can be used for _targets in BIS_fnc_MP.

The above being that all west players would receive the intel when picked up.

Share this post


Link to post
Share on other sites

Sooo.... I may revive a super old post, but the file from Grumpy Old Man is no longer available!

Can someone host it again?

Share this post


Link to post
Share on other sites
5 hours ago, Grumpy Old Man said:

 

Edited the link in the post above!

 

Cheers

Nice, thanks man!

 

There's one bug though to both of the solutions above, sometimes when I close the map the image doesn't disappear

Share this post


Link to post
Share on other sites
3 hours ago, smirlianos said:

Nice, thanks man!

 

There's one bug though to both of the solutions above, sometimes when I close the map the image doesn't disappear

You most likely clicked the link to open the image multiple times, added a safety check to the snippet above.

 

Cheers

Share this post


Link to post
Share on other sites
3 hours ago, Grumpy Old Man said:

You most likely clicked the link to open the image multiple times, added a safety check to the snippet above.

 

Cheers

Yeah, that was it!

 

You can also put

ctrlDelete intelIMG;

before

intelIMG = findDisplay 46 ctrlCreate ["RscPicture", -1];

 

But that works as well!

  • Like 1

Share this post


Link to post
Share on other sites

Apologies for rezzing an old thread, but I just now purchased ARMA 3 during the Steam Summer Sale, and have fallen head over heels for it. As a seasoned TableTop GM, I've fallen even harder for the Mission Editor, and am now doing a deep dive into scripting to further enrich my missions!

 

I've run into several problems trying to get Intel work the way I want to, and this thread nearly single-handedly saved me hours of frustration. Thanks in particular to @Larrow and @Grumpy Old Man for their code. Works like a charm, and just like I hoped! However, while everything's working fine, there's one feature I want to add to the presented code to clean things up and enhance my players' experience - Collapsible Intel Text. Let me explain:


The mission I'm building has LOTS of diaries and various other intel items that my players can pick up and study in the intel tab. Some of these diary entries are quite long (the longest is 750+ words!), and this quickly clutters up the intel tab. My goal is to have it work similarly to the TAG_fnc_documentViewer function, where you can click on underlined 'View Picture', but instead of opening a higher-resolution version of the image, the function would display the desired text within the intel tab.

 

I imagine it would involve creating a string that includes parseText, then calling that string within the 'this setVariable' function. Starting with:

//String Creation

_diaryentry1 = parseText "VERY LONG<br/>WALL OF TEXT"

//Intel Code (Simply displaying the text)

this setVariable ["RscAttributeDiaryRecord_texture","diarypage1.paa", true];
[this,"RscAttributeDiaryRecord",["Wanderer's Diary","_diaryentry1",""]] call bis_fnc_setServerVariable;

I imagine that the next step would be including some code that would wait for a command before displaying, the could be recalled by clicking the text again. Something like this: 

//String Creation

_diaryentry1 = parseText "VERY LONG<br/>WALL OF TEXT"
_opendiary = "Open Diary"

//Base Intel Code

this setVariable ["RscAttributeDiaryRecord_texture","diarypage1.paa", true];
[this,"RscAttributeDiaryRecord",["Wanderer's Diary","{

//NEW CODE GOES HERE

_ctrl ctrlSetStructuredText parseText "_opendiary";

_diaryentry1"},""]] call bis_fnc_setServerVariable;

But I have no real idea if this is even the right place to start. My coding skills are pathetic, and that's being generous. I don't know if something like this is feasible, but I figured this thread would be the best place to ask (which is why I didn't want to create another thread). If I breached any forum etiquette in my post, I sincerely apologize - this is my first post on the BSI forums! I'm excited to see more of this place in the future. 🙂

  • Like 2

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

×