Jump to content
Sign in to follow this  
Bitchmaker

[Help] Abort confirmation?

Recommended Posts

Is there a way to require confirmation before aborting during a mission?

I ask because the respawn and abort buttons are right next to each other, and as Zeus this has caused me to close the session by accident on more than one occasion (this happens when I have taken over an ai and the players kill me, and I am clicking a little too fast and accidentally hit abort instead of respawn.) A simple "are you sure? yes/no" type of confirmation when you hit abort would prevent that.

Share this post


Link to post
Share on other sites

Yes, there should be a way.

 

This is untested, and I doubt it'll work due to constraints with the buttonSetAction command, but you could try this (it'll probably need some tweaking).

waitUntil {isNull (findDisplay 49)};
_AbortButton = ((findDisplay 49) displayCtrl 1010;
                                
_AbortButton buttonSetAction format ["_Action = [""closeDialog 49"", %1] select ([""Are you sure you want to abort?"", ""Abort Check"", true, true] call BIS_fnc_guiMessage); call compile _Action;", (buttonAction _AbortButton)];;

Add this to your onPauseMenu script that is defined in the description.ext (see https://community.bistudio.com/wiki/Description.ext#onPauseScript)

 

All this code does is replaces the action of the abort button temporarily to display the GUI menu to ask if you do want to abort, and if you click yes it executes the code that is originally set to the button. However, I haven't looked into the way that the Menu assigns the

 

The other way of doing this is to temporarily disable the Abort button for a set period of time, this can be done the same way but instead do this:

waitUntil {!isNull (findDisplay 49)};
_AbortButton = ((findDisplay 49) displayCtrl 1010);

_AbortButton ctrlEnable false;
sleep 10;
_AbortButton ctrlEnable true;

The second option is almost certain to work.

 

  • Like 1

Share this post


Link to post
Share on other sites
9 hours ago, Chewz said:

Yes, there should be a way.

 

This is untested, and I doubt it'll work due to constraints with the buttonSetAction command, but you could try this (it'll probably need some tweaking).


waitUntil {isNull (findDisplay 49)};
_AbortButton = ((findDisplay 49) displayCtrl 1010;
                                
_AbortButton buttonSetAction format ["_Action = [""closeDialog 49"", %1] select ([""Are you sure you want to abort?"", ""Abort Check"", true, true] call BIS_fnc_guiMessage); call compile _Action;", (buttonAction _AbortButton)];;

Add this to your onPauseMenu script that is defined in the description.ext (see https://community.bistudio.com/wiki/Description.ext#onPauseScript)

 

All this code does is replaces the action of the abort button temporarily to display the GUI menu to ask if you do want to abort, and if you click yes it executes the code that is originally set to the button. However, I haven't looked into the way that the Menu assigns the

 

The other way of doing this is to temporarily disable the Abort button for a set period of time, this can be done the same way but instead do this:


waitUntil {!isNull (findDisplay 49)};
_AbortButton = ((findDisplay 49) displayCtrl 1010);

_AbortButton ctrlEnable false;
sleep 10;
_AbortButton ctrlEnable true;

The second option is almost certain to work.

 

 

Thank you for your reply, ChewZ. Much appreciated.  I tried the second way by copying the script you posted and placing in my description.ext.  Unfortunately, it did not work.  I'm betting I did it wrong. 

Can you post more info about what you meant when you wrote, "add this to your onPauseMenu script"?  (Sorry, I'm only a basic-level script user)

Thank you!!

 

Share this post


Link to post
Share on other sites
13 hours ago, Bitchmaker said:

 

Thank you for your reply, ChewZ. Much appreciated.  I tried the second way by copying the script you posted and placing in my description.ext.  Unfortunately, it did not work.  I'm betting I did it wrong. 

Can you post more info about what you meant when you wrote, "add this to your onPauseMenu script"?  (Sorry, I'm only a basic-level script user)

Thank you!!

 

No worries man.

 

In the folder where your mission folder, you should have a description.ext file? If you don't create one. Ensure that the file format is .ext and is located in the same location as the mission.sqm.

 

If you don't know where to find this, go to your documents, then ArmA 3 (or ArmA 3 - Other Profiles if you have created your own profile), missions or MPMissions depending on where you've saved the mission files. Mission files are inside of a folder (for example. Example.tanoa) and should contain a .sqm file named 'Mission'.

 

Inside this description.ext file, you need to add in the following:

onPauseScript = "onPause.sqf";

 

You then want to create a new .sqf file called onPause.sqf in the same directory as your mission.sqm and description.ext.

 

Inside this onPause.sqf, you want to paste the following code:

 

waitUntil {!isNull (findDisplay 49)};
_AbortButton = ((findDisplay 49) displayCtrl 1010);

_AbortButton ctrlEnable false;
sleep 10;
_AbortButton ctrlEnable true;

 

You then obviously save and can now close the onPause.sqf file, and if you load and play this mission into the ArmA 3 Editor and press pause, the abort button should be disabled for 10 seconds before automatically enabling.

 

If you have any problems please don't hesitate to let me know.

 

Chewz

  • Like 1

Share this post


Link to post
Share on other sites
11 hours ago, Chewz said:

No worries man.

 

In the folder where your mission folder, you should have a description.ext file? If you don't create one. Ensure that the file format is .ext and is located in the same location as the mission.sqm.

 

If you don't know where to find this, go to your documents, then ArmA 3 (or ArmA 3 - Other Profiles if you have created your own profile), missions or MPMissions depending on where you've saved the mission files. Mission files are inside of a folder (for example. Example.tanoa) and should contain a .sqm file named 'Mission'.

 

Inside this description.ext file, you need to add in the following:


onPauseScript = "onPause.sqf";

 

You then want to create a new .sqf file called onPause.sqf in the same directory as your mission.sqm and description.ext.

 

Inside this onPause.sqf, you want to paste the following code:

 


waitUntil {!isNull (findDisplay 49)};
_AbortButton = ((findDisplay 49) displayCtrl 1010);

_AbortButton ctrlEnable false;
sleep 10;
_AbortButton ctrlEnable true;

 

You then obviously save and can now close the onPause.sqf file, and if you load and play this mission into the ArmA 3 Editor and press pause, the abort button should be disabled for 10 seconds before automatically enabling.

 

If you have any problems please don't hesitate to let me know.

 

Chewz

Chewz, thanks for your reply and your easy-to-follow directions.  Unfortunately, when I test it the script appears to disable the respawn button, not the abort button. Any thoughts?

Share this post


Link to post
Share on other sites

Hi,

 

Change ((findDisplay 49) displayCtrl 1010); to ((findDisplay 49) displayCtrl 104);

 

Apologies, I got the idc numbers mixed up!

 

Chewz

  • Like 1

Share this post


Link to post
Share on other sites

Well, good news, bad news, lol. The script works now, but only partially.  When you are alive and hit escape, the abort button is greyed out. When you die or are incapacitated and hit escape, the abort button is live again.  The situation I am trying to avoid is hitting the abort button instead of the respawn button by accident, so ideally those two situations should be reversed; the about button should be greyed out when I am killed/incapacitated. not necessarily when I am alive.

Thank you for hanging with this, Chewz.  If you'd rather not be bothered, it's no problem, I am still appreciative that you gave of your time in this way.  You're a prince (or princess, whatever the case may be.)

 

Share this post


Link to post
Share on other sites
13 hours ago, Bitchmaker said:

Well, good news, bad news, lol. The script works now, but only partially.  When you are alive and hit escape, the abort button is greyed out. When you die or are incapacitated and hit escape, the abort button is live again.  The situation I am trying to avoid is hitting the abort button instead of the respawn button by accident, so ideally those two situations should be reversed; the about button should be greyed out when I am killed/incapacitated. not necessarily when I am alive.

Thank you for hanging with this, Chewz.  If you'd rather not be bothered, it's no problem, I am still appreciative that you gave of your time in this way.  You're a prince (or princess, whatever the case may be.)

 

That's strange. It sounds like the script is hanging on the waitUntil.

 

Can you please change the onPause script to this:

diag_log format ["ONPAUSE: ALIVE = %1", alive player];
diag_log "ONPAUSE: STARTED";
waitUntil {!isNull _pauseMenuDisplay};
diag_log "ONPAUSE: WAIT UNTIL PASSED";
_AbortButton = (_pauseMenuDisplay displayCtrl 1010);

_AbortButton ctrlEnable false;
sleep 10;
_AbortButton ctrlEnable true;

Once you have retested this, can you please send me your rpt (put it as a spoiler when you paste it in here)

Thanks

 

Chewz

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
Sign in to follow this  

×