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

 Username:
 Password:
   Not a member? Register!



Home > RGSS Script Reference > Window_Help

Window_Help


Inherits from: Window_Base

Description: This window is shown in a variety of situations, such as on the item, skill, and equip screens to show descriptions, and in battle to show actor and enemy names.

Code


class Window_Help < Window_Base
# ------------------------------------
def initialize
    super(0, 0, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
# ------------------------------------
  def set_text(text, align = 0)
    if text != @text or align != @align
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
      @text = text
      @align = align
      @actor = nil
    end
    self.visible = true
  end
# ------------------------------------ 
  def set_actor(actor)
    if actor != @actor
      self.contents.clear
      draw_actor_name(actor, 4, 0)
      draw_actor_state(actor, 140, 0)
      draw_actor_hp(actor, 284, 0)
      draw_actor_sp(actor, 460, 0)
      @actor = actor
      @text = nil
      self.visible = true
    end
  end
# ------------------------------------
  def set_enemy(enemy)
    text = enemy.name
    state_text = make_battler_state_text(enemy, 112, false)
    if state_text != ""
      text += "  " + state_text
    end
    set_text(text, 1)
  end
end

Properties


Text: The text in the help window.

Align: How the text is aligned within its bounding box (0 = Left-Justify, 1 = Center, 2 = Right-Justify).

Actor: The actor whose name and status will be drawn in the help window.

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 640, and the height is set to 64. The bitmap is then set.

Set_Text

Arguments:
Text: The text to set in the help window.
Align: The alignment of the text (0 = Left-Justify, 1 = Center, 2 = Right-Justify).
Local Variables: None

How it Works: This method is the substitute for the "Refresh" method in most window classes. It sets the text and alignment of that text in the window. It first clears the contents of the window, then draws the text passed to this method at x coordinate 4 and y coordinate 0. The width of the text's bounding box is the width of the window, minus 40, and the height is 32. The values of @text, @align, and @actor are all set to nil in order to avoid any residual effects. The window is then made to be visible.

Set_Actor

Arguments:
Actor: The actor whose name and status will be shown in the help window.
Local Variables: None

How it Works: This method draws an actor's name and status in the help window. The window's contents are first cleared. Then, the actor's name, status, HP, and SP are drawn, in that order. Note that in this case, the width of the bounding boxes for the HP and SP values are the default value of 144, which is wide enough to allow the maximum values to be shown. The values of @actor and @text are cleared to avoid residual effects.

Set_Enemy

Arguments:
Enemy: The enemy whose name will be shown in the help window.
Local Variables:
Text: The text that will be drawn. This string is assembled by taking the enemy's name and adding any status text, if necessary.

How it Works: This method draws the name of an enemy and its status. First, the value of text is set to the name of the enemy. Then, the state_text = make_battler_state_text(enemy, 112, false) statement appends the enemy's status ailment text to that string. Note that because the final parameter is false, the word "Normal" won't be shown if the enemy has no status ailments. Finally, the set_text(text, 1) call shows the text in the window, centered. 
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