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

 Username:
 Password:
   Not a member? Register!



Home > RGSS Script Reference > Window_DebugLeft

Window_DebugLeft


Inherits from: Window_Selectable

Description: The window shows groups of ten switches and variables that the user can choose. When the user chooses a group, the right-hand debug window shows the ten individual switches or variables for modification.

Code


class Window_DebugLeft < Window_Selectable
# ------------------------------------
 def initialize
    super(0, 0, 192, 480)
    self.index = 0
    refresh
  end
# ------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @switch_max = ($data_system.switches.size - 1 + 9) / 10
    @variable_max = ($data_system.variables.size - 1 + 9) / 10
    @item_max = @switch_max + @variable_max
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    for i in 0...@switch_max
      text = sprintf("S [%04d-%04d]", i*10+1, i*10+10)
      self.contents.draw_text(4, i * 32, 152, 32, text)
    end
    for i in 0...@variable_max
      text = sprintf("V [%04d-%04d]", i*10+1, i*10+10)
      self.contents.draw_text(4, (@switch_max + i) * 32, 152, 32, text)
    end
  end
# ------------------------------------
  def mode
    if self.index < @switch_max
      return 0
    else
      return 1
    end
  end
# ------------------------------------
  def top_id
    if self.index < @switch_max
      return self.index * 10 + 1
    else
      return (self.index - @switch_max) * 10 + 1
    end
  end
end

Properties


Switch_Max: The number of groups of switches to show. The reason for the convoluted formula is that even though switches are numbered 1 - n for convenience, the switch array actually starts at index 0. The forumla accounts for this.

Variable_Max: The number of groups of variables to show.

Methods


Initialize

Arguments: None
Local Variables: None

How it Works: The method initializes the window. The x and y coordinates of the window are both set to 0. The width is set to 192, and the height is set to 480. The index is set at 0 (the top choice in the menu), and the window's contents are then drawn with the call to refresh.

Refresh

Arguments: None
Local Variables: None

How it Works: This method draws the contents of the window. Because this window can scroll, the contents are set to nil before proceeding. First, the values of @switch_max and @variable_max. In both cases, the values of these variables will be one for each ten or part of ten switches/variables. The value of @item_max (a property of Window_Selectable) is the sum or these two values. The bitmap is then declared, and the contents drawn. The first for loop draws the text for each group of switches. The sprintf statement prints a formatted string. The "%04d" means four integers will be printed, with leading zeros as necessary. For instance, for the first ten switches, the text = sprintf("S [%04d-%04d]", i*10+1, i*10+10) statement will print "S [0001 - 0010]". The same is then done for the variables.

Mode

Arguments: None
Local Variables: None

How it Works: This method determines whether the cursor is pointing at a group of switches or a group of variables. If the value of @index is less than @switch_max (the number of switch groups), then 0 is returned to the caller, meaning the cursor is pointing at a group of switches. Otherwise, 1 is returned to the caller, meaning that the cursor is pointing at a group of variables.

Top_ID

Arguments: None
Local Variables: None

How it Works: This method returns the number of the switch or variable that should appear at the top of the right-hand debug window. If the cursor is pointing at a group of switches, then the cursor index times ten, plus one, is returned (remember that the index of the first selection on the menu is 0). If the cursor is pointing at a group of variables, then the value of @switch_max is subtracted from the index before the calculation is done. 
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