Go Back   The PokéCommunity Forums > Creative Discussions > Game Development > Scripts & Tutorials
Reload this Page [Essentials script] F12 Fix

Notices
For all updates, view the main page.

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 (03:00 PM). Edited July 3rd, 2013 by Pia Carrot.
Pia Carrot's Avatar
Pia Carrot Pia Carrot is offline
Gen II Hacker | PHO Enthusiast
 
Join Date: Aug 2010
Age: 19
Gender: Male
Nature: Adamant
Posts: 559
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!
__________________




Coming soon to a forum near you...
Reply With Quote
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 UTC -8. The time now is 10:49 AM.