Submit Your Article Guild Wars 2 Forum RPG Maker VX.com
 
RPG Maker
 

 Username:
 Password:
   Not a member? Register!



Home > RGSS Script Reference > Window_DebugRight

Window_DebugRight


Inherits from: Window_Selectable

Description: This window shows the ten individual switches or variables in the group that the user selects from the left debug window. Pressing Enter toggles a switch, and various variable operations can be carried out, also.

Code


class Window_DebugRight < Window_Selectable
# ------------------------------------
 attr_reader   :mode
 attr_reader   :top_id
# ------------------------------------ 
  def initialize
    super(192, 0, 448, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = -1
    self.active = false
    @item_max = 10
    @mode = 0
    @top_id = 1
    refresh
  end
# ------------------------------------ 
  def refresh
    self.contents.clear
    for i in 0..9
      if @mode == 0
        name = $data_system.switches[@top_id+i]
        status = $game_switches[@top_id+i] ? "[ON]" : "[OFF]"
      else
        name = $data_system.variables[@top_id+i]
        status = $game_variables[@top_id+i].to_s
      end
      if name == nil
        name = ''
      end
      id_text = sprintf("%04d:", @top_id+i)
      width = self.contents.text_size(id_text).width
      self.contents.draw_text(4, i * 32, width, 32, id_text)
      self.contents.draw_text(12 + width, i * 32, 296 - width, 32, name)
      self.contents.draw_text(312, i * 32, 100, 32, status, 2)
    end
  end
# ------------------------------------
  def mode=(mode)
    if @mode != mode
      @mode = mode
      refresh
    end
  end
# ------------------------------------
  def top_id=(id)
    if @top_id != id
      @top_id = id
      refresh
    end
  end
end

Properties


Mode: This variable determines whether the window is showing a group of switches or variables (0 = Switches, 1 = Variables).

Top_ID: The number of the switch or variable that is the first item in the group.

Methods


Initialize

Arguments: None
Local Variables: None

How it Works: The method initializes the window. The x coordinate of the window is set to 192, the y coordinate of the window is set to 0, the width of the window is set to 448, and the height of the window is set to 352. The window's bitmap is then initialized. The rest of the method initializes the instance variables to dummy values. The values of @mode and @top_id are manipulated by the Scene_Debug class using the mode= and top_id= methods, explained below.

Refresh

Arguments: None
Local Variables:
ID_Text: The string representation of the ID number of the switch or variable.
Name: The name of the switch or variable.
Status: Either the string "ON" or "OFF" (for switches) or the string representation of the numerical value (for variables).

How it Works: This method draws the contents of the window. After the window's current contents are cleared, the for loop draws the ten switches or variables and their values. Whether switches or variables are drawn depends on the value of the @mode instance variable. In either case, the value of the local variable name is set to the name of the switch or variable to show. If @mode is 0 (Switch mode), then the value of the local variable status is set to the string "ON" if the switch is on, or the string "OFF" if the switch is off. If @mode is 1 (Variable mode), then the value of status is set to the string representation of the variable's value. The last part of the method draws the text for the ID text, the name, and the status of the switch or variable. Notice that the statement self.contents.draw_text(312, i * 32, 100, 32, status, 2) contains the optional sixth argument "2", so the text is right-aligned within its bounding box.

Mode=

Arguments:
Mode: The new mode of the window.
Local Variables: None

How it Works: If the value passed to this method is different from the current mode of the window, then the mode is updated to this new value and the window is refreshed to reflect the change.

Top_ID=

Arguments:
ID: The new top ID of the window.
Local Variables: None

How it Works: If the number passed to this method is different from the number of the switch or variable that is currently the first item in the menu, then the top row value is changed and the window updated to reflect this change. 
Syntax
@
@@
$
alias
[array index]
attr_accessor
attr_reader
attr_writer
class
def
do
ensure
for
if
[iterator]
key => value
new
next
nil
redo
require
return
rescue
self
super
undef
unless
until
while
yield

Classes
Arrow_Actor
Arrow_Base
Arrow_Enemy
Game_Actor
Game_Actors
Game_BattleAct
Game_Battler
Game_Character
Game_Common
Game_Enemy
Game_Event
Game_Map
Game_Party
Game_Picture
Game_Player
Game_Screen
Game_SlfSwitch
Game_Switches
Game_System
Game_Troop
Game_Variables
Interpreter
Scene_Debug
Scene_End
Scene_Equip
Scene_File
Scene_Gameover
Scene_Item
Scene_Load
Scene_Map
Scene_Menu
Scene_Name
Scene_Save
Scene_Shop
Scene_Skill
Scene_Status
Scene_Title
Sprite_Battler
Sprite_Character
Sprite_Picture
Sprite_Timer
Spriteset_Battle
Spriteset_Map
Window_Base
Window_Battleresult
Window_Battlestatus
Window_Command
Window_DebugLeft
Window_DebugRight
Window_EquipItem
Window_EquipLeft
Window_EquipRight
Window_Gold
Window_Help
Window_InputNumb
Window_Item
Window_MenuStatus
Window_Message
Window_NameEdit
Window_NameInput
Window_PartyCom
Window_PlayTime
Window_SaveFile
Window_Selectable
Window_ShopBuy
Window_ShopCom
Window_ShopNum
Window_ShopSell
Window_ShopStatus
Window_Skill
Window_SkillStatus
Window_Status
Window_Steps
Window_Target

Other
Class Hierarchy
Global Variables


RPG RPG Revolution
RPG RPG Revolution is your #1 stop for game development and console RPG games, as well as those created by people like you. Link to us to support us, so we may grow to be better website community for you.

RPG RPG Revolution is an Privacy Policy and Legal