Jump to content

Recommended Posts

All I need is to make this script repeatable so when it is done "Downloading" it'll reset and you can keep downloading it again and again. I assume it has something to do with the addactions and I know lines 85-90 have something to do with the addaction "Request Funds" disappearing after download but when I take those lines out It keeps the "Request Funds" but you can no longer download the files because it says "Funds approved"

 

T8L_var_fileSize = 100000;  								// Filesize ... smaller files will take shorter time to download!

T8L_var_TLine01 = "Funds Denied";				// download aborted
T8L_var_TLine02 = "Standby";			// download already in progress by someone else
T8L_var_TLine03 = "Requesting Funds";				// download started
T8L_var_TLine04 = "Funds Approved";			// download finished
T8L_var_TLine05 = "Request Funds";				// line for the addaction
T8L_var_TLine06 = "Connecting ...";
T8L_var_TLine07 = "Connected:";

T8L_var_DialogAbort = false;
T8L_var_DialogSucce = false;



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

T8L_fnc_abortActionLaptop =
{
	if ( T8L_var_DialogSucce ) then 
	{
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
	
	} else {
		cutText [ T8L_var_TLine01, "PLAIN" ];	
		T8L_var_DialogAbort = true; 
		T8L_var_DialogSucce = false; 
	};
};


T8L_fnc_addActionLaptop =
{
	{
		if !( _x getVariable [ "T8L_pvar_dataDownloaded", false ] ) then
		{
			_x addAction [ T8L_var_TLine05, { call T8L_fnc_ActionLaptop; }, [], 10, false, false ];
		};
	} forEach _this;	
};


T8L_fnc_removeActionLaptop =
{
	_laptop = _this select 0;
	_id = _this select 1;
	_laptop removeAction _id;
};


T8L_fnc_ActionLaptop =
{
	private [ "_laptop", "_caller", "_id" ];
	_laptop = _this select 0;
	_caller = _this select 1;
	_id = _this select 2;
	
	if ( _laptop getVariable [ "T8L_pvar_inUse", false ] ) exitWith { cutText [ T8L_var_TLine02, "PLAIN" ]; };
	if ( _laptop getVariable [ "T8L_pvar_dataDownloaded", false ] ) exitWith { cutText [ T8L_var_TLine04, "PLAIN" ]; };
	
	cutText [ T8L_var_TLine03, "PLAIN" ];
	
	_laptop setVariable [ "T8L_pvar_inUse", true, true ];
		
	[ _laptop, _id ] spawn 
	{
		private [ "_laptop", "_id", "_newFile", "_dlRate", "_percent" ];
		
		_laptop		= _this select 0;
		_id			= _this select 1;
		
		_newFile = 0;
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
		
		createDialog "T8L_DataDownloadDialog";
		
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine06 ];
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine07 ];		
		ctrlSetText [ 8003, format [ "%1 $", T8L_var_FileSize ] ];		
		ctrlSetText [ 8004, format [ "%1 $", _newFile ] ];		
		
		while { !T8L_var_DialogAbort } do
		{
			_dlRate = 200 + random 80;
			_newFile = _newFile + _dlRate;

			if ( _newFile > T8L_var_FileSize ) then 
			{
				_dlRate = 0;		
				_newFile = T8L_var_FileSize;
				
				ctrlSetText [ 8001, T8L_var_TLine04 ];			
				cutText [ T8L_var_TLine04, "PLAIN" ];
				
				T8L_var_DialogAbort = true;
				T8L_var_DialogSucce = true;
				_laptop setVariable [ "T8L_pvar_dataDownloaded", true, true ];			

				[ [ _laptop, _id ], "T8L_fnc_removeActionLaptop", true, true ] spawn BIS_fnc_MP;
			};
			
			// percentage part by cuel!
			ctrlSetText [ 8002, format [ "%1 $/t", _dlRate ] ];        
			_percent =  ( _newFile / T8L_var_FileSize );
			_percent = toArray str _percent;
			{ _percent set [_x,-1] } forEach [ 0, 1 ]; 
			_percent = _percent - [-1];
			_percent resize 2;
			_percent = toString _percent;
			ctrlSetText [ 8004, format [ "%1 $ (%2%3)", _newFile, (if ( T8L_var_DialogAbort ) then { 100 } else { _percent }), "%" ]];
			
			sleep 0.25;
		};
		
		T8L_var_DialogAbort = false;

		_laptop setVariable [ "T8L_pvar_inUse", false, true ];	
	};
};

T8L_var_INITDONE = true;

 

Share this post


Link to post
Share on other sites

Add this at the end maybe:

_laptop setVariable ["T8L_pvar_inUse", false, true];
_laptop setVariable ["T8L_pvar_dataDownloaded", false, true];

 

Share this post


Link to post
Share on other sites
8 minutes ago, HazJ said:

Add this at the end maybe:


_laptop setVariable ["T8L_pvar_inUse", false, true];

 

Do you mean like this?

/*
 =======================================================================================================================

	downloadData - V004
	
	a small script to download data from a laptop ( and as example because of this complete a task )

	File:		downloadData.sqf
	Author:		T-800a / cuel for percentages
	
	How to:
	If you want one or more objects to be used with the script, give those objects a name in the editor and add/edit the
	following line in the init.sqf
	
	[ [ laptop01, nameOfMyPlacedObj, ... ], "T8L_fnc_addActionLaptop", true, true] spawn BIS_fnc_MP;

	You can check if the download on a laptop/object was finished and you can check if someone uses this object:
	
	_laptopInUse		= _myLaptop getVariable [ "T8L_pvar_inUse", false ];
	_downloadComplete	= _myLaptop getVariable [ "T8L_pvar_dataDownloaded", false ];

	
 ===== LICENSE =========================================================================================================
	
	DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
	Version 2, December 2004

	Copyright (C) 2004 Sam Hocevar
	14 rue de Plaisance, 75014 Paris, France
	Everyone is permitted to copy and distribute verbatim or modified
	copies of this license document, and changing it is allowed as long
	as the name is changed.

	DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
	TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

	0. You just DO WHAT THE FUCK YOU WANT TO.

 =======================================================================================================================
*/

T8L_var_fileSize = 100000;  								// Filesize ... smaller files will take shorter time to download!

T8L_var_TLine01 = "Funds Denied";				// download aborted
T8L_var_TLine02 = "Standby";			// download already in progress by someone else
T8L_var_TLine03 = "Requesting Funds";				// download started
T8L_var_TLine04 = "Funds Approved";			// download finished
T8L_var_TLine05 = "Request Funds";				// line for the addaction
T8L_var_TLine06 = "Connecting ...";
T8L_var_TLine07 = "Connected:";

T8L_var_DialogAbort = false;
T8L_var_DialogSucce = false;



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

T8L_fnc_abortActionLaptop =
{
	if ( T8L_var_DialogSucce ) then 
	{
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
	
	} else {
		cutText [ T8L_var_TLine01, "PLAIN" ];	
		T8L_var_DialogAbort = true; 
		T8L_var_DialogSucce = false; 
	};
};


T8L_fnc_addActionLaptop =
{
	{
		if !( _x getVariable [ "T8L_pvar_dataDownloaded", false ] ) then
		{
			_x addAction [ T8L_var_TLine05, { call T8L_fnc_ActionLaptop; }, [], 10, false, false ];
		};
	} forEach _this;	
};


T8L_fnc_removeActionLaptop =
{
	_laptop = _this select 0;
	_id = _this select 1;
	_laptop removeAction _id;
};


T8L_fnc_ActionLaptop =
{
	private [ "_laptop", "_caller", "_id" ];
	_laptop = _this select 0;
	_caller = _this select 1;
	_id = _this select 2;
	
	if ( _laptop getVariable [ "T8L_pvar_inUse", false ] ) exitWith { cutText [ T8L_var_TLine02, "PLAIN" ]; };
	if ( _laptop getVariable [ "T8L_pvar_dataDownloaded", false ] ) exitWith { cutText [ T8L_var_TLine04, "PLAIN" ]; };
	
	cutText [ T8L_var_TLine03, "PLAIN" ];
	
	_laptop setVariable [ "T8L_pvar_inUse", true, true ];
		
	[ _laptop, _id ] spawn 
	{
		private [ "_laptop", "_id", "_newFile", "_dlRate", "_percent" ];
		
		_laptop		= _this select 0;
		_id			= _this select 1;
		
		_newFile = 0;
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
		
		createDialog "T8L_DataDownloadDialog";
		
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine06 ];
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine07 ];		
		ctrlSetText [ 8003, format [ "%1 $", T8L_var_FileSize ] ];		
		ctrlSetText [ 8004, format [ "%1 $", _newFile ] ];		
		
		while { !T8L_var_DialogAbort } do
		{
			_dlRate = 200 + random 80;
			_newFile = _newFile + _dlRate;

			if ( _newFile > T8L_var_FileSize ) then 
			{
				_dlRate = 0;		
				_newFile = T8L_var_FileSize;
				
				ctrlSetText [ 8001, T8L_var_TLine04 ];			
				cutText [ T8L_var_TLine04, "PLAIN" ];
				
				T8L_var_DialogAbort = true;
				T8L_var_DialogSucce = true;
				_laptop setVariable [ "T8L_pvar_dataDownloaded", true, true ];			

				[ [ _laptop, _id ], "T8L_fnc_removeActionLaptop", true, true ] spawn BIS_fnc_MP;
			};
			
			// percentage part by cuel!
			ctrlSetText [ 8002, format [ "%1 $/t", _dlRate ] ];        
			_percent =  ( _newFile / T8L_var_FileSize );
			_percent = toArray str _percent;
			{ _percent set [_x,-1] } forEach [ 0, 1 ]; 
			_percent = _percent - [-1];
			_percent resize 2;
			_percent = toString _percent;
			ctrlSetText [ 8004, format [ "%1 $ (%2%3)", _newFile, (if ( T8L_var_DialogAbort ) then { 100 } else { _percent }), "%" ]];
			
			sleep 0.25;
		};
		
		T8L_var_DialogAbort = false;

		_laptop setVariable [ "T8L_pvar_inUse", false, true ];	
	};
};

T8L_var_INITDONE = true;
_laptop setVariable ["T8L_pvar_inUse", false, true];

 

Share this post


Link to post
Share on other sites

Yeah, re-read my post again as I edited it. I added another line.

 

EDIT: No, sorry. You add the line in my previous post (the second one) after the last setVariable, second to last.

Share this post


Link to post
Share on other sites

So here's what I tried it didn't work so I'm gonna try removing lines 85-90

/*
 =======================================================================================================================

	downloadData - V004
	
	a small script to download data from a laptop ( and as example because of this complete a task )

	File:		downloadData.sqf
	Author:		T-800a / cuel for percentages
	
	How to:
	If you want one or more objects to be used with the script, give those objects a name in the editor and add/edit the
	following line in the init.sqf
	
	[ [ laptop01, nameOfMyPlacedObj, ... ], "T8L_fnc_addActionLaptop", true, true] spawn BIS_fnc_MP;

	You can check if the download on a laptop/object was finished and you can check if someone uses this object:
	
	_laptopInUse		= _myLaptop getVariable [ "T8L_pvar_inUse", false ];
	_downloadComplete	= _myLaptop getVariable [ "T8L_pvar_dataDownloaded", false ];

	
 ===== LICENSE =========================================================================================================
	
	DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
	Version 2, December 2004

	Copyright (C) 2004 Sam Hocevar
	14 rue de Plaisance, 75014 Paris, France
	Everyone is permitted to copy and distribute verbatim or modified
	copies of this license document, and changing it is allowed as long
	as the name is changed.

	DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
	TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

	0. You just DO WHAT THE FUCK YOU WANT TO.

 =======================================================================================================================
*/

T8L_var_fileSize = 100000;  								// Filesize ... smaller files will take shorter time to download!

T8L_var_TLine01 = "Funds Denied";				// download aborted
T8L_var_TLine02 = "Standby";			// download already in progress by someone else
T8L_var_TLine03 = "Requesting Funds";				// download started
T8L_var_TLine04 = "Funds Approved";			// download finished
T8L_var_TLine05 = "Request Funds";				// line for the addaction
T8L_var_TLine06 = "Connecting ...";
T8L_var_TLine07 = "Connected:";

T8L_var_DialogAbort = false;
T8L_var_DialogSucce = false;



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

T8L_fnc_abortActionLaptop =
{
	if ( T8L_var_DialogSucce ) then 
	{
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
	
	} else {
		cutText [ T8L_var_TLine01, "PLAIN" ];	
		T8L_var_DialogAbort = true; 
		T8L_var_DialogSucce = false; 
	};
};


T8L_fnc_addActionLaptop =
{
	{
		if !( _x getVariable [ "T8L_pvar_dataDownloaded", false ] ) then
		{
			_x addAction [ T8L_var_TLine05, { call T8L_fnc_ActionLaptop; }, [], 10, false, false ];
		};
	} forEach _this;	
};


T8L_fnc_removeActionLaptop =
{
	_laptop = _this select 0;
	_id = _this select 1;
	_laptop removeAction _id;
};


T8L_fnc_ActionLaptop =
{
	private [ "_laptop", "_caller", "_id" ];
	_laptop = _this select 0;
	_caller = _this select 1;
	_id = _this select 2;
	
	if ( _laptop getVariable [ "T8L_pvar_inUse", false ] ) exitWith { cutText [ T8L_var_TLine02, "PLAIN" ]; };
	if ( _laptop getVariable [ "T8L_pvar_dataDownloaded", false ] ) exitWith { cutText [ T8L_var_TLine04, "PLAIN" ]; };
	
	cutText [ T8L_var_TLine03, "PLAIN" ];
	
	_laptop setVariable [ "T8L_pvar_inUse", true, true ];
		
	[ _laptop, _id ] spawn 
	{
		private [ "_laptop", "_id", "_newFile", "_dlRate", "_percent" ];
		
		_laptop		= _this select 0;
		_id			= _this select 1;
		
		_newFile = 0;
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
		
		createDialog "T8L_DataDownloadDialog";
		
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine06 ];
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine07 ];		
		ctrlSetText [ 8003, format [ "%1 $", T8L_var_FileSize ] ];		
		ctrlSetText [ 8004, format [ "%1 $", _newFile ] ];		
		
		while { !T8L_var_DialogAbort } do
		{
			_dlRate = 200 + random 80;
			_newFile = _newFile + _dlRate;

			if ( _newFile > T8L_var_FileSize ) then 
			{
				_dlRate = 0;		
				_newFile = T8L_var_FileSize;
				
				ctrlSetText [ 8001, T8L_var_TLine04 ];			
				cutText [ T8L_var_TLine04, "PLAIN" ];
				
				T8L_var_DialogAbort = true;
				T8L_var_DialogSucce = true;
				_laptop setVariable [ "T8L_pvar_dataDownloaded", true, true ];			

				[ [ _laptop, _id ], "T8L_fnc_removeActionLaptop", true, true ] spawn BIS_fnc_MP;
			};
			
			// percentage part by cuel!
			ctrlSetText [ 8002, format [ "%1 $/t", _dlRate ] ];        
			_percent =  ( _newFile / T8L_var_FileSize );
			_percent = toArray str _percent;
			{ _percent set [_x,-1] } forEach [ 0, 1 ]; 
			_percent = _percent - [-1];
			_percent resize 2;
			_percent = toString _percent;
			ctrlSetText [ 8004, format [ "%1 $ (%2%3)", _newFile, (if ( T8L_var_DialogAbort ) then { 100 } else { _percent }), "%" ]];
			
			sleep 0.25;
		};
		
		T8L_var_DialogAbort = false;

		_laptop setVariable [ "T8L_pvar_inUse", false, true ];	
	};
};	

T8L_var_INITDONE = true;
_laptop setVariable ["T8L_pvar_inUse", false, true];
_laptop setVariable ["T8L_pvar_dataDownloaded", false, true];

 

Share this post


Link to post
Share on other sites

No. Try this:


T8L_fnc_ActionLaptop =
{
	private [ "_laptop", "_caller", "_id" ];
	_laptop = _this select 0;
	_caller = _this select 1;
	_id = _this select 2;
	
	if ( _laptop getVariable [ "T8L_pvar_inUse", false ] ) exitWith { cutText [ T8L_var_TLine02, "PLAIN" ]; };
	if ( _laptop getVariable [ "T8L_pvar_dataDownloaded", false ] ) exitWith { cutText [ T8L_var_TLine04, "PLAIN" ]; };
	
	cutText [ T8L_var_TLine03, "PLAIN" ];
	
	_laptop setVariable [ "T8L_pvar_inUse", true, true ];
		
	[ _laptop, _id ] spawn 
	{
		private [ "_laptop", "_id", "_newFile", "_dlRate", "_percent" ];
		
		_laptop		= _this select 0;
		_id			= _this select 1;
		
		_newFile = 0;
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
		
		createDialog "T8L_DataDownloadDialog";
		
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine06 ];
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine07 ];		
		ctrlSetText [ 8003, format [ "%1 $", T8L_var_FileSize ] ];		
		ctrlSetText [ 8004, format [ "%1 $", _newFile ] ];		
		
		while { !T8L_var_DialogAbort } do
		{
			_dlRate = 200 + random 80;
			_newFile = _newFile + _dlRate;

			if ( _newFile > T8L_var_FileSize ) then 
			{
				_dlRate = 0;		
				_newFile = T8L_var_FileSize;
				
				ctrlSetText [ 8001, T8L_var_TLine04 ];			
				cutText [ T8L_var_TLine04, "PLAIN" ];
				
				T8L_var_DialogAbort = true;
				T8L_var_DialogSucce = true;
				_laptop setVariable [ "T8L_pvar_dataDownloaded", true, true ];			

				[ [ _laptop, _id ], "T8L_fnc_removeActionLaptop", true, true ] spawn BIS_fnc_MP;
			};
			
			// percentage part by cuel!
			ctrlSetText [ 8002, format [ "%1 $/t", _dlRate ] ];        
			_percent =  ( _newFile / T8L_var_FileSize );
			_percent = toArray str _percent;
			{ _percent set [_x,-1] } forEach [ 0, 1 ]; 
			_percent = _percent - [-1];
			_percent resize 2;
			_percent = toString _percent;
			ctrlSetText [ 8004, format [ "%1 $ (%2%3)", _newFile, (if ( T8L_var_DialogAbort ) then { 100 } else { _percent }), "%" ]];
			
			sleep 0.25;
		};
		
		T8L_var_DialogAbort = false;

		_laptop setVariable [ "T8L_pvar_inUse", false, true ];
		_laptop setVariable [ "T8L_pvar_dataDownloaded", false, true ];	
	};
};

 

Share this post


Link to post
Share on other sites

So I tried this and now the addaction isn't even popping up

*/

T8L_var_fileSize = 100000;  								// Filesize ... smaller files will take shorter time to download!

T8L_var_TLine01 = "Funds Denied";				// download aborted
T8L_var_TLine02 = "Standby";			// download already in progress by someone else
T8L_var_TLine03 = "Requesting Funds";				// download started
T8L_var_TLine04 = "Funds Approved";			// download finished
T8L_var_TLine05 = "Request Funds";				// line for the addaction
T8L_var_TLine06 = "Connecting ...";
T8L_var_TLine07 = "Connected:";

T8L_var_DialogAbort = false;
T8L_var_DialogSucce = false;



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

T8L_fnc_abortActionLaptop =
{
	if ( T8L_var_DialogSucce ) then 
	{
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
	
	} else {
		cutText [ T8L_var_TLine01, "PLAIN" ];	
		T8L_var_DialogAbort = true; 
		T8L_var_DialogSucce = false; 
	};
};


T8L_fnc_addActionLaptop =
{
	{
		if !( _x getVariable [ "T8L_pvar_dataDownloaded", false ] ) then
		{
			_x addAction [ T8L_var_TLine05, { call T8L_fnc_ActionLaptop; }, [], 10, false, false ];
		};
	} forEach _this;	
};


T8L_fnc_removeActionLaptop =
{
	_laptop = _this select 0;
	_id = _this select 1;
	_laptop removeAction _id;
};


T8L_fnc_ActionLaptop =
{
	private [ "_laptop", "_caller", "_id" ];
	_laptop = _this select 0;
	_caller = _this select 1;
	_id = _this select 2;
	
	if ( _laptop getVariable [ "T8L_pvar_inUse", false ] ) exitWith { cutText [ T8L_var_TLine02, "PLAIN" ]; };
	if ( _laptop getVariable [ "T8L_pvar_dataDownloaded", false ] ) exitWith { cutText [ T8L_var_TLine04, "PLAIN" ]; };
	
	cutText [ T8L_var_TLine03, "PLAIN" ];
	
	_laptop setVariable [ "T8L_pvar_inUse", true, true ];
		
	[ _laptop, _id ] spawn 
	{
		private [ "_laptop", "_id", "_newFile", "_dlRate", "_percent" ];
		
		_laptop		= _this select 0;
		_id			= _this select 1;
		
		_newFile = 0;
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
		
		createDialog "T8L_DataDownloadDialog";
		
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine06 ];
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine07 ];		
		ctrlSetText [ 8003, format [ "%1 $", T8L_var_FileSize ] ];		
		ctrlSetText [ 8004, format [ "%1 $", _newFile ] ];		
		
		while { !T8L_var_DialogAbort } do
		{
			_dlRate = 200 + random 80;
			_newFile = _newFile + _dlRate;

			if ( _newFile > T8L_var_FileSize ) then 
			{
				_dlRate = 0;		
				_newFile = T8L_var_FileSize;
				
				ctrlSetText [ 8001, T8L_var_TLine04 ];			
				cutText [ T8L_var_TLine04, "PLAIN" ];
				
				T8L_var_DialogAbort = true;
				T8L_var_DialogSucce = true;
				_laptop setVariable [ "T8L_pvar_dataDownloaded", true, true ];			

				[ [ _laptop, _id ], "T8L_fnc_removeActionLaptop", true, true ] spawn BIS_fnc_MP;
			};
			
			// percentage part by cuel!
			ctrlSetText [ 8002, format [ "%1 $/t", _dlRate ] ];        
			_percent =  ( _newFile / T8L_var_FileSize );
			_percent = toArray str _percent;
			{ _percent set [_x,-1] } forEach [ 0, 1 ]; 
			_percent = _percent - [-1];
			_percent resize 2;
			_percent = toString _percent;
			ctrlSetText [ 8004, format [ "%1 $ (%2%3)", _newFile, (if ( T8L_var_DialogAbort ) then { 100 } else { _percent }), "%" ]];
			
			sleep 0.25;
		};
		
		T8L_var_DialogAbort = false;

		_laptop setVariable [ "T8L_pvar_inUse", false, true ];
		_laptop setVariable [ "T8L_pvar_dataDownloaded", false, true ];	
	};
};

 

Share this post


Link to post
Share on other sites

Let me test, will update this post shortly. Stand by!

Share this post


Link to post
Share on other sites

Wait. Would you prefer I sent you the full file so you could use it in totality?

Share this post


Link to post
Share on other sites

I have downloaded the original and am tweaking that as an example for you.

Share this post


Link to post
Share on other sites
Just now, HazJ said:

I have downloaded the original and tweaking that as an example for you.

I mean you cannot test it without the mission files. Would you like those? Unless of course you can test it.

Share this post


Link to post
Share on other sites
9 minutes ago, HazJ said:

Here you go:

https://1drv.ms/u/s!ArYSs9w5RSIDhDm5MpKkiRRotxq7

Read the comments I added on line 144 and 145.

And the final answer is here

*/

T8L_var_fileSize = 25687;  								// Filesize ... smaller files will take shorter time to download!

T8L_var_TLine01 = "Download aborted!";				// download aborted
T8L_var_TLine02 = "Download already in progress!";			// download already in progress by someone else
T8L_var_TLine03 = "Download started!";				// download started
T8L_var_TLine04 = "Download complete!";			// download finished
T8L_var_TLine05 = "##  Download Data  ##";				// line for the addaction
T8L_var_TLine06 = "Connecting ...";
T8L_var_TLine07 = "Connected:";

T8L_var_DialogAbort = false;
T8L_var_DialogSucce = false;



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

T8L_fnc_abortActionLaptop =
{
	if ( T8L_var_DialogSucce ) then 
	{
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
	
	} else {
		cutText [ T8L_var_TLine01, "PLAIN" ];	
		T8L_var_DialogAbort = true; 
		T8L_var_DialogSucce = false; 
	};
};


T8L_fnc_addActionLaptop =
{
	{
		if !( _x getVariable [ "T8L_pvar_dataDownloaded", false ] ) then
		{
			_x addAction [ T8L_var_TLine05, { call T8L_fnc_ActionLaptop; }, [], 10, false, false ];
		};
	} forEach _this;	
};


T8L_fnc_removeActionLaptop =
{
	_laptop = _this select 0;
	_id = _this select 1;
	_laptop removeAction _id;
};


T8L_fnc_ActionLaptop =
{
	private [ "_laptop", "_caller", "_id" ];
	_laptop = _this select 0;
	_caller = _this select 1;
	_id = _this select 2;
	
	if ( _laptop getVariable [ "T8L_pvar_inUse", false ] ) exitWith { cutText [ T8L_var_TLine02, "PLAIN" ]; };
	if ( _laptop getVariable [ "T8L_pvar_dataDownloaded", false ] ) exitWith { cutText [ T8L_var_TLine04, "PLAIN" ]; };
	
	cutText [ T8L_var_TLine03, "PLAIN" ];
	
	_laptop setVariable [ "T8L_pvar_inUse", true, true ];
		
	[ _laptop, _id ] spawn 
	{
		private [ "_laptop", "_id", "_newFile", "_dlRate", "_percent" ];
		
		_laptop		= _this select 0;
		_id			= _this select 1;
		
		_newFile = 0;
		T8L_var_DialogAbort = false;
		T8L_var_DialogSucce = false;
		
		createDialog "T8L_DataDownloadDialog";
		
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine06 ];
		sleep 0.5;
		ctrlSetText [ 8001, T8L_var_TLine07 ];		
		ctrlSetText [ 8003, format [ "%1 kb", T8L_var_FileSize ] ];		
		ctrlSetText [ 8004, format [ "%1 kb", _newFile ] ];		
		
		while { !T8L_var_DialogAbort } do
		{
			_dlRate = 200 + random 80;
			_newFile = _newFile + _dlRate;

			if ( _newFile > T8L_var_FileSize ) then 
			{
				_dlRate = 0;		
				_newFile = T8L_var_FileSize;
				
				ctrlSetText [ 8001, T8L_var_TLine04 ];			
				cutText [ T8L_var_TLine04, "PLAIN" ];
				
				T8L_var_DialogAbort = true;
				T8L_var_DialogSucce = true;
				_laptop setVariable [ "T8L_pvar_dataDownloaded", true, true ];			

			};
			
			// percentage part by cuel!
			ctrlSetText [ 8002, format [ "%1 kb/t", _dlRate ] ];        
			_percent =  ( _newFile / T8L_var_FileSize );
			_percent = toArray str _percent;
			{ _percent set [_x,-1] } forEach [ 0, 1 ]; 
			_percent = _percent - [-1];
			_percent resize 2;
			_percent = toString _percent;
			ctrlSetText [ 8004, format [ "%1 kb (%2%3)", _newFile, (if ( T8L_var_DialogAbort ) then { 100 } else { _percent }), "%" ]];
			
			sleep 0.25;
		};
		
		T8L_var_DialogAbort = false;

		_laptop setVariable [ "T8L_pvar_inUse", false, true ];	
		_laptop setVariable [ "T8L_pvar_dataDownloaded", false, true ];
	};
};

T8L_var_INITDONE = true;

Thank you so much for fixing this for me. All I have to do now is add my own values (easy work) thanks again HazJ.

Share this post


Link to post
Share on other sites

No problem. Glad it's working for you now.

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

×