Author Topic: [XP][VX] Window tone  (Read 2335 times)

Offline Wecoc

  • Transcended Spirit
  • ***
  • Posts: 108
  • LV: 45
  • Gender: Male
    • View Profile
    • Mundo Maker
[XP][VX] Window tone
« on: January 16, 2013, 02:48:59 PM »
Window Tone
Authors: Wecoc
Version: 1.1
Type: Window Add-On
Key Term: Misc Add-on

Introduction

This is a simple Add-On for XP and VX that allows you to change the Window tones on game (in Ace that function already exists) You can change 'back' tone, 'cursor' tone and 'border' tone separately. I used the Window class from Pokemon Essentials as a base to make this.


Features

  • Red, Green, Blue and Gray are managed separately.
  • Different window sprites ('back', 'cursor' and 'border') are managed separately.
  • get, set and increase(positive or negative) color values.
  • Where are you from? Do you spell gray or grey? It doesn't matter, it supports both.

Screenshots

(click to show/hide)


Script

(click to show/hide)

Instructions

The next codes can be used also changing 'back' to 'cursor' or 'border' depending on the situation. I used the 'back' case because it's maybe the most common.

The next controls return the actual red,green,blue or gray tone of the window
Code: [Select]
@window.get_back_red
@window.get_back_green
@window.get_back_blue
@window.get_back_gray
To manage that you can do it in two ways, the first one to change the color directly (value from -255 to 255 on red/green/blue and 0 to 255 for grey)
Code: [Select]
@window.set_back_red(value)
@window.set_back_green(value)
@window.set_back_blue(value)
@window.set_back_gray(value)
Or you can change it increasing the value to the actual tone.
Code: [Select]
@window.increase_back_red(valor)
@window.increase_back_green(valor)
@window.increase_back_blue(valor)
@window.increase_back_gray(valor)

I made an easy example for RMXP, too. You can check it:

Code: [Select]
#==============================================================================
# [RMXP] Window Tone Example (by Wecoc)
# This scripts changes "Status" to a tone management window.
#==============================================================================

#==============================================================================
# * Scene_Menu edit
#==============================================================================

class Scene_Menu
 
  def main
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Color test"
    s5 = "Save"
    s6 = "Quit"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
    @command_window.index = @menu_index
    if $game_party.actors.size == 0
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    if $game_system.save_disabled
      @command_window.disable_item(4)
    end
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 224
    @steps_window = Window_Steps.new
    @steps_window.x = 0
    @steps_window.y = 320
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @playtime_window.dispose
    @steps_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
 
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      if $game_party.actors.size == 0 and @command_window.index < 4
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @command_window.index
      when 0  # item
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Item.new
      when 1  # skill
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # equipment
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # status
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_ColorWindow.new
      when 4  # save
        if $game_system.save_disabled
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Save.new
      when 5  # end game
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_End.new
      end
      return
    end
  end
end


#==========================================================
# * Scene_ColorWindow by Wecoc
#==========================================================

class Scene_ColorWindow
  def main
    s1 = "Red"
    s2 = "Green"
    s3 = "Blue"
    s4 = "Gray"
    @color_window = Window_Command.new(200, [s1, s2, s3, s4])
    @color_window.x = 240
    @color_window.y = 240
    refresh
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @color_window.dispose
  end

  def refresh
    @r = @color_window.get_back_red
    @g = @color_window.get_back_green
    @b = @color_window.get_back_blue
    @s = @color_window.get_back_gray
    @color_window.refresh
    @color_window.contents.draw_text(64, 0,100,32,@r.to_s,2)
    @color_window.contents.draw_text(64,32,100,32,@g.to_s,2)
    @color_window.contents.draw_text(64,64,100,32,@b.to_s,2)
    @color_window.contents.draw_text(64,96,100,32,@s.to_s,2)
  end
 
  def update
    @color_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(3)
      return
    end
    if Input.trigger?(Input::C)
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_Menu.new(3)
      return
    end
    if Input.repeat?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      case @color_window.index
      when 0 # red
        if @r == -255
          @color_window.increase_back_red(5)
        else
          @color_window.increase_back_red(10)
        end
      when 1 # green
        if @g == -255
          @color_window.increase_back_green(5)
        else
          @color_window.increase_back_green(10)
        end
      when 2 #blue
        if @b == -255
          @color_window.increase_back_blue(5)
        else
          @color_window.increase_back_blue(10)
        end
      when 3 #gray
        @color_window.increase_back_gray(10)
      end
      refresh
    end
    if Input.repeat?(Input::LEFT)
      $game_system.se_play($data_system.cursor_se)
      case @color_window.index
      when 0 # red
        if @r == 255
          @color_window.increase_back_red(-5)
        else
          @color_window.increase_back_red(-10)
        end
      when 1 # green
        if @g == 255
          @color_window.increase_back_green(-5)
        else
          @color_window.increase_back_green(-10)
        end
      when 2 #blue
        if @b == 255
          @color_window.increase_back_blue(-5)
        else
          @color_window.increase_back_blue(-10)
        end
      when 3 #gray
        if @s == 255
          @color_window.increase_back_gray(-5)
        else
          @color_window.increase_back_gray(-10)
        end
      end
      refresh
    end
  end
end

Compatibility

No compatibility issues found.

Credits and Thanks

  • Pokemon Essentials - for the original code source
  • Wecoc - for the simple add-on

Author's Notes

If you have any problem with that script or with incompatibilities don’t hestitate to ask.