Unsolved Game Close Event?

Discussion in 'Mod Support' started by StinchinStein, Feb 19, 2017.

  1. StinchinStein

    StinchinStein
    Expand Collapse

    Joined:
    Jul 16, 2014
    Messages:
    754
    Is there a way to run a script (whether it be JavaScript or BeamEngine) when the game is about to close via "X" or the quit button?

    I've tried onClientEndMission, but it doesn't seem to work when closing the game like that.

    Thanks,
    StinchinStein
     
    #1 StinchinStein, Feb 19, 2017
    Last edited: Feb 19, 2017
  2. torsion

    torsion
    Expand Collapse

    Joined:
    May 31, 2015
    Messages:
    1,600
    I see what you mean. Here are all the hooks called after you click the "X" to close the game.

    updateGFX
    onVehicleDestroyed
    onDespawnObject
    onDebugDraw
    onSettingsChanged

    The way I determined this was by modifying extensions.lua - please see the attached screenshot for what I did.

    I'd say that none of the hooks called after clicking the "X" do what you are asking for precisely. Depending on what you want to do it might be practical to use one of them anyway. For example if you're trying to save the state of something lightweight you could simply do it every time onDespawnObject is called.
     

    Attached Files:

    • upload_2017-4-21_19-49-54.png
    • Informative Informative x 1
  3. StinchinStein

    StinchinStein
    Expand Collapse

    Joined:
    Jul 16, 2014
    Messages:
    754
    Thanks for the response @torsion,
    I completely forgot about this until you replied to it. I'll definitely see if I can do something with this information :)
     
    • Like Like x 1
  4. torsion

    torsion
    Expand Collapse

    Joined:
    May 31, 2015
    Messages:
    1,600
    I hope it helps!

    I'm sure you realize this, but just to be absolutely clear for anyone else trying to use the information I posted: Some of those hooks are called for many other things. None of them directly have anything to do with the game being closed. For example, updateGFX and onDebugDraw are definitely called constantly in the normal course of the game.
     
    • Agree Agree x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice