Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX]Close button action

He guys, a long time ago I played a demo and when I pressed on the Close Button (The button right on the top) it moved to the title screen. The only problem is were can I find that script? Or just the script rule to make an action when the close button is pressed.
Thanks in advance ;)
 
Hmm.. Well technically you shouldnt be able to do that within a script, but more likely a rewrite of the game.exe. You might be able to achieve something like that by way of using resource hacking tool such as ResHack. I have used this tool before to redirect inputs to a GUI to other places etc. And of course it makes a backup to the current one before doing so. This is my only suggestion rather than making another red X within the game itself to be the close button.
 

Zeriab

Sponsor

Technically it is possible to handle the SystemExit exception thrown then you try to close the program by clicking the X or press Alt+F4. Here is a way it could work:
Code:
#==============================================================================

# ** Main

#------------------------------------------------------------------------------

#  After defining each class, actual processing begins here.

#==============================================================================

 

begin

  Graphics.freeze

  $scene = Scene_Title.new

  while $scene != nil

    begin

      $scene.main 

    rescue SystemExit # Crappy change

      unless $scene.is_a?(Scene_Title)

        game_exe = 'Game' # Name of the .exe file

        exec = game_exe + *' test' if $TEST # Keep test mode

        Thread.new{system(exec)}

      end

      exit

    end

  end

  Graphics.transition(30)

rescue Errno::ENOENT

  filename = $!.message.sub("No such file or directory - ", "")

  print("Unable to find file #{filename}.")

end

Personally I wouldn't recommend doing it as I dislike the 'feature'. Such a feature may indeed turn me away from an otherwise promising game.

*hugs*
 
To go into a bit more detailed explanation than 'dislike': A program should basically be designed to be intuitively operateable. This applies even more to games, where your target audience should have fun, not "learn" to play it. That being said, changing the one thing they'd expect to be the same - being the OS - is kinda radical. Imagine you just bought a new car you have to get used to, but when you start driving, you realize all the signs have changed.
 
I tend to agree with BlueScope and Zeriab on this one. I'm always a bit miffed when a program I try refuses to actually close using Alt+F4 or the X button. Either by changing the functionality entirely, or simply by adding a message to the effect of "do you really want to exit?" when there is nothing to save, modified data has already been saved, or data gets autosaved without needing the user to do anything to it. In point of fact, I have an old "fun" (in quotes for a reason) executable that explores that very aspect of programming. Every time I accidentally opened it, I would effectively think "oh, shit!" and immediately go for the task manager to kill it. I would upload it, but it was programmed under a 16 bit architecture, and most computers can't run it any more.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top