I'm referring to a new game where I disable the mouse and then save. If I return to the title screen choose continue and open the save file the mouse is still disabled. However if I quit completely reload the game and choose the same save file it is once more enabled.
Common Event on parallel process not working.
RGSSx Script SupportThis is much easier and doesn't require you to do any sort of special loading/saving logic.
Or however the enabled method is defined. I never looked at the script.
Code:
class Mouse def enabled? $game_switches[SWITCH_ID] endend
I was actually thinking he was doing that kind of thing... but it seems like he doesn't...
Bump.
I was wondering if anyone could help finish this query off so that I can then tackle the question of getting it to work with Yanfly's Options systems.
Thanks.
I was wondering if anyone could help finish this query off so that I can then tackle the question of getting it to work with Yanfly's Options systems.
Thanks.
Bump again.
One of the solutions, you could try this:
In Data_Manager, you have the following block:
def self.create_game_objects $game_temp = Game_Temp.new $game_system = Game_System.new $game_timer = Game_Timer.new $game_message = Game_Message.new $game_switches = Game_Switches.new $game_variables = Game_Variables.new $game_self_switches = Game_SelfSwitches.new $game_actors = Game_Actors.new $game_party = Game_Party.new $game_troop = Game_Troop.new $game_map = Game_Map.new $game_player = Game_Player.new endAttach your switch to any of the global variable by overloading the specified class structure, and you should be able to save and load the setting though when you start the game application / not the game, changes in switches' values are by default hasn't been loaded, but it will be loaded if you load the save game.
In Data_Manager, you have the following block:
def self.create_game_objects $game_temp = Game_Temp.new $game_system = Game_System.new $game_timer = Game_Timer.new $game_message = Game_Message.new $game_switches = Game_Switches.new $game_variables = Game_Variables.new $game_self_switches = Game_SelfSwitches.new $game_actors = Game_Actors.new $game_party = Game_Party.new $game_troop = Game_Troop.new $game_map = Game_Map.new $game_player = Game_Player.new endAttach your switch to any of the global variable by overloading the specified class structure, and you should be able to save and load the setting though when you start the game application / not the game, changes in switches' values are by default hasn't been loaded, but it will be loaded if you load the save game.
@Mike
Thank you for your reply. My problem is that I'm a scripting idiot, so I don't even know what you mean by " overloading the specified class structure", let alone how to do it. I'm also unsure how this relates to Shaz's script. Could you re-phrase your explanation, or show an example of what you mean? I'm afraid that without that sort of hand-holding I'm stuck.
Thank you for your reply. My problem is that I'm a scripting idiot, so I don't even know what you mean by " overloading the specified class structure", let alone how to do it. I'm also unsure how this relates to Shaz's script. Could you re-phrase your explanation, or show an example of what you mean? I'm afraid that without that sort of hand-holding I'm stuck.
@Mike - if he add the switch there, it will still just initialize with whatever value he puts in there... that won't really solve anything...
plus his problem is simply Shaz' script not recognizing the switch when he loads the game... I think
So well, it's like this right?
You have a switch that enables/disables Mouse
It works when you do it in-game
But when you load it doesn't
here: edited what Shaz posted so that it reloads the value when you load a file
the problem was it loads the switch during load_normal_database, which is run when you start the game, not when you load a game
and as Shaz said, don't modify the switch itself... rather in-game you would still use $mouse.enabled = true/false
plus his problem is simply Shaz' script not recognizing the switch when he loads the game... I think
So well, it's like this right?
You have a switch that enables/disables Mouse
It works when you do it in-game
But when you load it doesn't
here: edited what Shaz posted so that it reloads the value when you load a file
the problem was it loads the switch during load_normal_database, which is run when you start the game, not when you load a game
Code:
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_game load_game alias shaz_mouse_switch_setup_new_game setup_new_game end def self.load_game(index) shaz_mouse_switch_load_game(index) $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
@Engr. Shana
Yes, that's basically it, though there is the slight quirk that if I close the game simply by returning to the title screen and immediately re-load, it seems to remember the mouse setting, whereas if I quit the game completely it totally forgets and reverts to default (i.e. mouse enabled).
Yes, that's basically it, though there is the slight quirk that if I close the game simply by returning to the title screen and immediately re-load, it seems to remember the mouse setting, whereas if I quit the game completely it totally forgets and reverts to default (i.e. mouse enabled).
I edited the above post with an edit to what Shaz posted... I think that should work fine now...
that is because global variables ($variable_name) are actually there until you close the game...
Can I please be super-neurotic and just check exactly what I do:
Leave Shaz's script totally unaltered
Paste the above snippet into the usual above Main etc.
Change the line ENABLED_SWITCH = 1
to read ENABLED_SWITCH = [whatever number switch I've allocated]
And that's it?
Leave Shaz's script totally unaltered
Paste the above snippet into the usual above Main etc.
Change the line ENABLED_SWITCH = 1
to read ENABLED_SWITCH = [whatever number switch I've allocated]
And that's it?
Assuming my edit works, that would be the only thing you need to do... and make sure that Shaz' mouse script is not below it...
Plus make sure that to toggle the mouse you actually use $mouse.enabled = true/false, and don't modify the switch directly
Plus make sure that to toggle the mouse you actually use $mouse.enabled = true/false, and don't modify the switch directly
There is a (ahem) 'slight' hitch.
Trying this out in a test project, one map with a couple of Yanfly scripts for menu etc.
Insert snippet, new game loads fine.
Using the $mouse.enabled = true/false in an event and setting it to 'true'; save, quit completely, open up again, no problem.
Doing the same and putting it to false, save, quit completely, open up again, select the save file I want, it won't reload at all.
Trying this out in a test project, one map with a couple of Yanfly scripts for menu etc.
Insert snippet, new game loads fine.
Using the $mouse.enabled = true/false in an event and setting it to 'true'; save, quit completely, open up again, no problem.
Doing the same and putting it to false, save, quit completely, open up again, select the save file I want, it won't reload at all.
that means something is running an error in there... the loading is actually enclosed in a rescue block so it stops if something is running an error
I see... w8... it's because it uses the last line as return... since it returns false if the mouse is disabled, the game thinks that the loading didn't proceed correctly... 🙂
change this part
to
I see... w8... it's because it uses the last line as return... since it returns false if the mouse is disabled, the game thinks that the loading didn't proceed correctly... 🙂
change this part
Code:
def self.load_game(index) shaz_mouse_switch_load_game(index) $mouse.enabled = $game_switches[SHAZ::MouseSwitch::ENABLED_SWITCH] if $mouse && $game_switches end
Code:
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
Yes, that's it!
You, sir, are a scholar and a gentleman. Thank you. Would you like crediting for this?
Now to phase 2, trying to set this up to work with Yanfly's Systems Options script so the player can toggle the choice themselves. I suspect this is going to be more hair-tearing but I will get there in the end!
You, sir, are a scholar and a gentleman. Thank you. Would you like crediting for this?
Now to phase 2, trying to set this up to work with Yanfly's Systems Options script so the player can toggle the choice themselves. I suspect this is going to be more hair-tearing but I will get there in the end!
if you want to, then I'd be glad for it... 🙂
not really I think... if only I could open that script right now (dropbox items seems not to load on our office), I could probably fetch a fix for that...
EDIT: if you could actually make Yanfly's work with Switches right now, you can just opt to use this snippet instead and see if it works... if you use this, you change the switch in order to modify the visibility of the mouse instead...
note: if ur gonna try this one, disable the other snippet I gave you first...
not really I think... if only I could open that script right now (dropbox items seems not to load on our office), I could probably fetch a fix for that...
EDIT: if you could actually make Yanfly's work with Switches right now, you can just opt to use this snippet instead and see if it works... if you use this, you change the switch in order to modify the visibility of the mouse instead...
Code:
module SHAZ module MouseSwitch ENABLED_SWITCH = 1 endendclass Sprite_Mouse < Sprite def enabled self.visible = $game_switches[SHAZ::MouseSwitch::ENABLED_SWITCH] @enabled = $game_switches[SHAZ::MouseSwitch::ENABLED_SWITCH] return @enabled endend
Whoa, didn't think that there would be bunch of replies as soon as I responded to the thread.
It seems the problem is solved though, so it's all good.
Well, I thought he wanted to have a customized switch(es) that can be loaded and saved,I was informing him one way to start he did, assuming that he has tried modifying the script.
It seems the problem is solved though, so it's all good.
It looks like using Yanfly's Systems Option script is not going to work. Shame, but as an extra line in the main Menu it gives the player the choice to toggle it off or on as they wish, when they wish, which was the main objective.
Thanks for all the help.
Thanks for all the help.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Original thread: https://forums.rpgmakerweb.com/threads/common-event-on-parallel-process-not-working.22264/