Jump to content
kingofnuthin1980

How to exit mission with script (not end mission) [SOLVED]

Recommended Posts

Hi,

 

how can I exit a mission with a script, like when hitting the "save and exit" button? I don't want the mission to end.

 

Thank you in advance for your help 🙂

 

-Chris

 

 

SOLUTION:

(findDisplay 46) closeDisplay 4;

 

Share this post


Link to post
Share on other sites

You could use saveGame followed by a server kick, I guess, but there are security issues with scripting server commands. Assuming this is for MP since you want the mission to continue.

 

 

  • Like 2

Share this post


Link to post
Share on other sites
16 minutes ago, Harzach said:

You could use saveGame followed by a server kick, I guess, but there are security issues with scripting server commands. Assuming this is for MP since you want the mission to continue.

 

 

No, it's for singleplayer. I need the same function as the "save and exit" button in the escape-menu in singleplayer scenarios. When you want to resume the mission at a later time. I can't find the function for that button.

Share this post


Link to post
Share on other sites

Gotcha.  Since endMission deletes mission saves, it's useless in this case. Not sure I can see a solution. There is no function for "save and exit" or even just "exit."

 

Maybe share your reasoning behind the need for this so we have the full picture. There may be solutions that aren't currently apparent.

  • Like 1

Share this post


Link to post
Share on other sites
On 12/7/2021 at 10:30 AM, kingofnuthin1980 said:

That one does seem to do the trick:


(findDisplay 46) closeDisplay 4;

 

In the documentation it seems like two numbers are used to "emulate" the OK and Cancel buttons. Do you care to elaborate on the use of 4 as an exit code in this case?

Share this post


Link to post
Share on other sites
36 minutes ago, ZaellixA said:

In the documentation it seems like two numbers are used to "emulate" the OK and Cancel buttons. Do you care to elaborate on the use of 4 as an exit code in this case?

Sure. I need it for closing the current mission (without a mission end screen) and loading another from script, and being able to load saves from first mission.
I've found the solution in the scripts for the pause menu dialog.

Share this post


Link to post
Share on other sites

Yeah but I mean, what exactly is '4' used for? Does it have a specific meaning, or it is just a number that "people have agreed" to mean something specific?

Share this post


Link to post
Share on other sites

Probably from a defineResincl.inc or equivalent:

#define IDC_ABORT         4

as predefined control.

  • Like 5

Share this post


Link to post
Share on other sites
34 minutes ago, pierremgi said:

Probably from a defineResincl.inc or equivalent:

#define IDC_ABORT         4

as predefined control.

thank you @pierremgi. I've found it somewhere in a script with the closeDialog command, but your information is another piece to the puzzle, making it sure what 4 does. Are you going to update that on the wiki page for closeDialog?

Share this post


Link to post
Share on other sites

For anyone interested, here are the defines of exitcodes (or emulated buttons) extracted from defineResincl.inc . Thank you @pierremgi for pointing it out 🙂 .

#define IDC_OK            1
#define IDC_CANCEL        2
#define IDC_AUTOCANCEL    3
#define IDC_ABORT         4
#define IDC_RESTART       5
#define IDC_USER_BUTTON   6
#define IDC_EXIT_TO_MAIN  7

  • Like 3
  • Thanks 2

Share this post


Link to post
Share on other sites
1 hour ago, soldierXXXX said:

For anyone interested, here are the defines of exitcodes (or emulated buttons) extracted from defineResincl.inc . Thank you @pierremgi for pointing it out 🙂 .

#define IDC_OK            1
#define IDC_CANCEL        2
#define IDC_AUTOCANCEL    3
#define IDC_ABORT         4
#define IDC_RESTART       5
#define IDC_USER_BUTTON   6
#define IDC_EXIT_TO_MAIN  7

this is awesome, because I've also searched for a way to restart. thank you!

Share this post


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

Added this information

 

Look who has Biki perms! Thanks @7erra!

  • 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

×