Jump to content
HazJ

[Abandoned] [Release] Download Data (from End Game)

Recommended Posts

I can't test at the moment as I am at work. It is a while-loop, it runs while the condition is true. When you move X distance away, it will exitWith... The loop should stop as well. The code at end of file might not run if exitWith is ran, this is why I said put code for abort there. Are you saying the while loop code (eg: hint) runs after you move away?

Share this post


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

I can't test at the moment as I am at work. It is a while-loop, it runs while the condition is true. When you move X distance away, it will exitWith... The loop should stop as well. The code at end of file might not run if exitWith is ran, this is why I said put code for abort there. Are you saying the while loop code (eg: hint) runs after you move away?

 

Yes, everything after exitWith gets run.

 

	if (player distance2d getPosATL _object > 20) exitWith
	{	
		("layer_rsc_downloadingData" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
	};
  sleep 1;
	// hintSilent "still running";  // This will excute 1 second after starting the download
};

("layer_rsc_downloadingData" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
hint "Complete";  // This will excute after moving out of range. It will also run when you complete the download.

 

Share this post


Link to post
Share on other sites

Yes. What do you want to happen then? What is it you are trying to achieve? Just put your code that you want to run when aborted inside the exitWith, and at the end of for completion.

("layer_rsc_downloadingData" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];

if (_downloaded < 100) then
{
	// this code SHOULD only run if _downloaded is less than 100 - meaning that the download was aborted and didn't reach 100
	hintSilent "Download failed";
};

 

Share this post


Link to post
Share on other sites

Ah yes, my brain has found a sense of logic at last

 

@snakeplissken

This is probably what you wanted

while {_downloaded < 100 && "layer_rsc_downloadingData" in allCutLayers} do
{
	_downloaded = _downloaded + _increment;
	(_display displayCtrl 300) ctrlSetText format ["%1", {alive _x && _x distance2d getPosATL _object <= 20} count allUnits];
	(_display displayCtrl 400) progressSetPosition (_downloaded / 100);
	(_display displayCtrl 500) ctrlSetText format ["%1%2 / 100%2", _downloaded, "%"];
	(_display displayCtrl 700) ctrlSetText format ["%1", call _getSignal];
	
	if (player distance2d getPosATL _object > 13) exitWith
	{	
	
		("layer_rsc_downloadingData" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
	};
  sleep 1;
	 hintSilent "Download is running";
	 
};

("layer_rsc_downloadingData" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];

Hint "Download is finished";


if (_downloaded < 100) then
{
	hintSilent "Download is interrupted";
	
};

 

  • Like 1

Share this post


Link to post
Share on other sites

I do plan on updating this some time in the near future, no ETA yet. The new version will have many new features and options. It will be very configurable. I plan on adding some functions for ease of use as well. One of the features will be fully MP compatible.

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, HazJ said:

I do plan on updating this some time in the near future, no ETA yet. The new version will have many new features and options. It will be very configurable. I plan on adding some functions for ease of use as well. One of the features will be fully MP compatible.

 

I look forward to it.

I think with that thing out of the way I can go crazy with it from here.

Thanks alot for making this for us <3

  • Like 1

Share this post


Link to post
Share on other sites

No problem. I didn't make this specific resource, that was taken from End Game, created by BIS. I might add some more resources. Then people can select which one they want, the current one will always be the same and the default one. I just did the code.

Share this post


Link to post
Share on other sites

So I ran another test.

 

Simply having the code like this

("layer_rsc_downloadingData" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];

Hint "Download is finished";

Wont work. It will still be excuted even if its interrupted.

I think we will need to have a line code detect when the download is at 100% . Same way you did when it got interrupted.

I dont know what commands to use tho, any ideas?

Share this post


Link to post
Share on other sites
if (_downloaded > 99) then
{
	hintSilent "Download finished";
	
};

I plan to updating most of the code along with new things as mentioned above, when I get time that is. For now, just use the above.

Share this post


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

if (_downloaded > 99) then
{
	hintSilent "Download finished";
	
};

I plan to updating most of the code along with new things as mentioned above, when I get time that is. For now, just use the above.

Ah yes I iniatally hoped changing the arrow would have fixed it but I had the value set to 100 so it didnt work.

Thanks for fixing that for me, it works now

Share this post


Link to post
Share on other sites
3 minutes ago, Carlos A. Gonzalez Dominguez said:

Hi guys, probably a stupid question, how can animate the data terminal? i cant find the animation :(

[DataTerminal,3] call BIS_fnc_dataTerminalAnimate; 

https://community.bistudio.com/wiki/BIS_fnc_DataTerminalAnimate

you can also change the color

[dataterminal,"red","red","red"] call BIS_fnc_DataTerminalColor; // Changes the colour to red

 

Share this post


Link to post
Share on other sites

@Hazj and @greenpeacekiller, 

 

I modified leaving it as it is below, and now and it is working perfectly!

Many thanks to you both for helping me a lot!

It's people like you who take pride in this forum.

scriptName "script\fn_downloadData";

/*
	Code written by Haz
*/

#define __FILENAME "script\fn_downloadData.sqf"

if (isDedicated || !hasInterface) exitWith {};

disableSerialization;

_object = dataTerminal1;

_getSignal =
{
	_signal = switch (true) do
	{
		case (player distance2d getPosATL _object <= 5) :
		{
			"a3\Ui_f\data\IGUI\RscTitles\RscHvtPhase\JAC_A3_Signal_4_ca.paa"
		};
		case (player distance2d getPosATL _object > 5 && player distance2d getPosATL _object <= 6) :
		{
			"a3\Ui_f\data\IGUI\RscTitles\RscHvtPhase\JAC_A3_Signal_3_ca.paa"
		};
		case (player distance2d getPosATL _object > 6 && player distance2d getPosATL _object <= 9) :
		{
			"a3\Ui_f\data\IGUI\RscTitles\RscHvtPhase\JAC_A3_Signal_2_ca.paa"
		};
		case (player distance2d getPosATL _object > 9 && player distance2d getPosATL _object <= 13) :
		{
			"a3\Ui_f\data\IGUI\RscTitles\RscHvtPhase\JAC_A3_Signal_1_ca.paa"
		};
		case (player distance2d getPosATL _object > 13) :
		{
			""
		};
	};
	_signal
};

_display = uiNamespace getVariable "disp_downloadingData";

(_display displayCtrl 200) ctrlSetText "Carregando o arquivo...";

_downloaded = 0;
_increment = 2;

while {_downloaded < 100 && "layer_rsc_downloadingData" in allCutLayers} do
{
	_downloaded = _downloaded + _increment;
	(_display displayCtrl 300) ctrlSetText format ["%1", {alive _x && _x distance2d getPosATL _object <= 13} count allUnits];
	(_display displayCtrl 400) progressSetPosition (_downloaded / 100);
	(_display displayCtrl 500) ctrlSetText format ["%1%2 / 100%2", _downloaded, "%"];
	(_display displayCtrl 700) ctrlSetText format ["%1", call _getSignal];
	if (player distance2d getPosATL _object > 13) exitWith
	{
		("layer_rsc_downloadingData" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];

	};
	if (_downloaded >= 100) then
{
	Download_OK = true;
	publicVariable "Download_OK";
	Download_OK remoteExec ["true"];
	["Bingo!"] remoteExec ["hint", 0];
	
};
  sleep 1;
	// hintSilent "still running";
};

("layer_rsc_downloadingData" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
// hintSilent "not running";

if (_downloaded >= 100) then
{
	Download_OK = true;
	publicVariable "Download_OK";
	Download_OK remoteExec ["true"];
	["Bingo!"] remoteExec ["hint", 0];
	
};

 

** Even if you use the command just at the end of the script it still works, but to avoid any error, decide to leave the two commands in the two locations that were mentioned here.

Share this post


Link to post
Share on other sites
8 hours ago, snakeplissken said:


	};
	if (_downloaded >= 100) then
{
	Download_OK = true;
	publicVariable "Download_OK";
	Download_OK remoteExec ["true"];
	["Bingo!"] remoteExec ["hint", 0];
	
};
  sleep 1;
	// hintSilent "still running";
};

("layer_rsc_downloadingData" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
// hintSilent "not running";

if (_downloaded >= 100) then
{
	Download_OK = true;
	publicVariable "Download_OK";
	Download_OK remoteExec ["true"];
	["Bingo!"] remoteExec ["hint", 0];
	
};

 

 

I am not expert but I do not think you need to duplicate it like this.

Having it only 1x instead of 2x should still work.

Share this post


Link to post
Share on other sites
21 hours ago, greenpeacekiller said:

 

I am not expert but I do not think you need to duplicate it like this.

Having it only 1x instead of 2x should still work.

That's what I realized too!

 

Just using it once at the end of the script, it also works perfectly.

 

And taking advantage, thank you very much for the help.

Share this post


Link to post
Share on other sites

im a little confused about this script, i cant seem to get it to work properly. once u step away it ends and doesn't restart.  will it be updated?

Share this post


Link to post
Share on other sites

Hello,

That is what it is supposed to do. Even if other players are near. I did say in original post that isn't fully MP compatible at the moment. I plan to update it when I get chance. I plan to add feature where if you move 100 m (for example) but return in 5 seconds it doesn't abort. I have just been extremely busy with work lately. I have a lot planned, just not sure when. No ETA atm.

Share this post


Link to post
Share on other sites

Anyone know how to remove the "Downloading data....." graphic when it's at 100% ?

Share this post


Link to post
Share on other sites
2 hours ago, major-stiffy said:

Anyone know how to remove the "Downloading data....." graphic when it's at 100% ?

The whole thing disappears after it downloads? Or do you mean the text or? I don't remember what graphic you are referring to ha. Long day at work, just strolled in! :grinning:

Share this post


Link to post
Share on other sites

Update (no release yet):

I have started on the update for this... Here is what you can expect in the next update or so:

- New configurable options that you can pass to the function

- New function to create a download point without having to set it up in Editor

- MP compatible for all players

- Abort cooldown (if last player returns to min distance before X seconds) then it doesn't abort

- Code improvements

Has anyone got any other suggestions or anything that they want to see? Options as of this moment:

Quote

OBJECT - Pass object which will be used as the download point (you can pass an array instead of an object to create a new download point which hasn't been setup in the editor

DISTANCES - Used for signal strengths

MULTIPLIER - Pass number or array of classnames that will speed it up compared to normal roles (example: ["B_engineer_F", "O_engineer_F", "I_engineer_F"])

DOWNLOAD TEXT - Pass your own text (default: toUpper ("Downloading data..."))

 

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, HazJ said:

The whole thing disappears after it downloads? Or do you mean the text or? I don't remember what graphic you are referring to ha. Long day at work, just strolled in! :grinning:

 

Actually was was trying a combo of your script and snakeplissken. I liked some of the things he was doing. I got it all to work except the download bar on the screen left would get to 100% and then not fade away.

 

Trying your mission only with your virgin scripts also worked but it wasn't repeatable each time I played the mission in VR from a restart.

 

Others things I was trying to do was open the Data terminal  _object = dataTerminal1; by adding [DataTerminal1,3] call BIS_fnc_dataTerminalAnimate; in a trigger OnAct.  It works.

 

Also ["Task1", "SUCCEEDED",true] spawn BIS_fnc_taskSetState; in your fn_downloadData.sqf. It works after I created task1 task of course.

 

I like this idea of yours and I'm fairly new to scripting and am definitely looking forward to any updates you do.

Spoiler

scriptName "fn_downloadData";

/*
    Code written by Haz
*/

#define __FILENAME "fn_downloadData.sqf"

if (isDedicated || !hasInterface) exitWith {};

disableSerialization;

_object = dataTerminal1;

_getSignal =
{
    _signal = switch (true) do
    {
        case (player distance2d getPosATL _object <= 5) :
        {
            "a3\Ui_f\data\IGUI\RscTitles\RscHvtPhase\JAC_A3_Signal_4_ca.paa"
        };
        case (player distance2d getPosATL _object > 5 && player distance2d getPosATL _object <= 6) :
        {
            "a3\Ui_f\data\IGUI\RscTitles\RscHvtPhase\JAC_A3_Signal_3_ca.paa"
        };
        case (player distance2d getPosATL _object > 6 && player distance2d getPosATL _object <= 9) :
        {
            "a3\Ui_f\data\IGUI\RscTitles\RscHvtPhase\JAC_A3_Signal_2_ca.paa"
        };
        case (player distance2d getPosATL _object > 9 && player distance2d getPosATL _object <= 13) :
        {
            "a3\Ui_f\data\IGUI\RscTitles\RscHvtPhase\JAC_A3_Signal_1_ca.paa"
        };
        case (player distance2d getPosATL _object > 13) :
        {
            ""
        };
    };
    _signal
};

_display = uiNamespace getVariable "disp_downloadingData";

(_display displayCtrl 200) ctrlSetText "DOWNLOADING DATA...";

_downloaded = 0;
_increment = 5;

while {_downloaded < 100 && "layer_rsc_downloadingData" in allCutLayers} do
{
    _downloaded = _downloaded + _increment;
    (_display displayCtrl 300) ctrlSetText format ["%1", {alive _x && _x distance2d getPosATL _object <= 13} count allUnits];
    (_display displayCtrl 400) progressSetPosition (_downloaded / 100);
    (_display displayCtrl 500) ctrlSetText format ["%1%2 / 100%2", _downloaded, "%"];
    (_display displayCtrl 700) ctrlSetText format ["%1", call _getSignal];
    if (player distance2d getPosATL _object > 13) exitWith
    {
        ("layer_rsc_downloadingData" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];

    };
    /*if (_downloaded >= 100) then
{
    Download_OK = true;
    publicVariable "Download_OK";
    Download_OK remoteExec ["true"];
    ["Bingo!"] remoteExec ["hint", 0];
    
};
*/
  sleep 1;
    // hintSilent "still running";
};

("layer_rsc_downloadingData" call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
// hintSilent "not running";

if (_downloaded >= 100) then
{
    Download_OK = true;
    publicVariable "Download_OK";
    Download_OK remoteExec ["true"];
    ["Bingo!"] remoteExec ["hint", 0];
    ["Task1", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
};

 

 

Share this post


Link to post
Share on other sites

Okay. Yeah, I noticed the bad example mission (doesn't repeat after restart from menu). I usually use debug for everything testing but have fixed this for next release. A lot of changes will be included in next update along with custom code section which will run (optional). Along with this I am going to create some function that returns actual progress of bar, etc...

  • Like 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

×