• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

F12 Fix

Hello, today my co-worker found a bug in my game regarding the F12 button while sliding on ice(?) downwards. So, I remembered this script by Zeriab that replaces the reset function of F12 with a pausing image. I tweaked the script to be completely functional with Essentials, and I felt it should be shared for other developers. Enjoy:

Code:
############################################################
#F12 Pause Menu
#By Zeriab and tweaked by Pia Carrot
#Now will show pause menu over other menus
#
#Instructions
#Add an image called "f12.png" to your Graphics/Pictures folder
#F12 will no longer reset your game and will display this image
#until you press F12 again.
#
#
#Credits must be given to Zeriab.
#Enjoy this tweaked script for use of Pokemon Essentials
#############################################################

class Reset < Exception
 
end

module Graphics
  class << self

     unless self.method_defined?(:zeriab_f12_pause_update)
        alias_method(:zeriab_f12_pause_update, :update)
        alias_method(:zeriab_f12_pause_transition, :transition)
     end

     def update(*args)
        # Try to update normally
        begin
           zeriab_f12_pause_update(*args)
           return
        rescue Reset
           # Do nothing
        end
        # F12 has been pressed
        done = false
        # Store frame count
        frame_count = Graphics.frame_count
        # Show pause image
        @sprite = Sprite.new
        @sprite.z = 99999
        begin
           @sprite.bitmap = RPG::Cache.picture('f12')
        rescue
           @sprite.bitmap = Bitmap.new(32,32)
        end
        # Keep trying to do the update
        while !done
           begin
              zeriab_f12_pause_update(*args)
              done = true
           rescue Reset
              # Do Nothing
           end
        end
        # F12 has been released, update until it is pressed again
        while done
           begin
              zeriab_f12_pause_update(*args)
           rescue Reset
              done = false
           end
        end
        # F12 has been pressed, keep trying to update
        while !done
           begin
              zeriab_f12_pause_update(*args)
              done = true
           rescue Reset
              # Do nothing
           end
        end
        # F12 has been released, dispose pause image
        @sprite.dispose
        # Set proper frame count
        Graphics.frame_count = frame_count
     end

     def transition(*args)
        done = false
        # Keep trying to do the transition
        while !done
           begin
              zeriab_f12_pause_transition(*args)
              done = true
           rescue Reset
              # Set transition length to 0 frames.
              args[0] = 0
           end
        end
     end
  end
end

Instructions

Add an image called "f12.png" to your Graphics/Pictures folder. It should be the same size as your game's screen size (though it doesn't have to be!). And...Place the script above all other scripts. Yup...That's it.

Credits

Only Zeriab is to be credited, I only changed 2 lines of this script. If you want to credit me that's all on you.

Screenshots

Not much to show here but here you go anyway:
[PokeCommunity.com] F12 Fix


Compatability and Bugs

Shouldn't be any bugs, and if one occurs let me know. This freezes graphics entirely so it should be fine. This should not be compatable with any other F12 Fixes. That's the bucket list for ya'.

Thanks for looking, enjoy!
 
Last edited:
Back
Top