Skip to content

Instantly share code, notes, and snippets.

@matula
Created April 7, 2025 21:36

Revisions

  1. matula created this gist Apr 7, 2025.
    1,006 changes: 1,006 additions & 0 deletions rmmv_window_doc.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,1006 @@
    # RPG Maker MV Window Script Documentation (rpg_windows.js v1.6.2)

    This document provides an overview of the Window classes defined in the `rpg_windows.js` file for RPG Maker MV. These classes form the basis for all the menus, message boxes, and other interface elements seen in the game.

    ## Window_Base

    The superclass for almost all windows in the game. It provides core functionalities like drawing text, icons, faces, gauges, managing windowskins, opacity, padding, and basic open/close animations.

    **Key Properties:**

    * `contents`: The `Bitmap` where the window's content is drawn.
    * `windowskin`: The `Bitmap` used for the window's frame and background.
    * `padding`: The space between the window frame and the contents.
    * `opacity`: The overall opacity of the window frame and background (0-255).
    * `backOpacity`: Opacity of the window background pattern (0-255).
    * `contentsOpacity`: Opacity of the drawable contents (0-255).
    * `openness`: How open the window is (0=closed, 255=fully open). Used for animations.

    **Key Methods:**

    * `initialize(x, y, width, height)`: Constructor.
    * `lineHeight()`: Returns the default height of a line of text (36 pixels).
    * `standardFontFace()`, `standardFontSize()`, `standardPadding()`, `standardBackOpacity()`: Return default values for font, padding, and opacity.
    * `loadWindowskin()`: Loads the default 'Window' image from `img/system/`.
    * `contentsWidth()`, `contentsHeight()`: Calculate the drawable area size.
    * `fittingHeight(numLines)`: Calculates the window height needed for a given number of lines.
    * `createContents()`: Creates the `contents` Bitmap.
    * `resetFontSettings()`, `resetTextColor()`: Set font and color to defaults.
    * `update()`: Updates open/close animations and background dimmer.
    * `open()`, `close()`: Start opening/closing animations.
    * `isOpen()`, `isClosed()`, `isOpening()`, `isClosing()`: Check animation states.
    * `show()`, `hide()`: Set window visibility.
    * `activate()`, `deactivate()`: Set window active state.
    * `textColor(n)`, `normalColor()`, `systemColor()`, etc.: Get standard colors from the windowskin.
    * `changeTextColor(color)`, `changePaintOpacity(enabled)`: Modify drawing settings.
    * `drawText(text, x, y, maxWidth, align)`: Draws simple text.
    * `textWidth(text)`: Measures text width.
    * `drawTextEx(text, x, y)`: Draws text with support for escape codes (\V[n], \N[n], \I[n], etc.).
    * `convertEscapeCharacters(text)`: Processes escape codes in text.
    * `processCharacter(textState)`, `processNormalCharacter()`, `processNewLine()`, etc.: Handle drawing individual characters and escape codes.
    * `drawIcon(iconIndex, x, y)`: Draws an icon from the IconSet.
    * `drawFace(faceName, faceIndex, x, y, width, height)`: Draws a character face graphic.
    * `drawCharacter(characterName, characterIndex, x, y)`: Draws a character sprite.
    * `drawGauge(x, y, width, rate, color1, color2)`: Draws a horizontal gauge.
    * `hpColor()`, `mpColor()`, `tpColor()`: Get appropriate text color based on actor status.
    * `drawActorCharacter()`, `drawActorFace()`, `drawActorName()`, `drawActorClass()`, `drawActorNickname()`, `drawActorLevel()`, `drawActorIcons()`: Draw common actor information.
    * `drawActorHp()`, `drawActorMp()`, `drawActorTp()`: Draw actor gauges with text.
    * `drawCurrentAndMax(current, max, x, y, width, color1, color2)`: Draws "Current / Max" values.
    * `drawItemName(item, x, y, width)`: Draws an item's icon and name.
    * `drawCurrencyValue(value, unit, x, y, width)`: Draws a numerical value with the currency unit.
    * `setBackgroundType(type)`: Sets the background type (0: Normal window, 1: Dimmed, 2: Transparent).
    * `showBackgroundDimmer()`, `hideBackgroundDimmer()`, `updateBackgroundDimmer()`: Manage the semi-transparent dimmed background effect.

    ## Window_Selectable

    A subclass of `Window_Base` that adds cursor movement, item selection, and scrolling capabilities. It's the base for most interactive menu windows.

    **Key Properties:**

    * `_index`: The index of the currently selected item (-1 for none).
    * `_handlers`: An object storing handler functions for symbols like 'ok', 'cancel', 'pageup', 'pagedown'.
    * `_helpWindow`: A reference to an associated `Window_Help`.

    **Key Methods:**

    * `initialize(x, y, width, height)`: Constructor.
    * `index()`: Gets the current index.
    * `maxCols()`: Returns the number of columns (default 1).
    * `maxItems()`: Returns the total number of items (must be overridden).
    * `itemWidth()`, `itemHeight()`: Calculate dimensions for each selectable item space.
    * `maxRows()`, `maxPageRows()`, `maxPageItems()`: Calculate row and page information based on height and itemHeight.
    * `activate()`, `deactivate()`: Handle activation/deactivation.
    * `select(index)`, `deselect()`: Set or clear the current selection.
    * `row()`, `topRow()`, `bottomRow()`, `setTopRow()`, `topIndex()`: Manage vertical scrolling based on rows.
    * `itemRect(index)`: Gets the rectangle for an item at a given index, accounting for scrolling.
    * `itemRectForText(index)`: Gets the rectangle adjusted for text padding.
    * `setHelpWindow(helpWindow)`: Links a help window.
    * `showHelpWindow()`, `hideHelpWindow()`: Control help window visibility.
    * `setHandler(symbol, method)`: Assigns a function to handle an input symbol.
    * `isHandled(symbol)`, `callHandler(symbol)`: Check and call registered handlers.
    * `isCursorMovable()`: Checks if the cursor can be moved.
    * `cursorDown()`, `cursorUp()`, `cursorRight()`, `cursorLeft()`, `cursorPagedown()`, `cursorPageup()`: Handle cursor movement logic.
    * `scrollDown()`, `scrollUp()`: Scroll the window content by one row.
    * `update()`: Main update loop (handles input processing, scrolling, cursor).
    * `updateArrows()`: Updates the visibility of the scroll arrows.
    * `processCursorMove()`: Handles cursor movement input.
    * `processHandling()`: Handles OK, Cancel, PageUp/Down input triggers.
    * `processWheel()`: Handles mouse wheel scrolling.
    * `processTouch()`: Handles touch input for selection and scrolling.
    * `hitTest(x, y)`: Determines which item index is at the given local coordinates.
    * `isOkEnabled()`, `isCancelEnabled()`: Check if OK/Cancel handlers are set.
    * `isOkTriggered()`, `isCancelTriggered()`: Check for OK/Cancel input.
    * `processOk()`, `processCancel()`, `processPageup()`, `processPagedown()`: Core logic for handling confirmed actions or cancellation.
    * `callOkHandler()`, `callCancelHandler()`: Call the appropriate registered handlers.
    * `updateCursor()`: Updates the position and size of the selection cursor rectangle.
    * `isCursorVisible()`: Checks if the cursor should be visible on the current page.
    * `ensureCursorVisible()`: Scrolls the window if necessary to make the cursor visible.
    * `callUpdateHelp()`, `updateHelp()`, `setHelpWindowItem(item)`: Manage updating the linked help window.
    * `isCurrentItemEnabled()`: Checks if the currently selected item is enabled (intended to be overridden).
    * `drawAllItems()`: Calls `drawItem` for all visible items.
    * `drawItem(index)`: Draws a single item (must be overridden by subclasses).
    * `clearItem(index)`: Clears the drawing area for a single item.
    * `redrawItem(index)`, `redrawCurrentItem()`: Redraws specific items.
    * `refresh()`: Clears contents and redraws all items.

    ## Window_Command

    A subclass of `Window_Selectable` specialized for displaying a list of commands.

    **Key Properties:**

    * `_list`: An array containing command objects `{ name:, symbol:, enabled:, ext: }`.

    **Key Methods:**

    * `initialize(x, y)`: Constructor. Calls `makeCommandList` and sets up the window size.
    * `windowWidth()`: Default width (240).
    * `windowHeight()`: Calculates height based on the number of commands.
    * `numVisibleRows()`: Number of rows to display (usually all commands).
    * `maxItems()`: Returns the number of commands in the `_list`.
    * `clearCommandList()`: Empties the command list.
    * `makeCommandList()`: Populates the command list (must be overridden).
    * `addCommand(name, symbol, enabled, ext)`: Adds a command to the list.
    * `commandName(index)`, `commandSymbol(index)`, `isCommandEnabled(index)`, `currentData()`, `isCurrentItemEnabled()`, `currentSymbol()`, `currentExt()`: Accessors for command data at a given index or the current index.
    * `findSymbol(symbol)`, `selectSymbol(symbol)`: Find and select a command by its symbol.
    * `findExt(ext)`, `selectExt(ext)`: Find and select a command by its extension data.
    * `drawItem(index)`: Draws a command name, adjusting opacity based on enabled status.
    * `itemTextAlign()`: Default text alignment ('left').
    * `isOkEnabled()`: Returns true.
    * `callOkHandler()`: Calls the handler associated with the command's symbol, or the generic 'ok' handler.
    * `refresh()`: Rebuilds the command list and redraws the window.

    ## Window_HorzCommand

    A subclass of `Window_Command` for horizontal command layouts.

    **Key Methods:**

    * `numVisibleRows()`: Returns 1.
    * `maxCols()`: Returns the number of columns (default 4).
    * `itemTextAlign()`: Returns 'center'.

    ## Window_Help

    Displays item descriptions or other help text. Usually linked to a `Window_Selectable`.

    **Key Methods:**

    * `initialize(numLines)`: Constructor. Creates a window usually 2 lines high.
    * `setText(text)`: Sets the help text and refreshes.
    * `clear()`: Clears the help text.
    * `setItem(item)`: Sets the text based on an item's description.
    * `refresh()`: Clears and redraws the current text using `drawTextEx`.

    ## Window_Gold

    Displays the party's current gold.

    **Key Methods:**

    * `initialize(x, y)`: Constructor.
    * `windowWidth()`: Default width (240).
    * `windowHeight()`: Fits 1 line.
    * `refresh()`: Clears and redraws the currency value.
    * `value()`: Returns `$gameParty.gold()`.
    * `currencyUnit()`: Returns `TextManager.currencyUnit`.
    * `open()`: Refreshes before opening.

    ## Window_MenuCommand

    The command window on the main menu screen (`Scene_Menu`).

    **Key Methods:**

    * `initialize(x, y)`: Constructor. Selects the last used command.
    * `initCommandPosition()`: (Static) Resets the last command memory.
    * `windowWidth()`: Default width (240).
    * `numVisibleRows()`: Shows all commands.
    * `makeCommandList()`: Adds commands based on `$dataSystem.menuCommands` and game state (Item, Skill, Equip, Status, Formation, Options, Save, Game End).
    * `addMainCommands()`, `addFormationCommand()`, `addOriginalCommands()`, `addOptionsCommand()`, `addSaveCommand()`, `addGameEndCommand()`: Helper methods for adding specific commands.
    * `needsCommand(name)`: Checks if a command should be included based on system settings.
    * `areMainCommandsEnabled()`, `isFormationEnabled()`, `isOptionsEnabled()`, `isSaveEnabled()`, `isGameEndEnabled()`: Check if commands should be enabled.
    * `processOk()`: Remembers the selected symbol before calling the handler.
    * `selectLast()`: Selects the previously chosen command or a default.

    ## Window_MenuStatus

    Displays party member status on the main menu screen.

    **Key Methods:**

    * `initialize(x, y)`: Constructor. Sets up formation mode properties.
    * `windowWidth()`, `windowHeight()`: Define window size.
    * `maxItems()`: Returns party size.
    * `itemHeight()`: Calculates height per actor display.
    * `numVisibleRows()`: Default 4.
    * `loadImages()`: Reserves face images for party members.
    * `drawItem(index)`: Draws the actor's face and simple status.
    * `drawItemBackground(index)`: Draws a highlight if the actor is pending formation swap.
    * `drawItemImage(index)`: Draws the actor's face.
    * `drawItemStatus(index)`: Draws name, level, icons, HP, MP using `drawActorSimpleStatus`.
    * `processOk()`: Sets the selected actor as the party's menu actor.
    * `isCurrentItemEnabled()`: Checks if the actor can be selected (considers formation mode).
    * `selectLast()`: Selects the party's current menu actor.
    * `formationMode()`, `setFormationMode()`: Get/set formation mode.
    * `pendingIndex()`, `setPendingIndex()`: Get/set the actor index pending a formation swap.

    ## Window_MenuActor

    A specialized `Window_MenuStatus` used for selecting a target actor (e.g., for items/skills).

    **Key Methods:**

    * `initialize()`: Constructor. Starts hidden.
    * `processOk()`: Sets the selected actor as the party's target actor.
    * `selectLast()`: Selects the party's current target actor.
    * `selectForItem(item)`: Configures selection mode based on the item/skill's scope (single target, all, user).

    ## Window_ItemCategory

    Horizontal command window for selecting item categories (Item, Weapon, Armor, KeyItem) on the item or shop screens.

    **Key Methods:**

    * `initialize()`: Constructor.
    * `windowWidth()`: Full screen width.
    * `maxCols()`: Returns 4.
    * `update()`: Updates the linked item window's category when the selection changes.
    * `makeCommandList()`: Adds the standard item categories.
    * `setItemWindow(itemWindow)`: Links the item list window.

    ## Window_ItemList

    Displays a list of items, used on the item screen and as a base for other lists (skills, equipment).

    **Key Properties:**

    * `_category`: The currently displayed item category ('item', 'weapon', 'armor', 'keyItem', 'none').
    * `_data`: Array of items to be displayed.

    **Key Methods:**

    * `initialize(x, y, width, height)`: Constructor.
    * `setCategory(category)`: Sets the item category and refreshes.
    * `maxCols()`: Returns 2.
    * `maxItems()`: Returns the length of the `_data` array.
    * `item()`: Gets the currently selected item object.
    * `isCurrentItemEnabled()`: Checks if the current item can be used.
    * `includes(item)`: Checks if an item belongs to the current category (must be overridden by subclasses if needed).
    * `needsNumber()`: Returns true if the item count should be displayed.
    * `isEnabled(item)`: Checks if the party can use the item.
    * `makeItemList()`: Filters `$gameParty.allItems()` based on the category.
    * `selectLast()`: Selects the last used item.
    * `drawItem(index)`: Draws the item name, icon, and number.
    * `numberWidth()`: Width needed for drawing the item count.
    * `drawItemNumber(item, x, y, width)`: Draws the quantity of the item the party possesses.
    * `updateHelp()`: Updates the help window with the selected item's description.
    * `refresh()`: Rebuilds the item list (`makeItemList`) and redraws.

    ## Window_SkillType

    Command window for selecting skill types (e.g., Magic, Special) on the skill screen.

    **Key Properties:**

    * `_actor`: The actor whose skill types are being displayed.
    * `_skillWindow`: The linked `Window_SkillList`.

    **Key Methods:**

    * `initialize(x, y)`: Constructor.
    * `setActor(actor)`: Sets the actor and refreshes.
    * `makeCommandList()`: Populates the list with the actor's available skill types.
    * `update()`: Updates the linked skill window's skill type ID.
    * `setSkillWindow(skillWindow)`: Links the skill list window.
    * `selectLast()`: Selects the skill type of the actor's last used skill.

    ## Window_SkillStatus

    Displays the actor's status (face, basic info) on the skill screen.

    **Key Properties:**

    * `_actor`: The actor whose status is displayed.

    **Key Methods:**

    * `initialize(x, y, width, height)`: Constructor.
    * `setActor(actor)`: Sets the actor and refreshes.
    * `refresh()`: Clears and draws the actor's face and simple status.

    ## Window_SkillList

    Displays a list of skills for a specific actor and skill type.

    **Key Properties:**

    * `_actor`: The actor whose skills are shown.
    * `_stypeId`: The skill type ID currently being displayed.
    * `_data`: Array of skills to display.

    **Key Methods:**

    * `initialize(x, y, width, height)`: Constructor.
    * `setActor(actor)`: Sets the actor and refreshes.
    * `setStypeId(stypeId)`: Sets the skill type ID and refreshes.
    * `maxCols()`: Returns 2.
    * `includes(item)`: Checks if a skill matches the current `_stypeId`.
    * `isEnabled(item)`: Checks if the actor can use the skill.
    * `makeItemList()`: Filters the actor's skills based on the `_stypeId`.
    * `selectLast()`: Selects the actor's last used battle or menu skill.
    * `drawItem(index)`: Draws the skill name, icon, and cost.
    * `costWidth()`: Width needed for drawing skill cost.
    * `drawSkillCost(skill, x, y, width)`: Draws the MP or TP cost of the skill.
    * `updateHelp()`: Updates the help window with the skill description.
    * `refresh()`: Rebuilds the skill list and redraws.

    ## Window_EquipStatus

    Displays actor parameters and changes resulting from equipping items on the equipment screen.

    **Key Properties:**

    * `_actor`: The actor whose status is shown.
    * `_tempActor`: A temporary actor used to preview status changes with new equipment.

    **Key Methods:**

    * `initialize(x, y)`: Constructor.
    * `setActor(actor)`: Sets the actor and refreshes.
    * `refresh()`: Draws the actor's name and current parameters.
    * `setTempActor(tempActor)`: Sets the temporary actor for comparison and refreshes.
    * `drawItem(x, y, paramId)`: Draws a single parameter line (name, current value, arrow, new value).
    * `drawParamName()`, `drawCurrentParam()`, `drawRightArrow()`, `drawNewParam()`: Helper drawing methods.

    ## Window_EquipCommand

    Horizontal command window on the equipment screen (Equip, Optimize, Clear).

    **Key Methods:**

    * `initialize(x, y, width)`: Constructor.
    * `windowWidth()`: Returns the provided width.
    * `maxCols()`: Returns 3.
    * `makeCommandList()`: Adds the 'Equip', 'Optimize', 'Clear' commands.

    ## Window_EquipSlot

    Displays the equipment slots for an actor on the equipment screen.

    **Key Properties:**

    * `_actor`: The actor whose slots are shown.
    * `_statusWindow`: Linked `Window_EquipStatus`.
    * `_itemWindow`: Linked `Window_EquipItem`.

    **Key Methods:**

    * `initialize(x, y, width, height)`: Constructor.
    * `setActor(actor)`: Sets the actor and refreshes.
    * `update()`: Updates the linked item window with the selected slot ID.
    * `maxItems()`: Returns the number of equip slots for the actor.
    * `item()`: Returns the item currently equipped in the selected slot.
    * `drawItem(index)`: Draws the slot name and the equipped item's name.
    * `slotName(index)`: Gets the name of the equipment type for the slot.
    * `isEnabled(index)`: Checks if the slot can be changed.
    * `setStatusWindow(statusWindow)`: Links the status window.
    * `setItemWindow(itemWindow)`: Links the item window.
    * `updateHelp()`: Updates help window and clears temp actor in status window.

    ## Window_EquipItem

    Displays a list of equipment that can be equipped in the currently selected slot.

    **Key Properties:**

    * `_actor`: The actor equipping the item.
    * `_slotId`: The index of the equipment slot being changed.
    * `_statusWindow`: Linked `Window_EquipStatus`.

    **Key Methods:**

    * `initialize(x, y, width, height)`: Constructor.
    * `setActor(actor)`: Sets the actor and refreshes.
    * `setSlotId(slotId)`: Sets the slot ID and refreshes.
    * `includes(item)`: Checks if an item is equippable in the current slot by the current actor.
    * `isEnabled(item)`: Returns true (enabled status is visual only via opacity).
    * `setStatusWindow(statusWindow)`: Links the status window.
    * `updateHelp()`: Updates help window and shows parameter changes in the status window using a temporary actor.
    * `playOkSound()`: Overridden to play no sound on selection (sound plays on confirm).

    ## Window_Status

    Displays detailed status information for a single actor on the status screen.

    **Key Properties:**

    * `_actor`: The actor whose status is shown.

    **Key Methods:**

    * `initialize()`: Constructor.
    * `setActor(actor)`: Sets the actor and refreshes.
    * `refresh()`: Draws all status blocks (basic info, parameters, equipment, profile).
    * `drawBlock1()`..`drawBlock4()`: Draw specific sections of the status screen.
    * `drawHorzLine()`: Draws horizontal separator lines.
    * `drawBasicInfo()`, `drawParameters()`, `drawExpInfo()`, `drawEquipments()`, `drawProfile()`: Helper drawing methods.

    ## Window_Options

    The command window for changing game settings on the options screen.

    **Key Methods:**

    * `initialize()`: Constructor. Centers the window.
    * `windowWidth()`, `windowHeight()`: Define window size.
    * `updatePlacement()`: Centers the window on screen.
    * `makeCommandList()`: Adds general (Always Dash, Command Remember) and volume options.
    * `addGeneralOptions()`, `addVolumeOptions()`: Helper methods.
    * `drawItem(index)`: Draws the option name and its current status (ON/OFF or volume %).
    * `statusWidth()`: Width reserved for the status text.
    * `statusText(index)`: Gets the text representation of the option's value.
    * `isVolumeSymbol(symbol)`, `booleanStatusText()`, `volumeStatusText()`: Helpers for formatting status text.
    * `processOk()`: Toggles boolean options or cycles volume levels.
    * `cursorRight()`, `cursorLeft()`: Change option values with left/right input.
    * `volumeOffset()`: Amount volume changes per step (20).
    * `changeValue(symbol, value)`: Updates the configuration and redraws the item.
    * `getConfigValue(symbol)`, `setConfigValue(symbol, volume)`: Get/set values in `ConfigManager`.

    ## Window_SavefileList

    Displays the list of save files on the save/load screens.

    **Key Properties:**

    * `_mode`: 'save' or 'load'.

    **Key Methods:**

    * `initialize(x, y, width, height)`: Constructor.
    * `setMode(mode)`: Sets the window mode.
    * `maxItems()`: Returns the maximum number of save files (`DataManager.maxSavefiles()`).
    * `maxVisibleItems()`: Returns 5.
    * `itemHeight()`: Calculates height per save slot display.
    * `drawItem(index)`: Draws the information for a single save file slot (File ID, Title, Characters, Playtime).
    * `drawFileId()`, `drawContents()`, `drawGameTitle()`, `drawPartyCharacters()`, `drawPlaytime()`: Helper drawing methods.
    * `playOkSound()`: Overridden to play no sound on selection.

    ## Window_ShopCommand

    Horizontal command window on the shop screen (Buy, Sell, Cancel).

    **Key Properties:**

    * `_purchaseOnly`: Boolean indicating if selling is disabled.

    **Key Methods:**

    * `initialize(width, purchaseOnly)`: Constructor.
    * `windowWidth()`: Returns the provided width.
    * `maxCols()`: Returns 3.
    * `makeCommandList()`: Adds Buy, Sell (if not purchase only), and Cancel commands.

    ## Window_ShopBuy

    Displays items available for purchase in a shop.

    **Key Properties:**

    * `_shopGoods`: Array of goods data provided when the shop scene starts.
    * `_money`: The party's current gold.
    * `_price`: Array storing the price for each item in the `_data` list.
    * `_statusWindow`: Linked `Window_ShopStatus`.

    **Key Methods:**

    * `initialize(x, y, height, shopGoods)`: Constructor.
    * `windowWidth()`: Returns 456.
    * `item()`: Gets the currently selected item data.
    * `setMoney(money)`: Updates the party's gold amount and refreshes.
    * `isCurrentItemEnabled()`: Checks if the item can be afforded and carried.
    * `price(item)`: Gets the price of a specific item.
    * `isEnabled(item)`: Checks affordability and party item limits.
    * `refresh()`: Rebuilds the item list and redraws.
    * `makeItemList()`: Creates the `_data` and `_price` arrays from `_shopGoods`.
    * `drawItem(index)`: Draws item name and price.
    * `setStatusWindow(statusWindow)`: Links the status window.
    * `updateHelp()`: Updates help and status windows.

    ## Window_ShopSell

    Displays items the party possesses that can be sold. Inherits from `Window_ItemList`.

    **Key Methods:**

    * `initialize(x, y, width, height)`: Constructor.
    * `isEnabled(item)`: Checks if the item has a price > 0 (i.e., is sellable).

    ## Window_ShopNumber

    Window for selecting the quantity of an item to buy or sell.

    **Key Properties:**

    * `_item`: The item being bought/sold.
    * `_max`: The maximum quantity allowed.
    * `_price`: The price per item.
    * `_number`: The currently selected quantity.
    * `_currencyUnit`: The currency symbol.
    * `_buttons`: Array of sprites for touch input buttons (Up, Down, OK, etc.).

    **Key Methods:**

    * `initialize(x, y, height)`: Constructor. Creates buttons.
    * `windowWidth()`: Returns 456.
    * `number()`: Gets the current quantity.
    * `setup(item, max, price)`: Configures the window for a specific item transaction.
    * `setCurrencyUnit(currencyUnit)`: Sets the currency symbol.
    * `createButtons()`, `placeButtons()`, `updateButtonsVisiblity()`, `showButtons()`, `hideButtons()`: Manage touch input buttons.
    * `refresh()`: Draws item name, quantity, and total price.
    * `drawMultiplicationSign()`, `drawNumber()`, `drawTotalPrice()`: Helper drawing methods.
    * `itemY()`, `priceY()`, `buttonY()`: Calculate vertical positions for drawing elements.
    * `cursorWidth()`, `cursorX()`, `maxDigits()`: Manage the number input cursor.
    * `update()`: Handles number change input.
    * `processNumberChange()`: Increases/decreases number based on arrow key input.
    * `changeNumber(amount)`: Updates the quantity, clamping between 1 and `_max`.
    * `updateCursor()`: Positions the cursor rectangle over the number.
    * `onButtonUp()`, `onButtonDown()`, `onButtonUp2()`, `onButtonDown2()`, `onButtonOk()`: Handle touch button clicks.

    ## Window_ShopStatus

    Displays item possession count and actor equipment/stats comparison on the shop screen.

    **Key Properties:**

    * `_item`: The item currently selected in the buy/sell window.
    * `_pageIndex`: Current page index for displaying party members if they exceed the display limit.

    **Key Methods:**

    * `initialize(x, y, width, height)`: Constructor.
    * `refresh()`: Draws possession count and equipment info for visible party members.
    * `setItem(item)`: Sets the item being considered and refreshes.
    * `isEquipItem()`: Checks if the item is a weapon or armor.
    * `drawPossession(x, y)`: Draws the "Possession:" count.
    * `drawEquipInfo(x, y)`: Draws equipment comparison info for visible party members.
    * `statusMembers()`: Gets the list of party members for the current page.
    * `pageSize()`: Number of members per page (4).
    * `maxPages()`: Total number of pages needed.
    * `drawActorEquipInfo(x, y, actor)`: Draws name, current equipment, and parameter changes for one actor.
    * `drawActorParamChange(x, y, actor, item1)`: Draws the parameter difference (+/- value).
    * `paramId()`: Determines which parameter (ATK or DEF) to compare based on item type.
    * `currentEquippedItem(actor, etypeId)`: Finds the item the actor currently has equipped in the relevant slot(s).
    * `update()`: Handles page change input.
    * `updatePage()`, `isPageChangeEnabled()`, `isPageChangeRequested()`, `changePage()`: Logic for cycling through party member pages.

    ## Window_NameEdit

    Displays the actor's name being edited and the character sprites on the name input screen.

    **Key Properties:**

    * `_actor`: The actor being named.
    * `_name`: The current name string being edited.
    * `_index`: The current cursor position within the name string.
    * `_maxLength`: Maximum allowed name length.
    * `_defaultName`: The actor's original name.

    **Key Methods:**

    * `initialize(actor, maxLength)`: Constructor.
    * `windowWidth()`: Returns 480.
    * `windowHeight()`: Fits 4 lines (Face + Name area).
    * `name()`: Returns the current name string.
    * `restoreDefault()`: Resets the name to the default.
    * `add(ch)`: Adds a character to the name.
    * `back()`: Removes the last character (backspace).
    * `faceWidth()`: Returns 144.
    * `charWidth()`: Calculates the width of a character.
    * `left()`: Calculates the starting X position for the name characters.
    * `itemRect(index)`, `underlineRect(index)`: Calculate rectangles for character positions and underlines.
    * `drawUnderline(index)`, `drawChar(index)`: Draw the underline and character at a given position.
    * `refresh()`: Redraws the face, underlines, characters, and cursor.

    ## Window_NameInput

    The window with character tables (Latin, Japanese, Russian) for name input.

    **Key Properties:**

    * `LATIN1`, `LATIN2`, `RUSSIA`, `JAPAN1`, `JAPAN2`, `JAPAN3`: (Static) Arrays defining the character layouts for different input modes.
    * `_editWindow`: Linked `Window_NameEdit`.
    * `_page`: Current character page index (e.g., Latin1 vs Latin2).
    * `_index`: Current selected character index (0-89).

    **Key Methods:**

    * `initialize(editWindow)`: Constructor. Positions below the edit window.
    * `windowHeight()`: Fits 9 rows.
    * `table()`: Returns the array of character tables based on system language.
    * `maxCols()`: Returns 10.
    * `maxItems()`: Returns 90 (10 cols * 9 rows).
    * `character()`: Gets the character string at the current index/page.
    * `isPageChange()`, `isOk()`: Check if the cursor is on the Page or OK button.
    * `itemRect(index)`: Calculates the rectangle for a character button.
    * `refresh()`: Redraws all characters for the current page.
    * `updateCursor()`: Positions the cursor over the selected character/button.
    * `cursorDown()`, `cursorUp()`, `cursorRight()`, `cursorLeft()`: Handle grid navigation.
    * `cursorPagedown()`, `cursorPageup()`: Change character pages.
    * `processCursorMove()`: Handles cursor movement input and page change sounds.
    * `processHandling()`: Handles Shift (jump to OK), Cancel (backspace), and OK input.
    * `processJump()`, `processBack()`, `processOk()`: Logic for specific inputs.
    * `onNameAdd()`: Adds the selected character to the edit window.
    * `onNameOk()`: Confirms the name input (restores default if empty, otherwise calls OK handler).

    ## Window_ChoiceList

    Displays the choices for the "Show Choices" event command.

    **Key Properties:**

    * `_messageWindow`: Linked `Window_Message`.
    * `_background`: Background type (from $gameMessage).

    **Key Methods:**

    * `initialize(messageWindow)`: Constructor. Starts closed and inactive.
    * `start()`: Sets up position, background, commands, selects default, opens, and activates.
    * `selectDefault()`: Selects the default choice specified in the event command.
    * `updatePlacement()`: Positions the window above or below the message window based on `choicePositionType`.
    * `updateBackground()`: Sets background type based on `choiceBackground`.
    * `windowWidth()`: Calculates width based on the longest choice text.
    * `numVisibleRows()`: Calculates visible rows based on available screen space and choice count.
    * `maxChoiceWidth()`: Finds the width needed for the longest choice text.
    * `makeCommandList()`: Populates commands from `$gameMessage.choices()`.
    * `drawItem(index)`: Draws a choice using `drawTextEx`.
    * `isCancelEnabled()`: Checks if a cancel choice type is set.
    * `callOkHandler()`: Sets the choice result, terminates the message, and closes.
    * `callCancelHandler()`: Sets the cancel choice result, terminates the message, and closes.

    ## Window_NumberInput

    Window for the "Input Number" event command.

    **Key Properties:**

    * `_messageWindow`: Linked `Window_Message`.
    * `_number`: The current number being input.
    * `_maxDigits`: Maximum number of digits allowed.
    * `_buttons`: Sprites for touch input buttons (Up, Down, OK).

    **Key Methods:**

    * `initialize(messageWindow)`: Constructor. Creates buttons.
    * `start()`: Sets up max digits, initial value, position, buttons, and opens/activates.
    * `updatePlacement()`: Positions the window above or below the message window.
    * `windowWidth()`: Calculates width based on max digits.
    * `maxCols()`: Returns `_maxDigits`.
    * `itemWidth()`: Width per digit (32).
    * `createButtons()`, `placeButtons()`, `updateButtonsVisiblity()`, `showButtons()`, `hideButtons()`: Manage touch buttons.
    * `buttonY()`: Calculates Y position for touch buttons.
    * `update()`: Handles digit change input.
    * `processDigitChange()`: Modifies the selected digit based on Up/Down input.
    * `changeDigit(up)`: Increments/decrements the digit at the current cursor position.
    * `isOkEnabled()`: Returns true.
    * `processOk()`: Confirms input, sets the game variable, terminates the message, and closes.
    * `drawItem(index)`: Draws a single digit of the number.
    * `onButtonUp()`, `onButtonDown()`, `onButtonOk()`: Handle touch button clicks.

    ## Window_EventItem

    Window for the "Select Item" event command.

    **Key Properties:**

    * `_messageWindow`: Linked `Window_Message`.

    **Key Methods:**

    * `initialize(messageWindow)`: Constructor. Sets up handlers.
    * `windowHeight()`: Fits 4 rows.
    * `numVisibleRows()`: Returns 4.
    * `start()`: Refreshes, positions, selects first item, opens, and activates.
    * `updatePlacement()`: Positions the window at the top or bottom opposite the message window.
    * `includes(item)`: Checks if the item's type matches the `itemChoiceItypeId` from $gameMessage.
    * `isEnabled(item)`: Returns true (all selectable items are enabled).
    * `onOk()`: Sets the chosen item ID to the game variable, terminates message, closes.
    * `onCancel()`: Sets the variable to 0, terminates message, closes.

    ## Window_Message

    The main window for displaying dialogue and text in the game.

    **Key Properties:**

    * `_background`: Background type (Window, Dim, Transparent).
    * `_positionType`: Window position (Top, Middle, Bottom).
    * `_textState`: Object holding the current state of text processing (index, position, text).
    * `_waitCount`: Frames to wait.
    * `_lineShowFast`, `_showFast`: Flags for fast text display.
    * `_pauseSkip`: Flag to skip the pause at the end of text.
    * `_faceBitmap`: Bitmap used for drawing the message face graphic.
    * (Sub Windows): `_goldWindow`, `_choiceWindow`, `_numberWindow`, `_itemWindow`.

    **Key Methods:**

    * `initialize()`: Constructor. Sets up sub-windows.
    * `initMembers()`: Initializes internal state variables.
    * `subWindows()`: Returns array of sub-windows.
    * `createSubWindows()`: Creates instances of sub-windows.
    * `windowWidth()`, `windowHeight()`: Define window size (full width, 4 lines high).
    * `clearFlags()`: Resets speed/pause flags.
    * `update()`: Core update loop managing waiting, loading, input, and message processing.
    * `checkToNotClose()`: Prevents closing if the next message continues immediately.
    * `canStart()`: Checks if there's text to display and not in scroll mode.
    * `startMessage()`: Initializes `_textState` and begins processing a new message.
    * `updatePlacement()`: Sets window Y position based on message settings.
    * `updateBackground()`: Sets background type.
    * `terminateMessage()`: Closes the window and clears the message from `$gameMessage`.
    * `updateWait()`: Decrements wait counter.
    * `updateLoading()`: Waits for face graphic to load before drawing.
    * `updateInput()`: Checks for pause input or active sub-windows.
    * `isAnySubWindowActive()`: Checks if choices/number input/item selection is active.
    * `updateMessage()`: Processes text characters one by one until pause/wait/end.
    * `onEndOfText()`: Handles the end of a message block (starts input or pauses).
    * `startInput()`: Starts the appropriate sub-window (Choice, Number, Item).
    * `isTriggered()`: Checks for confirmation/advance input.
    * `doesContinue()`: Checks if the next message starts immediately without closing.
    * `areSettingsChanged()`: Checks if background/position type changed for the next message.
    * `updateShowFast()`: Sets fast display flag if input is triggered.
    * `newPage(textState)`: Clears contents and prepares for a new page of text.
    * `loadMessageFace()`, `drawMessageFace()`: Load and draw the face graphic.
    * `newLineX()`: Calculates starting X position based on whether a face is shown.
    * `processNewLine()`: Handles newline characters, potentially pausing if page is full.
    * `processNewPage()`: Handles form feed character (`\f`), forces a pause.
    * `isEndOfText(textState)`, `needsNewPage(textState)`: Check text processing state.
    * `processEscapeCharacter(code, textState)`: Overridden to handle message-specific codes ($, ., |, !, >, <, ^).
    * `startWait(count)`: Initiates a wait.
    * `startPause()`: Waits for player input to continue.

    ## Window_ScrollText

    A frameless window used for the "Show Scrolling Text" event command.

    **Key Properties:**

    * `_text`: The full text to scroll.
    * `_allTextHeight`: The calculated total height of the text content.

    **Key Methods:**

    * `initialize()`: Constructor. Sets up a full-screen, initially hidden/transparent window.
    * `update()`: Starts message when available, updates scrolling position.
    * `startMessage()`: Sets the text, refreshes contents, shows the window.
    * `refresh()`: Calculates text height, creates contents bitmap, draws text, resets scroll position.
    * `contentsHeight()`: Returns the calculated `_allTextHeight`.
    * `updateMessage()`: Moves the `origin.y` to scroll the text upwards.
    * `scrollSpeed()`: Gets scroll speed from `$gameMessage`, adjusted by fast-forward.
    * `isFastForward()`: Checks for OK/Shift/Touch input to speed up scrolling (unless disabled).
    * `fastForwardRate()`: Multiplier for fast-forward speed (3).
    * `terminateMessage()`: Clears text, hides window, clears message from `$gameMessage`.

    ## Window_MapName

    Displays the map name briefly when entering a map.

    **Key Properties:**

    * `_showCount`: Countdown timer for how long the window stays visible.

    **Key Methods:**

    * `initialize()`: Constructor. Sets opacity to 0.
    * `windowWidth()`: Returns 360.
    * `windowHeight()`: Fits 1 line.
    * `update()`: Handles fade-in and fade-out based on `_showCount`.
    * `updateFadeIn()`, `updateFadeOut()`: Adjust `contentsOpacity`.
    * `open()`: Resets `_showCount` to start the display sequence.
    * `close()`: Sets `_showCount` to 0 to start fading out.
    * `refresh()`: Draws the map name with a gradient background.
    * `drawBackground()`: Draws the gradient background for the map name.

    ## Window_BattleLog

    A frameless window used to display messages during battle.

    **Key Properties:**

    * `_lines`: Array of text lines currently displayed.
    * `_methods`: Queue of methods to call sequentially (for animations, waits, text display).
    * `_waitCount`: Frame counter for waits.
    * `_waitMode`: String indicating what to wait for ('effect', 'movement').
    * `_baseLineStack`: Used to manage nested action messages.
    * `_spriteset`: Reference to the `Spriteset_Battle`.
    * `_backBitmap`, `_backSprite`: Used to draw the semi-transparent log background.

    **Key Methods:**

    * `initialize()`: Constructor. Creates background bitmap/sprite.
    * `setSpriteset(spriteset)`: Links the battle spriteset.
    * `windowWidth()`, `windowHeight()`: Define size.
    * `maxLines()`: Maximum lines displayed (10).
    * `messageSpeed()`: Default wait time after text (16 frames).
    * `isBusy()`: Checks if waiting or methods are queued.
    * `update()`: Calls next method if not waiting.
    * `updateWait()`, `updateWaitCount()`, `updateWaitMode()`: Handle different wait conditions.
    * `setWaitMode(waitMode)`: Sets the wait mode.
    * `callNextMethod()`: Executes the next method in the queue.
    * `isFastForward()`: Checks input to speed up waits.
    * `push(methodName, ...params)`: Adds a method call to the queue.
    * `clear()`: Clears lines and resets state.
    * `wait()`: Adds a standard wait to the queue.
    * `waitForEffect()`, `waitForMovement()`: Set wait modes.
    * `addText(text)`: Adds a line of text and waits.
    * `pushBaseLine()`, `popBaseLine()`: Manage nesting for action results display.
    * `waitForNewLine()`: Waits if necessary before adding more lines within a base line block.
    * `popupDamage(target)`: Pushes command to show damage popup on the target's sprite.
    * `performActionStart()`, `performAction()`, `performActionEnd()`, `performDamage()`, `performMiss()`, etc.: Push commands to trigger battle animations/effects on battler sprites.
    * `showAnimation()`, `showAttackAnimation()`, `showNormalAnimation()`: Push commands to play battle animations.
    * `refresh()`: Redraws the background and all current lines.
    * `drawBackground()`, `backRect()`, `backColor()`, `backPaintOpacity()`: Draw the log background.
    * `drawLineText(index)`: Draws a single line of text.
    * `startTurn()`, `startAction()`, `endAction()`: Push sequences of methods for battle phases.
    * `displayCurrentState()`, `displayRegeneration()`: Display status messages.
    * `displayAction()`: Display the action/item usage message.
    * `displayCounter()`, `displayReflection()`, `displaySubstitute()`: Display specific action messages.
    * `displayActionResults()`: Display the outcome of an action (damage, status changes, etc.).
    * `displayFailure()`, `displayCritical()`, `displayDamage()`, `displayMiss()`, `displayEvasion()`: Display specific results.
    * `displayHpDamage()`, `displayMpDamage()`, `displayTpDamage()`: Display detailed damage/recovery messages.
    * `displayAffectedStatus()`, `displayAutoAffectedStatus()`: Display status changes.
    * `displayChangedStates()`, `displayAddedStates()`, `displayRemovedStates()`: Display state changes.
    * `displayChangedBuffs()`, `displayBuffs()`: Display buff/debuff changes.
    * `makeHpDamageText()`, `makeMpDamageText()`, `makeTpDamageText()`: Format damage/recovery text messages.

    ## Window_PartyCommand

    Command window on the battle screen for selecting Fight/Escape.

    **Key Methods:**

    * `initialize()`: Constructor. Positions at the bottom, starts closed.
    * `windowWidth()`: Returns 192.
    * `numVisibleRows()`: Returns 4.
    * `makeCommandList()`: Adds Fight and Escape (if possible) commands.
    * `setup()`: Rebuilds commands, refreshes, selects first, activates, and opens.

    ## Window_ActorCommand

    Command window on the battle screen for selecting an actor's action (Attack, Skill, Guard, Item).

    **Key Properties:**

    * `_actor`: The actor whose commands are being displayed.

    **Key Methods:**

    * `initialize()`: Constructor. Positions at the bottom, starts closed.
    * `windowWidth()`: Returns 192.
    * `numVisibleRows()`: Returns 4.
    * `makeCommandList()`: Adds commands available to the current actor.
    * `addAttackCommand()`, `addSkillCommands()`, `addGuardCommand()`, `addItemCommand()`: Helper methods.
    * `setup(actor)`: Sets the actor, rebuilds commands, refreshes, selects last used, activates, opens.
    * `processOk()`: Remembers the chosen command symbol if `commandRemember` option is on.
    * `selectLast()`: Selects the command previously used by the actor based on `ConfigManager.commandRemember`.

    ## Window_BattleStatus

    Displays party member status during battle.

    **Key Methods:**

    * `initialize()`: Constructor. Positions at the bottom right.
    * `windowWidth()`, `windowHeight()`, `numVisibleRows()`: Define window size.
    * `maxItems()`: Returns number of battle members.
    * `refresh()`: Clears and redraws all items.
    * `drawItem(index)`: Draws basic info and gauges for one actor.
    * `basicAreaRect()`, `gaugeAreaRect()`, `gaugeAreaWidth()`: Calculate layout rectangles.
    * `drawBasicArea()`: Draws actor name and icons.
    * `drawGaugeArea()`: Calls specific gauge drawing methods based on TP display option.
    * `drawGaugeAreaWithTp()`, `drawGaugeAreaWithoutTp()`: Draw HP/MP/TP or HP/MP gauges.

    ## Window_BattleActor

    Selectable window version of `Window_BattleStatus` used for selecting ally targets.

    **Key Methods:**

    * `initialize(x, y)`: Constructor. Starts hidden.
    * `show()`: Selects first actor, then shows.
    * `hide()`: Hides and deselects party target.
    * `select(index)`: Selects the window index and sets the corresponding party member as the target.
    * `actor()`: Gets the currently selected actor.

    ## Window_BattleEnemy

    Selectable window for choosing enemy targets.

    **Key Properties:**

    * `_enemies`: Array of alive enemy troop members.

    **Key Methods:**

    * `initialize(x, y)`: Constructor. Starts hidden.
    * `windowWidth()`, `windowHeight()`, `numVisibleRows()`, `maxCols()`: Define window size/layout.
    * `maxItems()`: Returns number of alive enemies.
    * `enemy()`: Gets the currently selected enemy object.
    * `enemyIndex()`: Gets the original index of the selected enemy within the troop.
    * `drawItem(index)`: Draws the enemy's name.
    * `show()`: Refreshes enemy list, selects first, shows window.
    * `hide()`: Hides window and deselects troop target.
    * `refresh()`: Updates the `_enemies` list and redraws.
    * `select(index)`: Selects window index and sets the corresponding enemy as the target.

    ## Window_BattleSkill

    Selectable window for choosing a skill during battle. Inherits from `Window_SkillList`.

    **Key Methods:**

    * `initialize(x, y, width, height)`: Constructor. Starts hidden.
    * `show()`: Selects last used skill, shows help window, shows list.
    * `hide()`: Hides help window and list.

    ## Window_BattleItem

    Selectable window for choosing an item during battle. Inherits from `Window_ItemList`.

    **Key Methods:**

    * `initialize(x, y, width, height)`: Constructor. Starts hidden.
    * `includes(item)`: Checks if the party can use the item in battle.
    * `show()`: Selects last item, shows help window, shows list.
    * `hide()`: Hides help window and list.

    ## Window_TitleCommand

    Command window on the title screen (New Game, Continue, Options).

    **Key Methods:**

    * `initialize()`: Constructor. Positions near bottom center, starts closed.
    * `initCommandPosition()`: (Static) Resets last command memory.
    * `windowWidth()`: Returns 240.
    * `updatePlacement()`: Sets window position.
    * `makeCommandList()`: Adds New Game, Continue (if saves exist), Options.
    * `isContinueEnabled()`: Checks if save files exist.
    * `processOk()`: Remembers selected symbol.
    * `selectLast()`: Selects last chosen command or Continue/New Game.

    ## Window_GameEnd

    Command window on the game end screen (To Title, Cancel).

    **Key Methods:**

    * `initialize()`: Constructor. Positions in center, opens immediately.
    * `windowWidth()`: Returns 240.
    * `updatePlacement()`: Sets window position.
    * `makeCommandList()`: Adds To Title and Cancel commands.

    ## Window_DebugRange

    Selectable window on the debug screen for choosing a range of Switches or Variables.

    **Key Properties:**

    * `_maxSwitches`, `_maxVariables`: Number of 10-item blocks for switches/variables.
    * `_editWindow`: Linked `Window_DebugEdit`.

    **Key Methods:**

    * `initialize(x, y)`: Constructor. Sets up sizes, position, selects last position.
    * `windowWidth()`: Returns 246.
    * `windowHeight()`: Full screen height.
    * `maxItems()`: Total number of switch/variable blocks.
    * `update()`: Updates the linked edit window's mode and starting ID.
    * `mode()`: Returns 'switch' or 'variable' based on index.
    * `topId()`: Calculates the starting ID (1, 11, 21...) for the selected block.
    * `refresh()`: Redraws the list.
    * `drawItem(index)`: Draws the range text (e.g., "S [0001-0010]").
    * `isCancelTriggered()`: Also triggered by Debug key (F9).
    * `processCancel()`: Remembers last position before closing.
    * `setEditWindow(editWindow)`: Links the edit window.

    ## Window_DebugEdit

    Selectable window on the debug screen for editing Switch/Variable values.

    **Key Properties:**

    * `_mode`: 'switch' or 'variable'.
    * `_topId`: The starting ID of the 10 items currently displayed.

    **Key Methods:**

    * `initialize(x, y, width)`: Constructor.
    * `maxItems()`: Returns 10.
    * `refresh()`: Redraws the list of 10 items.
    * `drawItem(index)`: Draws the ID, name, and status (ON/OFF or value).
    * `itemName(dataId)`, `itemStatus(dataId)`: Get name and value/status for a Switch/Variable ID.
    * `setMode(mode)`, `setTopId(id)`: Set the display mode/range and refresh.
    * `currentId()`: Calculates the actual ID of the selected item.
    * `update()`: Handles input for changing values.
    * `updateSwitch()`: Toggles switch value on OK input.
    * `updateVariable()`: Changes variable value with Left/Right (+/- 1) and PageUp/Down (+/- 10).