Shaz Simple Mouse Script enable/disable FIX

● ARCHIVED · READ-ONLY
Started by Kes 9 posts View original ↗
  1. Save Mouse Selection in Shaz' Super Simple Mouse System for Ace v.1.0

    Shaz and Engr. Shana



    This relates to Shaz' Mouse Script which is found here: http://forums.rpgmakerweb.com/index.php?/topic/17829-amaranths-super-simple-mouse-system-for-ace/

    Objective

    To give the player the choice to enable or disable the custom mouse at any point in the game.

    These two scripts, taken together, enable the game to remember the data when the player restarts the game after quitting entirely, and solve the bug of having both the custom mouse icon and the default mouse icon showing simultaneously if the player has changed their mind and re-enabled the mouse.

    How to use

    Place under Shaz' Mouse script, with Part One above Part Two.

    Designate an appropriate switch

    At the beginning of the game, use a script call to enable the mouse

    $mouse.enabled = true

    To give the player the choice have a mechanism (I use an extra line in the main Menu) which will run these script calls

    To enable the mouse:

    $mouse.enabled = true

    Mouse.shaz?(0)

    To disable the mouse

    $mouse.enabled = false

    Mouse.shaz?(1)

    Demo and screenshots

    Not applicable.

    Scripts

    Save Mouse Selection Part One

    Spoiler
    Code:
    #Save Mouse selection Part One
    #USE: Place under Shaz Super simple Mouse System
    #Select a switch and NAME IT.  Insert the number at line 11 without
    #leading zeros e.g. not switch = 008 but switch = 8
    #For further use information see Save Mouse selection Part Two which
    #must be used in conjunction with this script
    #CREDITS: Shaz, Engr. Shana
    #===============================================================================
    module SHAZ
      module MouseSwitch
        ENABLED_SWITCH = 4
      end
    end
    
    class Sprite_Mouse < Sprite
    
      def enabled=(value)
        @enabled = value
        $game_switches[SHAZ::MouseSwitch::ENABLED_SWITCH] = value
        self.visible = value
      end
    end
    
    module DataManager
      class << self
        alias shaz_mouse_switch_load_game load_game
        alias shaz_mouse_switch_setup_new_game setup_new_game
      end
    
      def self.load_game(index)
        loaded = shaz_mouse_switch_load_game(index)
        if loaded
          $mouse.enabled = $game_switches[SHAZ::MouseSwitch::ENABLED_SWITCH] if $mouse && $game_switches
          return true
        else
          return false
        end
      end
    
      def setup_new_game
        shaz_mouse_switch_setup_new_game
        $mouse.enabled = true if $mouse
      end
    end
    class Sprite_Mouse < Sprite
    
      def enabled=(value)
        @enabled = value
        $game_switches[SHAZ::MouseSwitch::ENABLED_SWITCH] = value
        self.visible = value
        Mouse.update
      end
    end
    Save Mouse Selection Part Two

    Spoiler
    Code:
    #Save Mouse Selection Part Two
    #USE: Place under Save Mouse Selection Part One
    #Use an event with this script call at the beginning of the game so that
    #the game begins with the mouse enabled.
    #$mouse.enabled = true
    #To give the player the choice of enabling/disabling the mouse during the game
    #provide an event - e.g. as a choice in the Main Menu - which does the
    #following:
    #To enable the mouse
    #script call with 2 elements
    #$mouse.enabled = true
    #Mouse.shaz?(0)
    #To disable the mouse
    #script call with 2 elements
    #$mouse.enabled = false
    #Mouse.shaz?(1)
    #
    #CREDIT: Engr. Shana
    #===============================================================================
    module Mouse
      def self.shaz?(show)
        ShowCursor.call(show)
      end
    end
    Credits

    I asked for the final fixes, and am posting it publicly because I think that other people may find it useful. These are in no way my work. Engr. Shana is happy for it to be made public. Credit:

    Shaz

    Engr. Shana

    EDIT

    Forgot to put this in.

    Terms of use

    Free for commercial and non-commercial, but credit must be given.
  2. I tried, and failed.  As far as I could work out, simply turning the switch ON/OFF wasn't enough.  It actually needs the script call, and I couldn't see how to do that with Yanfly's settings.  

    I put it in as an extra line in the Main Menu using Yanfly's Ace Menu Engine.  I removed the # at line 108, enabling it to call up a Common Event.  I put the info in at line 128.  That CE uses a Show Choice screen.  I put the script calls in there. 
  3. I think the forum new version messed up the scripts text in the quote. I tried to align it correctly in the engine but it doesn't work. Can you rearrange it, please. Thanks. :)
  4. @Kes The script code for this script is broken. Do you have the original somewhere?
  5. @bgillisp corect format now in the spoilers.
  6. Thanks! I bookmarked the page for now as I'm going to try to add the choice to Yanfly's Options menu so it doesn't have to be a game only choice. Just need the 'free time' to do that now (hopefully later today though!)
  7. I just wanted to let you know that I was able to add mouse support to my game via a choice in the systems menu with this. It took a little coding but the same idea can be used there, just have the code call the same two commands to turn on or off the mouse when you select the right toggle.
  8. @bgillisp Would you mind showing how you made it work with yanfly options menu please?