Enable/disable mouse - again

I am starting a new thread, rather than re-opening another one to keep the problem clear.

Background

I am using Shaz's mouse script. http://forums.rpgmakerweb.com/index.php?/topic/17829-amaranths-super-simple-mouse-system-for-ace/

Following several player requests, I decided to try and find a way to allow the player to enable/disable the custom mouse.  The initial problem was getting the game to remember the data when the player quit.  However, after some work (by others, not by me) the result was this mini-script. (the switch number is mine, it could be any).

module SHAZ module MouseSwitch ENABLED_SWITCH = 299 endendclass Sprite_Mouse < Sprite def enabled=(value) @enabled = value $game_switches[SHAZ::MouseSwitch::ENABLED_SWITCH] = value self.visible = value endendmodule 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 endendIn essence it works by a script call : $mouse.enabled = true/false.

It is necessary to have that script call at the very beginning of the game.  After that, the mouse can be enabled/disabled by another script call.  I did this by adding a line to the main menu which calls up a common event, with a show choice.  Depending on what the player selects the appropriate script call is made.  It seemed to work, and the previous thread was closed.

The problem

If the player never changes anything, no problem.

If the player disables the mouse and never does anything else again, then no problem.  the custom mouse and its functions go, the default mouse arrow appears in the usual way until you either push it to one side or use an arrow key.  That was what I specifically tested for.

However, if the player changes their mind and re-enables the custom mouse, it comes back - but with the default mouse arrow on top of it.  You see both icons the whole time.  It looks dreadful, and confusing.

Request

Does anyone know of a way to prevent the default mouse arrow from showing when the custom mouse comes back?  There must be something in the main script which gets rid of it in the first place, and presumably that method needs to be re-activated or transferred into the mini-script.  Being a scripting idiot I haven't a clue about how that might be done.

Any help would be much appreciated.

Thanks.
The script I gave you worked for me when I toggled the mouse on and off and back on again. What's changed between the version I gave you and the one above?.
that one was edited by me to work on saved files... the one you originally posted reloaded the mouse on load_database... and that loads the default value for the switches... so I made it run on file loading instead so that it loads the saved value for the switches...


that was the only change I made on it...
@Shaz

The problem with your original was that it worked if I went back to title screen but not if I quit entirely.
At this point I have to ask, is it REALLY worth all this trouble, JUST to get the setting to stick to the save file? If it worked one way (saving the setting for ALL games instead of individual games, which it does, because that's the way I'm using it in mine), do you really want to spend this much time messing around with it to get the setting saved at the game/savefile level?
If it's working for you, then I can only assume we are doing something different.  Here is what happens for me.

New game, with no save files in existence.

New game starts. I have an autorun event which makes the script call:  $mouse.enabled = true

The custom mouse appears, switch 299 (the one I am using) shows up as being ON when I check in-game.

I make the script call: $mouse.enabled = false

The custom mouse and its functions disappear, switch 299 shows up as OFF

Return to Title Screen, reload. Mouse disabled, switch 299 OFF

Quit completely and start new session.

Mouse enabled, but the switch is still showing OFF

It's not trying to call up from a back save, there is only one save file in existence.

At the moment this means that every time a player starts a new session, they will have to re-select their option.  This will be the only option that requires this; others, such as auto-dash, volume of BGM or SE etc. remain the same.  I think players will find this irritating.

If, however, when you start a new session it loads up correctly, then there has to be something different, but I don't see what can explain having the mouse re-enabled while the switch is still showing up as OFF
here's the original one:

Spoiler
module SHAZ module MouseSwitch ENABLED_SWITCH = 1 endendclass Sprite_Mouse < Sprite def enabled=(value) @enabled = value $game_switches[SHAZ::MouseSwitch::ENABLED_SWITCH] = value self.visible = value endendmodule DataManager class << self alias shaz_mouse_switch_load_normal_database load_normal_database alias shaz_mouse_switch_setup_new_game setup_new_game end def load_normal_database shaz_mouse_switch_load_normal_database $mouse.enabled = $game_switches[SHAZ::MouseSwitch::ENABLED_SWITCH] if $mouse && $game_switches end def setup_new_game shaz_mouse_switch_setup_new_game $mouse.enabled = true if $mouse endend
actually, load_normal_database is run before create_game_objects so that would mean that the 2nd line of Shaz' modification of load_normal_database will never run during start-up from scratch since at that instance, $game_switches is still uninitialized...

setup_new_game also won't run when you load a game

So I think that is why when ur loading, you get mouse enabled, but switch is false... assuming the script actually saves the value of $mouse.enabled...
@Engr. Shana

Hence, presumably, your edit.  But then why does the default mouse icon show up when the switch is re-enabled?
maybe there is something else that needs to be reintialized or something to remove the normal mouse... I haven't actually looked at the actual script itself since all I did was edit Shaz' posted code so that it will work correctly...

Original thread: https://forums.rpgmakerweb.com/threads/enable-disable-mouse-again.22852/