Is there a way we can have a script run BEFORE we fully log out. I.e. I click the X in the top-right, and a script runs, and only if that script executes without errors will mafia close?
Yep. And in that case, I close mafia, it shows me the initial login screen again and the abort text appears under the Save Password/Auto Login/Breakfast tickboxes, where it also tells me that I'm equipping the sword behind and time pants and whatnot.
Unfortunately, my script is targeted towards people who aren't really script-savvy, and would almost certainly be unable to remember that they need to close mafia in a special way.
Is there any other way of having a logout script that can abort the logout process?
Go into a loop until the user aborts the script? Or ask for user input with a helpful message? That way, even if the logout process still carries on when the script is aborted/the user hits 'yes', he knows he has unfinished business and needs to log back on.