Jrgreen145

Window/Text Script

3 posts in this topic

Hello,

 

Trying to figure out why this @$#%ing script is misbehaving so poorly. Downloaded it off the web, can't seem to make it work.

I want to display the 6 indicated lines of text without the associated values or icons. Already tried #ing out the v_ and value lines and corresponding draw_ lines. Any ideas?

 

Script is hidden in this spoiler so it doesn't take up a ton of space for those just scrolling through.

 

 

Spoiler



#==============================================================================#
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■ EXTRA MENU WINDOW ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ #
#                          ---=== Version: 1.3 ===---                          #
#==============================================================================#
#                         Script written by: Rikifive                          #
#==============================================================================#
#                              ▼ INTRODUCTION ▼                                #
#==============================================================================#
# This script creates a simple window with custom information in main menu.    #
# Variations, playtime, location etc. can now be displayed in menu.            #
#==============================================================================#
#                              ▼ COMPATIBILITY ▼                               #
#==============================================================================#
# this script is written in the most simplest possible way, but it may         #
# be incompatible with scripts that changes your menu.                         #
#==============================================================================#
#                              ▼ TERMS OF USE ▼                                #
#==============================================================================#
#       ---=== For both COMMERCIAL and NON-COMMERCIAL projects. ===---         #
#         Crediting me (Rikifive) in your game would be appreciated.           #
#==============================================================================#
#                             ▼ VERSION HISTORY ▼                              #
#==============================================================================#
# Version 1.0: Initial Release                                                 #
# Version 1.1: - Changed refresh rate of playtime. (thanks to DigiDeity)       #
# Version 1.2: - Added option that disables the default Gold Window in Menu.   #
#              - Fixed the resolution of the window lines.                     #
# Version 1.3: - Added option to center text/value when not using icons.       #
#              - Moved "Font settings" to "Main Settings".                     #
#==============================================================================#
#                              ▼ INSTRUCTIONS ▼                                #
#==============================================================================#
# I know this script is kinda messy, but it's pretty easy to configure.        #
#                                                                              #
# Configuring things (*items*) displayed in window starts in line #100.        #
# Each item starts with "[ ● Item Setup ]" and ends with second wall of "###". #
# To configure *items* simply follow the examples.                             #
# Do not edit anything between walls of "##############", unless you know what #
# you're doing.                                                                #
# You can add as many lines as you want. (the display resolution is the limit) #
# To add a new line (item), copy everything from "[ ● Item Setup ]" to         #
# second wall of "###" and paste that below/above the other things (items).    #
# You can put text into value or a value into text or you can even put two     #
# texts in the one thing (item), that doesn't matter.                          #
# You can use things like "$game_party.gold" or use a variable.                #
# To add variable into the window put $game_variables[ID] in the text/value.   #
#==============================================================================#
 
#-------------------------------------------------------------------------------
# ► Main Settings (Setup your window and stuff)
#-------------------------------------------------------------------------------
# ● Set amount of items displayed in the window.
WINDOW_LINES = 6
 
# ● Set the window position.
WINDOW_POSITION_X = 0
WINDOW_POSITION_Y = 150

# ● Font settings
BOLD = false # enable / disable font BOLD.
SIZE = 20 # Set the font SIZE.
OUTLINE = false # enable / disable font OUTLINE.
SHADOW = true # enable / disable font SHADOW.

# ● Enable / Disable default Gold Window.
DEFAULT_GOLD_WINDOW = false

# ● In case of incompatibilities (disappearing other custom windows), try
#   moving that script up. If that will not work, you can always disable
#   overwriting of the Scene_Menu < Scene_MenuBase.
#   NOTE: This will disable the "Default Gold Window" option.
OVERWRITE_SCENE_MENU = true

#===========================[ END OF MAIN SETTINGS ]===========================#
#-------------------------------------------------------------------------------
# ► Initialize (Do not touch anything here)
#-------------------------------------------------------------------------------
class Window_ExtraMenuWindow < Window_Base
  def initialize(x, y)
  super(x, y, 160, 24 + 24 * WINDOW_LINES)
  self.z = 500
  self.contents.font.bold = BOLD
  self.contents.font.size = SIZE
  self.contents.font.outline = OUTLINE
  self.contents.font.shadow = SHADOW
  self.contents.font.color = normal_color
  @playtime = 0
  refresh
  
end
 
  #-----------------------------------------------------------------------------
  # ► Setup (Do not touch anything here)
  #-----------------------------------------------------------------------------
  def refresh
  self.contents.clear
  # ● Width & Height
  wid = contents.width - 24
  hei = 72
 
  #-----------------------------------------------------------------------------
  # ► Draw Stuff (Here you can setup displayed stuff)
  #-----------------------------------------------------------------------------
 
  #===========================[ ● Item 1 Setup ]===============================#
  enable = true # Enable this item? (Gold by default)
  if enable # DO NOT TOUCH
  position = 1 # Sets the position of this item
  text = "Numpad 0 to open menu" # Sets the displayed text, leave "" to disable text
  t_align = 0 # Sets the text alignment (0 - left; 1 - center; 2 - right)
  t_red = 150 # Set the color of text displayed
  t_grn = 175 # ~
  t_blu = 255 # ~
 value = $game_party.gold # Sets the value displayed
  v_align = 2 # Sets the value alignment (0 - left; 1 - center; 2 - right)
  v_red = 255 # Set the color of value displayed
  v_grn = 255 # ~
  v_blu = 150 # ~
  icon = 231 # ID of the displayed icon.
  iconpos = 0 # Sets the position of icon (0 - left; 1 - right)
  center = false # Center text/value? (use when icon is not used)
 
  ##############################################################################
  self.contents.font.color = Color.new(t_red,t_grn,t_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, text, t_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, text, t_align)
  end # if CENTER_TEXT
  self.contents.font.color = Color.new(v_red,v_grn,v_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, "#{value}", v_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, "#{value}", v_align)
  end #if CENTER_TEXT
  self.contents.font.color = normal_color
  draw_icon(icon, 0 + 112 * iconpos, -24 + 24 * position)
 else # disabled text
  end # if enable
  ##############################################################################
   
   #===========================[ ● Item 2 Setup ]===============================#
  enable = true # Enable this item? (Gold by default)
  if enable # DO NOT TOUCH
  position = 2 # Sets the position of this item
  text = "Enter to select/interact" # Sets the displayed text, leave "" to disable text
  t_align = 0 # Sets the text alignment (0 - left; 1 - center; 2 - right)
  t_red = 150 # Set the color of text displayed
  t_grn = 175 # ~
  t_blu = 255 # ~
 value = $game_party.gold # Sets the value displayed
  v_align = 2 # Sets the value alignment (0 - left; 1 - center; 2 - right)
  v_red = 255 # Set the color of value displayed
  v_grn = 255 # ~
  v_blu = 150 # ~
    icon = 231 # ID of the displayed icon.
  iconpos = 0 # Sets the position of icon (0 - left; 1 - right)
  center = false # Center text/value? (use when icon is not used)
 
  ##############################################################################
   self.contents.font.color = Color.new(t_red,t_grn,t_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, text, t_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, text, t_align)
  end # if CENTER_TEXT
  self.contents.font.color = Color.new(v_red,v_grn,v_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, "#{value}", v_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, "#{value}", v_align)
  end #if CENTER_TEXT
  self.contents.font.color = normal_color
  draw_icon(icon, 0 + 112 * iconpos, -24 + 24 * position)
 else # disabled text
  end # if enable
  
   #===========================[ ● Item 3 Setup ]===============================#
  enable = true # Enable this item? (Gold by default)
  if enable # DO NOT TOUCH
  position = 3 # Sets the position of this item
  text = "Numpad 0 to go back/cancel" # Sets the displayed text, leave "" to disable text
  t_align = 0 # Sets the text alignment (0 - left; 1 - center; 2 - right)
  t_red = 150 # Set the color of text displayed
  t_grn = 175 # ~
  t_blu = 255 # ~
 value = $game_party.gold # Sets the value displayed
  v_align = 2 # Sets the value alignment (0 - left; 1 - center; 2 - right)
  v_red = 255 # Set the color of value displayed
  v_grn = 255 # ~
  v_blu = 150 # ~
  icon = 361 # ID of the displayed icon.
  iconpos = 1 # Sets the position of icon (0 - left; 1 - right)
  center = false # Center text/value? (use when icon is not used)
 
  ##############################################################################
  self.contents.font.color = Color.new(t_red,t_grn,t_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, text, t_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, text, t_align)
  end # if CENTER_TEXT
  self.contents.font.color = Color.new(v_red,v_grn,v_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, "#{value}", v_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, "#{value}", v_align)
  end #if CENTER_TEXT
  self.contents.font.color = normal_color
  draw_icon(icon, 0 + 112 * iconpos, -24 + 24 * position)
 else # disabled text
  end # if enable  
   #===========================[ ● Item 4 Setup ]===============================#
  enable = true # Enable this item? (Gold by default)
  if enable # DO NOT TOUCH
  position = 4 # Sets the position of this item
  text = "Arrow keys to move" # Sets the displayed text, leave "" to disable text
  t_align = 0 # Sets the text alignment (0 - left; 1 - center; 2 - right)
  t_red = 150 # Set the color of text displayed
  t_grn = 175 # ~
  t_blu = 255 # ~
 value = $game_party.gold # Sets the value displayed
  v_align = 2 # Sets the value alignment (0 - left; 1 - center; 2 - right)
  v_red = 255 # Set the color of value displayed
  v_grn = 255 # ~
  v_blu = 150 # ~
    icon = 231 # ID of the displayed icon.
  iconpos = 0 # Sets the position of icon (0 - left; 1 - right)
  center = false # Center text/value? (use when icon is not used)
 
  ##############################################################################
  self.contents.font.color = Color.new(t_red,t_grn,t_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, text, t_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, text, t_align)
  end # if CENTER_TEXT
  self.contents.font.color = Color.new(v_red,v_grn,v_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, "#{value}", v_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, "#{value}", v_align)
  end #if CENTER_TEXT
  self.contents.font.color = normal_color
  draw_icon(icon, 0 + 112 * iconpos, -24 + 24 * position)
 else # disabled text
  end # if enable
  
     #===========================[ ● Item 5 Setup ]===============================#
  enable = true # Enable this item? (Gold by default)
  if enable # DO NOT TOUCH
  position = 5 # Sets the position of this item
  text = "Q to open objectives log" # Sets the displayed text, leave "" to disable text
  t_align = 0 # Sets the text alignment (0 - left; 1 - center; 2 - right)
  t_red = 150 # Set the color of text displayed
  t_grn = 175 # ~
  t_blu = 255 # ~
 value = $game_party.gold # Sets the value displayed
  v_align = 2 # Sets the value alignment (0 - left; 1 - center; 2 - right)
  v_red = 255 # Set the color of value displayed
  v_grn = 255 # ~
  v_blu = 150 # ~
    icon = 231 # ID of the displayed icon.
  iconpos = 0 # Sets the position of icon (0 - left; 1 - right)
  center = false # Center text/value? (use when icon is not used)
 
  ##############################################################################
  self.contents.font.color = Color.new(t_red,t_grn,t_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, text, t_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, text, t_align)
  end # if CENTER_TEXT
  self.contents.font.color = Color.new(v_red,v_grn,v_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, "#{value}", v_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, "#{value}", v_align)
  end #if CENTER_TEXT
  self.contents.font.color = normal_color
  draw_icon(icon, 0 + 112 * iconpos, -24 + 24 * position)
 else # disabled text
  end # if enable
     #===========================[ ● Item 6 Setup ]===============================#
  enable = true # Enable this item? (Gold by default)
  if enable # DO NOT TOUCH
  position = 6 # Sets the position of this item
  text = "W to return to the chapel" # Sets the displayed text, leave "" to disable text
  t_align = 0 # Sets the text alignment (0 - left; 1 - center; 2 - right)
  t_red = 150 # Set the color of text displayed
  t_grn = 175 # ~
  t_blu = 255 # ~
 value = $game_party.gold # Sets the value displayed
  v_align = 2 # Sets the value alignment (0 - left; 1 - center; 2 - right)
  v_red = 255 # Set the color of value displayed
  v_grn = 255 # ~
  v_blu = 150 # ~
    icon = 231 # ID of the displayed icon.
  iconpos = 0 # Sets the position of icon (0 - left; 1 - right)
  center = false # Center text/value? (use when icon is not used)
 
  ##############################################################################
   self.contents.font.color = Color.new(t_red,t_grn,t_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, text, t_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, text, t_align)
  end # if CENTER_TEXT
  self.contents.font.color = Color.new(v_red,v_grn,v_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, "#{value}", v_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, "#{value}", v_align)
  end #if CENTER_TEXT
  self.contents.font.color = normal_color
  draw_icon(icon, 0 + 112 * iconpos, -24 + 24 * position)
 else # disabled text
 end # if enable
 
 
 
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■#
#■ END OF CUSTOMIZATION, Do not edit anything below, unless you know          ■#
#■ what you're doing!                                                         ■#
#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■#

    @playtime = $game_system.playtime
  end # Refresh
 
  #-----------------------------------------------------------------------------
  # ► Update
  #-----------------------------------------------------------------------------
  def update
    super
    refresh if $game_system.playtime - @playtime >= 1
  end
end

#-------------------------------------------------------------------------------
# ► Disable Window
#-------------------------------------------------------------------------------
if OVERWRITE_SCENE_MENU
class Scene_Menu < Scene_MenuBase
  def start
    super
    create_command_window
    if DEFAULT_GOLD_WINDOW
    create_gold_window
    else
    end # if
    create_status_window
  end # def
end # class
else
end # if

#-------------------------------------------------------------------------------
# ► Create Window
#-------------------------------------------------------------------------------
class Scene_Menu < Scene_MenuBase
 
  #-----------------------------------------------------------------------------
  # ► Start
  #-----------------------------------------------------------------------------
  alias extramenuwindow_start start
  def start
  extramenuwindow_start
  create_extramenuwindow_window
  end
 
  #-----------------------------------------------------------------------------
  # ► create Extra Menu Window
  #-----------------------------------------------------------------------------
  def create_extramenuwindow_window
    @extramenuwindow_window = Window_ExtraMenuWindow.new(WINDOW_POSITION_X, WINDOW_POSITION_Y)
  end
end


 

 

Share this post


Link to post
Share on other sites

Oh, wow, after such a long time I noticed how poorly I wrote that script (tbh I forgot about its existence). Haven't even used modules, what a shame. Also some poor English here and there.

 

Getting to the point;

Bad script! Why you're not nice to devs! Behave yourself or I'll delete you! :angry:

Seriously though, not sure if I remember correctly how I wrote that script, but putting:

value = ""

~in the item settings should get rid of the values you don't want to see. Putting "" will insert a blank text- nothing, that is. I think there's no need to # anything.

 

As for icons, just put the ID of unused icon slot (blank icon). You can view the icon set in the RM's database. Select a blank icon and get its ID. If the text will be off a little, try setting the last option to true:

center = true # Center text/value? (use when icon is not used)

If it is set to false, the text is moved to left/right a little, due to reserved space by icon, so that it has some place to be drawn. Setting that to true should remove the space reservation, thus give the text the whole line.

 

Adjust that for each item (line) you have. I'd test that myself, but my PC is dead at the moment. Try that and tell me what happens.

 

 

Eventually, if above fails, #ing these lines in drawing methods should get rid of these:

self.contents.font.color = Color.new(v_red,v_grn,v_blu)
  if center
  self.contents.draw_text(0, -48 + 24 * position, wid + 24, hei, "#{value}", v_align)
  else # normal
  self.contents.draw_text(24 - 24 * iconpos, -48 + 24 * position, wid, hei, "#{value}", v_align)
  end #if CENTER_TEXT
  self.contents.font.color = normal_color
  draw_icon(icon, 0 + 112 * iconpos, -24 + 24 * position)

But be careful.

 

 

Please quote or mention me when replying, so that I won't miss your reply. Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.