RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Memorize Screen Tone

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 75
Memorize Screen Tone
24 4 2011



Summary
I tried to convert ccoa's Memorize Screen Tone from XP, but alas  :V

Features Desired
  • a script call to memorize the current screen tone
  • another one to return the memorized screen tone

Games its been in
  • I suppose this was created for Memento Vivere

What other scripts are you using?
  • lol too many. The ones that could interfere with screen tinting might be Tone Tester
  • Battle Screen Effects
  • Battle Engine Melody does have melodies that allow the change of screen tone in battles, not sure this is relevant.



Did you search?
Yes

Where did you search?
  • Google

What did you search for?
  • memorize screen tone rmvx
  • memorize screen tint rmvx
  • same thing with inverted words

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
I can do this for you.

***
Rep:
Level 71
Entity Humanoid Interface
Just one question, what are you ganna do with this script o_O? It doesn't sound like something you can't manually set
I support \\(>O<)b




***
Rep:
Level 75
Thanks MA, I'm sure this is a easy task for you xD

Just one question, what are you ganna do with this script o_O? It doesn't sound like something you can't manually set
It's because I have a parallel process running in every map that will change screentone when a key is pressed (kinda like night goggles), and when they key's pressed again the tone goes back to what it was before, but since not all the maps have the same tone, I cannot have it to return to just a single value.
I could do this with events, but it'll require too many conditional branches and I want to keep the parallel process as light as possible to avoid lag.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Here:
Code: [Select]
#==============================================================================
# ** Game Map
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new instance variable - ma_memorized_tone
#==============================================================================

class Game_Map
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Public Instance Variables
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  attr_accessor :ma_memorized_tone
end

#==============================================================================
# ** Game Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new methods - memorize_screen_tone; restore_screen_tone
#==============================================================================

class Game_Interpreter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Memorize Screen Tone
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def memorize_tone
    $game_map.ma_memorized_tone = $game_map.screen.tone.clone
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Restore Screen Tone
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def restore_tone (duration = 0)
    $game_map.screen.start_tone_change ($game_map.ma_memorized_tone, duration) unless $game_map.ma_memorized_tone.nil?
  end
end

To use it, just use the following code in an evented script call to memorize it:

Code: [Select]
memorize_tone

And use the following to restore it:

Code: [Select]
restore_tone (x)

where x is the duration. So 60 would be 60 frames. If you don't include it, so just:

Code: [Select]
restore_tone

then it will do it immediately (ie 0 frames)
« Last Edit: April 23, 2011, 02:55:09 AM by modern algebra »

**
Rep:
Level 82
That won't save the data, though. You need to store the data in a class that gets marshalled.

***
Rep:
Level 75
Quote
$game_map.screen.tone.dup
Ah, I used clone as in ccoa's version...

Quote
That won't save the data, though. You need to store the data in a class that gets marshalled.
I don't know what it means, but I tried memorizing, changing tone, saving, F12ing, and calling the memorized tone. It worked, so I suppose the thing gets stored in the savefile.

Thanks again MA (:

**
Rep:
Level 82
Did you try saving the file, shutting it off, then loading the file?
I may be wrong about the whole thing, I am more of an XP person than VX.  :P


*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
No, he's right that the script doesn't work. Well, not quite for those reasons - the class will get marshalled since they are always saved to variables within classes that do get marshalled (Game_Event; Game_CommonEvent; Game_Map). But making it an instance variable was silly since it won't work through any of the other interpreters - IE you couldn't restore it or memorize it through any parallel process events or common events or even child interpreters. I should have either put it in a class like Game_Map or made it a class variable.

I've changed it to a class variable since that was easier. Grab it again from the previous post.

But yeah; thanks for the catch ForeverZero - I wouldn't have given that choice a second thought if you hadn't popped in. I definitely should have been smarter about it. Also, putting it in another class like Game_Map would probably be smarter than using a class variable, but adding three extra @s was slightly faster and I'm lazy.

Also, @heisenman - clone would have worked too. They're the same method except clone is a more complete copy as it includes freeze status and singleton methods. Are you sure that was that the only difference?
« Last Edit: April 23, 2011, 02:32:06 AM by modern algebra »

***
Rep:
Level 75
Before I make myself sound sillier than I actually am, I did try if it worked but not on my parallel process, just on some dummy events :tpg:

Quote
@heisenman - clone would have worked too. They're the same method except clone is a more complete copy as it includes freeze status and singleton methods. Are you sure that was that the only difference?
Nope, that wasn't the only difference at all, the reason why it wasn't working is surely because I copypasted things at random out of desperation.

EDIT: After quitting, loading and calling the common event again.

« Last Edit: April 23, 2011, 02:45:26 AM by heisenman »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Alright, I fixed it this time for real and wasn't as lazy. I replaced it in the first post.

I knew that class variables weren't marshalled; it didn't make any sense. I had tested it using F12 though and it worked, so I stupidly assumed that I had been wrong. Dumb me :)
« Last Edit: April 23, 2011, 02:59:29 AM by modern algebra »

***
Rep:
Level 75
All right, the third time is the lucky one.
It works both ways:

1) Open > Use goggles to change tone > Save > Quit > Load > Use goggles again > Just fine. (It crashed here before)
2) Open > Use goggles to change tone> Use goggles to resore tone > Save > Quit > Load > Use goggles again > Just fine.

I cannot think of other ways to test if works correctly. If I run into other problems I'll come back begging for assistance.


Thanks MA for the patience, and thanks ForeverZero for helping (: