Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,315
Reaction score
11,737
First Language
English
Primarily Uses
RMVXA
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

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

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.
 
Last edited:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,315
Reaction score
11,737
First Language
English
Primarily Uses
RMVXA
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. 
 

txtk

Veteran
Veteran
Joined
Jul 10, 2014
Messages
115
Reaction score
35
First Language
Vietnamese
Primarily Uses
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. :)
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,813
Reaction score
14,622
First Language
English
Primarily Uses
RMVXA
@Kes The script code for this script is broken. Do you have the original somewhere?
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,813
Reaction score
14,622
First Language
English
Primarily Uses
RMVXA
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!)
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,813
Reaction score
14,622
First Language
English
Primarily Uses
RMVXA
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.
 

Latest Threads

Latest Posts

Latest Profile Posts

i want to make videogame, though i am burned out on games with RPG elements, but the only gamedev tool i know how to use is rpg maker. :/
Rakon wrote on xizorandy's profile.
Hello! I found a post of lightning strike pictures you posted. You said you made them, am I allowed to use them in my commercial project. Would be really cool!^^
evhht2zr.png

Have a nice day!
It's almost 3 month and this piece of drawing is still not finished yet.
aaaa.jpg

Really busy with other stuffs like commission and coping with personal problem.
Stella & Elyune, maybe used for promotional art if my game project finished one day.

Forum statistics

Threads
112,256
Messages
1,066,849
Members
145,866
Latest member
Hallistra
Top