Jump to content

Dialog boxes and Launching


Recommended Posts

So, I've got a bit of a problem. 1: I haven't coded since like 0.90, and 2: I need to get myself a dialog box BEFORE the loading screen on launches. That is, execute a function when the "Launch" button is pressed in either the editor or the ksc screens, preventing the loading until the function returns and/or is resolved in another way. For example, the recovery warning when trying to launch with a vessel on pad does this. I merely ask for two things: Is it possible, and if, how. And of course I have the alternative of using onVesselRollout or something, but I really want to do it before the loading screen. Before attacking me for this, I have spent the last hour trying to figure it out. Sorry for the possibly stupid question, just looking for help, and thanks in advance! For context I'm using a ScenarioModule with the [KSPScenario] attribute.

Link to comment
Share on other sites

1 minute ago, linuxgurugamer said:

Look at Kerbal Construction Time, also KRASH,mthey both intercept the launch key

Thanks, will look into it. Stupid that there doesn't seem to be an obvious way to do it, since so many nearly useless events have an obvious way to intercept them. Then again, the launch function was probably one of the first implemented, ever.

Link to comment
Share on other sites

If you really must, you could try using Harmony to patch a prefix or postfix onto the click handler for the launch button(s) or somewhere else relevant to intercept a launch and do your stuff before allowing rest of the program flow to resume.

I've had success with using this approach as a workaround for events that I am interested in but don't have any corresponding entry in GameEvents.

Link to comment
Share on other sites

2 hours ago, cakepie said:

If you really must, you could try using Harmony to patch a prefix or postfix onto the click handler for the launch button(s) or somewhere else relevant to intercept a launch and do your stuff before allowing rest of the program flow to resume.

I've had success with using this approach as a workaround for events that I am interested in but don't have any corresponding entry in GameEvents.

I don't recommend this.  There is a way to do it, the mods I mentioned already use it, as well as (I believe) EPL, and maybe some others.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...