Save-Point
Screen Tint Debugger - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+--- Thread: Screen Tint Debugger (/thread-5314.html)



Screen Tint Debugger - MechanicalPen - 11-04-2014

Screen Tint Debug Menu

Introduction

This is a script that lets you play with screen tint in a special debug mode.


Script

Code:
#-------------------------------------------------------------------------------
#  Screen Tint Debug Menu by Leon_Westbrooke
#-------------------------------------------------------------------------------
#  This scene allows you, in Debug mode, tamper with the map's tone until you
#  find a desired coloring.
#  It will NOT set the tone for you automatically.  Instead, record the numbers
#  and use them in a change screen tone event.  However, this should cut down
#  on countless testing of the screen's tint.
#
#  To use:
#    Plug the script into your game's script archive.
#    To access it, go into debug mode (F12) and press F8 to access the menu.
#    Use the arrow keys to change the maps tone.
#-------------------------------------------------------------------------------


#-------------------------------------------------------------------------------
#  *  Game_Temp
#-------------------------------------------------------------------------------
class Game_Temp
  alias leon_stdm_gametemp_init initialize
  
  attr_accessor :tinttest_red
  attr_accessor :tinttest_green
  attr_accessor :tinttest_blue
  attr_accessor :tinttest_gray
  
  def initialize
    leon_stdm_gametemp_init
    @tinttest_red = 0
    @tinttest_green = 0
    @tinttest_blue = 0
    @tinttest_gray = 0
  end
end
#-------------------------------------------------------------------------------
# END Game_Temp
#-------------------------------------------------------------------------------


#-------------------------------------------------------------------------------
#  *  Spriteset_Map
#-------------------------------------------------------------------------------
class Spriteset_Map
  attr_accessor :viewport1
end

class Game_Screen
  attr_accessor :tone
end
#-------------------------------------------------------------------------------
# END Spriteset_Map
#-------------------------------------------------------------------------------


#-------------------------------------------------------------------------------
#  *  Scene_Map
#-------------------------------------------------------------------------------
class Scene_Map
  
  alias leon_stdm_scenemap_update update

  def update
    leon_stdm_scenemap_update
    if $DEBUG and Input.press?(Input::F8)
      $scene = Scene_TintDebug.new
    end
  end
end
#-------------------------------------------------------------------------------
# END Scene_Map
#-------------------------------------------------------------------------------


#-------------------------------------------------------------------------------
#  *  Window_TintTest
#-------------------------------------------------------------------------------
class Window_TintTest < Window_Selectable
  def initialize
    super(0, 0, 192, 192)
    self.contents = Bitmap.new(width - 32, height - 32)
    @item_max = 5
    self.index = 0
    self.active = true
    refresh
  end
  
  def refresh
    self.contents.clear
    self.contents.draw_text(4, 0, 160, 32, "Red")
    self.contents.draw_text(4, 32, 160, 32, "Green")
    self.contents.draw_text(4, 64, 160, 32, "Blue")
    self.contents.draw_text(4, 96, 160, 32, "gray")
    self.contents.draw_text(4, 128, 160, 32, "Exit")
    self.contents.draw_text(-4, 0, 160, 32, $game_temp.tinttest_red.to_s, 2)
    self.contents.draw_text(-4, 32, 160, 32, $game_temp.tinttest_green.to_s, 2)
    self.contents.draw_text(-4, 64, 160, 32, $game_temp.tinttest_blue.to_s, 2)
    self.contents.draw_text(-4, 96, 160, 32, $game_temp.tinttest_gray.to_s, 2)
  end
end
#-------------------------------------------------------------------------------
# END Window_TintTest
#-------------------------------------------------------------------------------


#-------------------------------------------------------------------------------
#  *  Scene_TintDebug
#-------------------------------------------------------------------------------
class Scene_TintDebug
  def main
    @spriteset = Spriteset_Map.new
    $game_temp.tinttest_red = @spriteset.viewport1.tone.red.to_i
    $game_temp.tinttest_green = @spriteset.viewport1.tone.green.to_i
    $game_temp.tinttest_blue = @spriteset.viewport1.tone.blue.to_i
    $game_temp.tinttest_gray = @spriteset.viewport1.tone.gray.to_i
    @window_tint = Window_TintTest.new
    
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @window_tint.dispose
    @spriteset.dispose
  end
  
  
  def update
    if Input.trigger?(Input::B)
      $scene = Scene_Map.new
    end
    
    if @window_tint.active
      update_windowtint
      return
    end
  end
  
  def update_windowtint
    @window_tint.update
    case @window_tint.index
    when 0
      if Input.trigger?(Input::RIGHT)
        $game_temp.tinttest_red += 1
        if $game_temp.tinttest_red >= 255
          $game_temp.tinttest_red = 255
        end
      elsif Input.trigger?(Input::LEFT)
        $game_temp.tinttest_red -= 1
        if $game_temp.tinttest_red <= -255
          $game_temp.tinttest_red = -255
        end
      elsif Input.repeat?(Input::RIGHT)
        $game_temp.tinttest_red += 5
        if $game_temp.tinttest_red >= 255
          $game_temp.tinttest_red = 255
        end
      elsif Input.repeat?(Input::LEFT)
        $game_temp.tinttest_red -= 5
        if $game_temp.tinttest_red <= -255
          $game_temp.tinttest_red = -255
        end
      end
    when 1
      if Input.trigger?(Input::RIGHT)
        $game_temp.tinttest_green += 1
        if $game_temp.tinttest_green >= 255
          $game_temp.tinttest_green = 255
        end
      elsif Input.trigger?(Input::LEFT)
        $game_temp.tinttest_green -= 1
        if $game_temp.tinttest_green <= -255
          $game_temp.tinttest_green = -255
        end
      elsif Input.repeat?(Input::RIGHT)
        $game_temp.tinttest_green += 5
        if $game_temp.tinttest_green >= 255
          $game_temp.tinttest_green = 255
        end
      elsif Input.repeat?(Input::LEFT)
        $game_temp.tinttest_green -= 5
        if $game_temp.tinttest_green <= -255
          $game_temp.tinttest_green = -255
        end
      end
    when 2
      if Input.trigger?(Input::RIGHT)
        $game_temp.tinttest_blue += 1
        if $game_temp.tinttest_blue >= 255
          $game_temp.tinttest_blue = 255
        end
      elsif Input.trigger?(Input::LEFT)
        $game_temp.tinttest_blue -= 1
        if $game_temp.tinttest_blue <= -255
          $game_temp.tinttest_blue = -255
        end
      elsif Input.repeat?(Input::RIGHT)
        $game_temp.tinttest_blue += 5
        if $game_temp.tinttest_blue >= 255
          $game_temp.tinttest_blue = 255
        end
      elsif Input.repeat?(Input::LEFT)
        $game_temp.tinttest_blue -= 5
        if $game_temp.tinttest_blue <= -255
          $game_temp.tinttest_blue = -255
        end
      end
    when 3
      if Input.trigger?(Input::RIGHT)
        $game_temp.tinttest_gray += 1
        if $game_temp.tinttest_gray >= 255
          $game_temp.tinttest_gray = 255
        end
      elsif Input.trigger?(Input::LEFT)
        $game_temp.tinttest_gray -= 1
        if $game_temp.tinttest_gray <= -255
          $game_temp.tinttest_gray = -255
        end
      elsif Input.repeat?(Input::RIGHT)
        $game_temp.tinttest_gray += 5
        if $game_temp.tinttest_gray >= 255
          $game_temp.tinttest_gray = 255
        end
      elsif Input.repeat?(Input::LEFT)
        $game_temp.tinttest_gray -= 5
        if $game_temp.tinttest_gray <= -255
          $game_temp.tinttest_gray = -255
        end
      end
    when 4
      if Input.trigger?(Input::C)
        $scene = Scene_Map.new
      end
    end
    red = $game_temp.tinttest_red
    green = $game_temp.tinttest_green
    blue = $game_temp.tinttest_blue
    gray = $game_temp.tinttest_gray
    @spriteset.viewport1.tone = Tone.new(red, green, blue, gray)
    $game_screen.tone = Tone.new(red, green, blue, gray)
    @window_tint.refresh
    @spriteset.update
  end
end
#-------------------------------------------------------------------------------
#  *  Scene_TintDebug
#-------------------------------------------------------------------------------

Instructions

Put this script in your game, and press f8.

Credits and Thanks
100% borrowed without permission from http://www.gdunlimited.net/forums/topic/2101-rgsstool-screen-tone-test/ I am tired of useful scripts going missing, and having it two places means less chance of the script dissappearing without a trace!

Author's Notes

Since this overrides the default (and useful) debug menu, it might make sense to change it to a different key.

Terms and Conditions
I didn't make this! some person named Leon_Westbrooke did.