RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
F12 fix

0 Members and 1 Guest are viewing this topic.

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
After the F12 bother me one time too many I made this little snippet:
Copy and paste it as the very first script. (Top in the editor, above Game_Temp)
Code: [Select]
#=begin
unless $f12_cleaner_F3XXEFA1.nil?
  # Opens the game executable in a new thread
  Thread.new{system ("Game")}  # "Game" = Name of the game executable
  # Exits this thread
  exit
end

# Modifying this global variable might cause this snippet to stop working properly.
# Some garbage have been added to lessen the chance of it already being used
$f12_cleaner_F3XXEFA1 = true
#=end

It will close the current game and open a new game.
If you have Vista it might require you to give permission since it actually opens a new application.
There might be issues with it, so tell me if you find any.

Also, it's different from the unofficial SDK solution in that you can restart the game by pressing F12.

Enjoy ~

Edit:
Here is another snippet which works better in my opinion.
This prevents the F12 key from resetting the game.
For some reason pressing the F12 key now seems to speed up the game in many cases and in other pauses the game.

Code: [Select]
#=============================================================================
# ** Reset class (because it won't be defined until F12 is pressed otherwise)
#=============================================================================
class Reset < Exception
 
end
#=============================================================================
# ** Module Graphics
#=============================================================================
module Graphics
  class << self
    #-------------------------------------------------------------------------
    # * Aliases Graphics.update and Graphics.transition
    #-------------------------------------------------------------------------
    unless self.method_defined?(:zeriab_f12_removal_update)
      alias_method(:zeriab_f12_removal_update, :update)
      alias_method(:zeriab_f12_removal_transition, :transition)
    end
    def update(*args)
      begin
        zeriab_f12_removal_update(*args)
      rescue Reset
        # Do nothing
      end
    end
    def transition(*args)
      done = false
      # Keep trying to do the transition
      while !done
        begin
          zeriab_f12_removal_transition(*args)
          done = true
        rescue Reset
          # Do nothing
        end
      end
    end
  end
end

For an extreme example of the speed up issue I mentioned here is a picture:


I don't know whether it actually went with 410 FPS or if something broke.

*hugs*
 - Zeriab
« Last Edit: April 20, 2008, 09:22:54 PM by Zeriab »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
What was the bug with F12 before?

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
There seems to be no bugs with the default scripts.
Problem is however that stuff like global variables are preserved and some scripts give errors during their second read-through.
A common error is a stack error occurring in scripts where you alias a method.

*
A Random Custom Title
Rep:
Level 96
wah

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Move to Database?

*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
*Updates*
I have found a way to prevent the game from being reset when pressing F12. Look in the first post for more details ^_^
*hugs*
 - Zeriab