Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 F12 Reset Fix
#1
F12 Reset Fix

Introduction
F12 reset can sometimes be a pain in the arse. This script fixes that by spawning a new Game.exe. It can also be used if you want to use the editor whilst play-testing it. You can also configure to show the console on test play.

Features
- Saves an RM user from death by F12 reset.

Script
Code:
#==============================================================
#   ** F12 Reset Fix
#   Author: Acezon
#   Date: 12 Feb 2013
#--------------------------------------------------------------
#   Version 2.0
#   - Console option added
#   - Automatically focuses window after pressing F12
#   Version 1.1
#   - Respawning the exe was better
#   Version 1.0
#   - Initial Release
#--------------------------------------------------------------
#   Credits are optional.
#     Although doing so will make me happy.
#   Thanks to Tsukihime and Cidiomar for the console scriptlet
#==============================================================

module Config
# START EDITING HERE
  Console_on = true       # Sets the console
# END EDITING HERE
end

alias f12_reset_fix rgss_main
def rgss_main(*args, &block)
  f12_reset_fix(*args) do
    if $run_once_f12
      pid = spawn ($TEST ? 'Game.exe test' : 'Game')
      # Tell OS to ignore exit status
      Process.detach(pid)
      sleep(0.01)
      exit
    end
    $run_once_f12 = true
    # Run default rgss_main
    block.call
  end
end

module SceneManager
  def self.first_scene_class
    if Config::Console_on
      # Get game window text
      console_w = Win32API.new('user32','GetForegroundWindow', 'V', 'L').call
      buf_len = Win32API.new('user32','GetWindowTextLength', 'L', 'I').call(console_w)
      str = ' ' * (buf_len + 1)
      Win32API.new('user32', 'GetWindowText', 'LPI', 'I').call(console_w , str, str.length)
      
      # Initiate console
      Win32API.new('kernel32.dll', 'AllocConsole', '', '').call
      Win32API.new('kernel32.dll', 'SetConsoleTitle', 'P', '').call('RGSS3 Console')
      $stdout.reopen('CONOUT$')
      
      # Sometimes pressing F12 will put the editor in focus first,
      # so we have to remove the program's name
      game_title = str.strip
      game_title.sub! ' - RPG Maker VX Ace', ''
      
      # Set game window to be foreground
      hwnd = Win32API.new('user32.dll', 'FindWindow', 'PP','N').call(0, game_title)
      Win32API.new('user32.dll', 'SetForegroundWindow', 'P', '').call(hwnd)
    end
    $BTEST ? Scene_Battle : Scene_Title
  end
end

Credits and Thanks
- Read the script header.
Reply }


Messages In This Thread
F12 Reset Fix - by itsacezon - 01-27-2013, 04:29 AM
RE: F12 Reset Fix - by DarkSpartan - 01-27-2013, 06:44 AM
RE: F12 Reset Fix - by yamina-chan - 01-27-2013, 10:26 AM
RE: F12 Reset Fix - by DerVVulfman - 01-28-2013, 05:29 AM
RE: F12 Reset Fix - by itsacezon - 02-12-2013, 03:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Equipment TP Reset ACE kyonides 0 943 11-01-2022, 10:47 PM
Last Post: kyonides
   DoubleX RMMV Popularized ATB Reset DoubleX 1 5,289 06-02-2016, 02:05 PM
Last Post: DoubleX
   Edited Paradog's Battle BGM Anti-Reset MicKo 1 5,846 06-27-2014, 06:05 PM
Last Post: Steel Beast 6Beets
   Battle BGM Anti-Reset ParaDog 0 3,497 03-04-2008, 04:37 AM
Last Post: ParaDog



Users browsing this thread: