Common Event on parallel process not working.

Status
Not open for further replies.

Kes

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

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
This is much easier and doesn't require you to do any sort of special loading/saving logic.

Code:
class Mouse  def enabled?    $game_switches[SWITCH_ID]  endend
Or however the enabled method is defined. I never looked at the script.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I was actually thinking he was doing that kind of thing... but it seems like he doesn't...
 

Kes

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

Mike

Veteran
Veteran
Joined
Aug 28, 2013
Messages
316
Reaction score
36
First Language
English
Primarily Uses
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.
 
Last edited by a moderator:

Kes

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

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
@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

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
and as Shaz said, don't modify the switch itself... rather in-game you would still use $mouse.enabled = true/false
 
Last edited by a moderator:

Kes

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

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I edited the above post with an edit to what Shaz posted... I think that should work fine now...

returning to the title screen and immediately re-load, it seems to remember the mouse setting,
that is because global variables ($variable_name) are actually there until you close the game...
 
Last edited by a moderator:

Kes

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

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
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
 
Last edited by a moderator:

Kes

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

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
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

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
to

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
 
Last edited by a moderator:

Kes

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

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
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...

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
note: if ur gonna try this one, disable the other snippet I gave you first...
 
Last edited by a moderator:

Mike

Veteran
Veteran
Joined
Aug 28, 2013
Messages
316
Reaction score
36
First Language
English
Primarily Uses
Whoa, didn't think that there would be bunch of replies as soon as I responded to the thread.

@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...
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.
 

Kes

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

Lunarea

Artist
Global Mod
Joined
Mar 1, 2012
Messages
8,840
Reaction score
7,797
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.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,864
Messages
1,017,056
Members
137,573
Latest member
nikisknight
Top