The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Create & Discover > Game Development > Scripts & Tutorials
Reload this Page Essentials Script F12 Fix
Sign Up Rules/FAQ Daily Battle Blogs Mark Forums Read


Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Reply
 
Thread Tools
  #1    
Old July 3rd, 2013 (3:00 PM). Edited July 3rd, 2013 by Pia Carrot.
Pia Carrot's Avatar
Pia Carrot Pia Carrot is offline
is only game bro
 
Join Date: Aug 2010
Age: 20
Gender: Male
Nature: Adamant
Posts: 599
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:


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!
__________________




is only game
Reply With Quote

Relevant Advertising!

Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 10:20 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2016 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2016.