O TEMA DO FÓRUM ESTÁ EM MANUTENÇÃO. FEEDBACKS AQUI: ACESSAR

[VX ACE] Editando Script do Ceodore - Variáveis na Tela !

Iniciado por dragolipe2, 09/01/2022 às 19:35

09/01/2022 às 19:35 Última edição: 11/01/2022 às 06:54 por dragolipe2
Salve galera !!! Eu aqui mais uma vez, como sempre !!!

Estou com um problema com um novo sistema de aumentar atributos que estou fazendo por eventos, é um sistema simples de atributos onde vc aumenta seus status de ataque, defesa, agilidade, etc etc. Porém, um desses atributos a "destreza" aumenta tbm esquiva e crítico, eu armazenei seus valores em uma variável com o script call "$game_variables[166] = $game_actors[1].cri" e utilizo o script do Ceodore para mostra-los na tela, para assim mostrar ao jogador quanto cada personagem possui de esquiva e crítico :
Spoiler
=begin
================================================================================
CDR - Show Variables 1.3
-------------------------------------------------------------------------------
Author: Ceodore
Mail: ceodore@email.com
https://ceodoremaker.wordpress.com
===============================Change log=======================================
  04/04/2013 - 1.3 release. Bug fixes and new stuff
  02/04/2013 - 1.2 release. Added font options.
  01/04/2013 - 1.1 release. Fixed a minor bug.
  01/04/2013 - 1.0 release.
===============================Description======================================
  This implementation is meant to provide a way display any number of variables
  on the map.
=================================License========================================
  You may freely use and modify this script as long as you do not change the
  original author information. If you use this on your game, include the author
  on the credits.
===================================Use==========================================
  Open a Script event command and follow the instructions:
  Before showing a variable you need to define it's options. To do it, type
  the command:
  sv_options(n,x,y,icon,color,dir,icon_pos, lzeros)
  Where n is the variable number and x and y are the value position on screen.
  The other are optional, but it's nice to define, you only need to do it once
  for each variable.
   
    icon -> The icon index
    color -> the color number
    dir -> the text direction, wich can be:
                :ltr (left to right)
                :rtl (Right)
                :mid (center)
    icon_pos -> The icon position, can be :left or :right
    lzeros -> O número de zeros à esquerda
   
  show_variable(n)
  Shows a variable on screen as specified in sv_options()
  hide_variable(n)
  Hides the variable n if it's being displayed on screen.
================================================================================
=end
module CDR_SV
  # sub module containing default font options for the variable values
  module FONT
    NAME = ["Arial"]
    SIZE = 17
    BOLD = false
    ITALIC = false
    SHADOW = false
  end
end
#==============================================================================
#  DataManager
#==============================================================================
SuperDataManager = DataManager.dup
module DataManager
    #--------------------------------------------------------------------------
    # * intercept: clears the variable settings list
    #--------------------------------------------------------------------------
    def self.create_game_objects
      Window_Variables.clear
      SuperDataManager.create_game_objects
    end
end
#==============================================================================
#  Game_Interpreter
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # * new method: displays a variable on map screen
  #--------------------------------------------------------------------------
  def sv_options(n,x,y,icon=nil,color=1,dir=:ltr,icon_pos=:left, lzeros=0)
    return unless SceneManager.scene.is_a?(Scene_Map)
    sv_window = SceneManager.scene.variables_window
    case dir
      when :ltr
        text_direction = 0
      when :mid
        text_direction = 1
      when :rtl
        text_direction = 2
     end
    sv_window.sv_options(n,x,y,icon,color,text_direction,icon_pos,lzeros)
  end
  #--------------------------------------------------------------------------
  # * new method: displays a variable on map screen
  #--------------------------------------------------------------------------
  def show_variable(n)
    return unless SceneManager.scene.is_a?(Scene_Map)
    sv_window = SceneManager.scene.variables_window
    sv_window.show_variable(n)
  end
  #--------------------------------------------------------------------------
  # * new method: hides a displayed variable
  #--------------------------------------------------------------------------
  def hide_variable(n)
    return unless SceneManager.scene.is_a?(Scene_Map)
    sv_window = SceneManager.scene.variables_window
    sv_window.hide_variable(n)
  end
end
#==============================================================================
#  SvOptions
#==============================================================================
class SvOptions
  attr_accessor :id
  attr_accessor :x
  attr_accessor :y
  attr_accessor :text_color
  attr_accessor :x
  attr_accessor :text_direction
  attr_accessor :icon_index
  attr_accessor :icon_position
  attr_accessor :lzeros
  attr_accessor :visible
  #--------------------------------------------------------------------------
  # * new method: initialize
  #--------------------------------------------------------------------------
  def initialize(id,x,y,icon,color,dir,icon_pos,lzeros,visible)   
    @id = id   
    @x = x
    @y = y
    @text_color = color
    @text_direction = dir
    @icon_index = icon
    @icon_position = icon_pos
    @lzeros = lzeros
    @visible = visible   
  end
  #--------------------------------------------------------------------------
  # * new method: displays the variable on map screen
  #--------------------------------------------------------------------------
  def show
    @visible = true
  end
  #--------------------------------------------------------------------------
  # * new method: hides the variable from map screen
  #--------------------------------------------------------------------------
  def hide
    @visible = false
  end
end
#==============================================================================
#  Window_Variables
#==============================================================================
class Window_Variables < Window_Base
  @@items = {}
  #--------------------------------------------------------------------------
  # * new method: initialize
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, window_height)   
    self.opacity = 0
    self.visible = true
    refresh
  end
  #--------------------------------------------------------------------------
  # * new method: window_width
  #--------------------------------------------------------------------------
  def window_width
    return Graphics.width
  end
  #--------------------------------------------------------------------------
  # * new method: window_height
  #--------------------------------------------------------------------------
  def window_height
    return Graphics.height
  end
  #--------------------------------------------------------------------------
  # * new method: variable_width
  #--------------------------------------------------------------------------
  def variable_width
    return 160
  end
  #--------------------------------------------------------------------------
  # * new method: refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear   
    @@items.each{|k,vw| draw_item(vw) if vw.visible}
  end
  #--------------------------------------------------------------------------
  # * new method: refresh
  #--------------------------------------------------------------------------
  def draw_item(item)
    icon_x = draw_item_icon(item) unless item.icon_index.nil?
    change_color(text_color(item.text_color))
    cdr_sv_font
    x_offset = item.icon_position == :left ? 28 : 0
    text = $game_variables[item.id].to_s.rjust(item.lzeros, '0')   
    dir = item.text_direction
    draw_text(item.x+x_offset, item.y, variable_width, line_height, text, dir)
    reset_font_settings
    change_color(normal_color)
  end
  #--------------------------------------------------------------------------
  # * new method: draw_item_icon
  #--------------------------------------------------------------------------
  def draw_item_icon(item)
    case item.icon_position
      when :left
        icon_x = item.x
      when :right
        icon_x = item.x+variable_width
    end
    draw_icon(item.icon_index, icon_x, item.y)
    return icon_x
  end
  #--------------------------------------------------------------------------
  # * new method: sets the font options as specified on CDR_SV::FONT module
  #--------------------------------------------------------------------------
  def cdr_sv_font
    contents.font.name = CDR_SV::FONT::NAME
    contents.font.size = CDR_SV::FONT::SIZE
    contents.font.bold = CDR_SV::FONT::BOLD
    contents.font.italic = CDR_SV::FONT::ITALIC
    contents.font.shadow = CDR_SV::FONT::SHADOW
  end
  #--------------------------------------------------------------------------
  # * new method: resets the font settings as in default font
  #--------------------------------------------------------------------------
  def reset_font_settings
    contents.font.name = Font.default_name
    contents.font.size = Font.default_size
    contents.font.bold = Font.default_bold
    contents.font.italic = Font.default_italic
    contents.font.shadow = Font.default_shadow
  end
  #--------------------------------------------------------------------------
  # * new method: adds a new variable_window
  #--------------------------------------------------------------------------
  def sv_options(n,x,y,icon,color,dir,icon_pos, lzeros, visible = false)   
    if !@@items.has_key?(n)
      @@items[n] = SvOptions.new(n,x,y,icon,color,dir,icon_pos,lzeros,visible)
    else
      @@items[n].x = x     
      @@items[n].y = y
      @@items[n].icon_index = icon
      @@items[n].text_color = color
      @@items[n].text_direction = dir
      @@items[n].icon_position = icon_pos
      @@items[n].lzeros = lzeros
      @@items[n].visible = visible
    end
  end
  #--------------------------------------------------------------------------
  # * new method: adds a new variable_window
  #--------------------------------------------------------------------------
  def show_variable(n)
    return if !@@items.has_key?(n)
    @@items[n].show
  end
  #--------------------------------------------------------------------------
  # * new method: removes a specific variable_window
  #--------------------------------------------------------------------------
  def hide_variable(n)
    return if !@@items.has_key?(n)
    @@items[n].hide
  end
  #--------------------------------------------------------------------------
  # * new method: clears the variable options data
  #--------------------------------------------------------------------------
  def self.clear
    @@items = {}
  end
end
#==============================================================================
#  Scene_map
#==============================================================================
class Scene_Map < Scene_Base
  attr_accessor :variables_window
  alias cdr_sv_start start
  def start
    cdr_sv_start
    @variables_window = Window_Variables.new
  end
  #--------------------------------------------------------------------------
  # * alias: updates each variable_window
  #--------------------------------------------------------------------------
  alias cdr_sv_update update
  def update
    cdr_sv_update
    @variables_window.refresh
  end
end
[close]

Tudo funciona perfeitamente, ate quando eu adiciono um ponto em destreza atualiza td certinho e aumenta os valores. Aqui uma imagem do sistema padrão :
Spoiler
[close]

Atualizado, após aumentar um ponto em destreza :
Spoiler
[close]

Masss, nem tudo é perfeito, tem horas que os valores ficam extremamente quebrados, tipo assim :
Spoiler
[close]

Enfim, eu gostaria que mostrasse apenas 2 casas depois da virgula ou poderia ser apenas 1 casa após a virgula tanto faz, retirando esse monte de número ta otimo pra mim ... Mas como n manjo nd de scripts é impossível pra mim '-' Então, se alguém puder me ajudar com isso, eu agradeço desde já !!!

(OBS: Para aumentar os valores de crítico e esquiva em apenas 0,33%, estou usando outro script, esse aqui caso precise)


"Não se pode chegar à alvorada, a não ser pelo caminho da escuridão"

Troque a linha 203 por essa:
text = $game_variables[item.id].round(2).to_s.rjust(item.lzeros, '0')

Onde round(número) é quantas casas você quer mostrar depois da vírgula
Você adora as enormes árvores do XP? Você odeia as cores "datadas" delas? Que tal dar uma olhada no meu Remaster?

10/01/2022 às 17:25 #2 Última edição: 10/01/2022 às 17:42 por dragolipe2
Woww, salve Doiza !!!

Isso realmente me salvou, já estava surtando e fazendo todo um sistema novo por variáveis e imagens para corrigir os números quebrados kkkk ... Eai com uma unica linha, vc vem e resolve todos os meus problemas  :*-*:  Mt obg de vdd Doiza <3

O único "problema" que surgiu foi que todos as variáveis mostradas na tela, começaram a ter números decimais e por mais que fossem inteiros, ficava tipo 27,0. Então, por uma questão estética, eu queria que apenas as variáveis equivalentes a esquiva e crítico mostrassem os números decimais, então dei uma editada no script e criei o comando "around" na chamada de script, para indicar quantas casas serão mostradas após a vírgula, aqui esta o script editado para caso alguém tenha a msm duvida ou problema :
Spoiler
=begin
================================================================================
CDR - Show Variables 1.3
-------------------------------------------------------------------------------
Author: Ceodore
Mail: ceodore@email.com
https://ceodoremaker.wordpress.com
===============================Change log=======================================
  04/04/2013 - 1.3 release. Bug fixes and new stuff
  02/04/2013 - 1.2 release. Added font options.
  01/04/2013 - 1.1 release. Fixed a minor bug.
  01/04/2013 - 1.0 release.
===============================Description======================================
  This implementation is meant to provide a way display any number of variables
  on the map.
=================================License========================================
  You may freely use and modify this script as long as you do not change the
  original author information. If you use this on your game, include the author
  on the credits.
===================================Use==========================================
  Open a Script event command and follow the instructions:
  Before showing a variable you need to define it's options. To do it, type
  the command:
  sv_options(n,x,y,icon,color,dir,icon_pos,around,lzeros)
  Where n is the variable number and x and y are the value position on screen.
  The other are optional, but it's nice to define, you only need to do it once
  for each variable.
   
    icon -> The icon index
    color -> the color number
    dir -> the text direction, wich can be:
                :ltr (left to right)
                :rtl (Right)
                :mid (center)
    icon_pos -> The icon position, can be :left or :right
    around -> O número de casas que serão mostradas após a vírgula
    lzeros -> O número de zeros à esquerda
   
  show_variable(n)
  Shows a variable on screen as specified in sv_options()
  hide_variable(n)
  Hides the variable n if it's being displayed on screen.
================================================================================
=end
module CDR_SV
  # sub module containing default font options for the variable values
  module FONT
    NAME = ["Prototype"]
    SIZE = 17
    BOLD = false
    ITALIC = false
    SHADOW = false
  end
end
#==============================================================================
#  DataManager
#==============================================================================
SuperDataManager = DataManager.dup
module DataManager
    #--------------------------------------------------------------------------
    # * intercept: clears the variable settings list
    #--------------------------------------------------------------------------
    def self.create_game_objects
      Window_Variables.clear
      SuperDataManager.create_game_objects
    end
end
#==============================================================================
#  Game_Interpreter
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # * new method: displays a variable on map screen
  #--------------------------------------------------------------------------
  def sv_options(n,x,y,icon=nil,color=1,dir=:ltr,icon_pos=:left,around=0,lzeros=0)
    return unless SceneManager.scene.is_a?(Scene_Map)
    sv_window = SceneManager.scene.variables_window
    case dir
      when :ltr
        text_direction = 0
      when :mid
        text_direction = 1
      when :rtl
        text_direction = 2
     end
    sv_window.sv_options(n,x,y,icon,color,text_direction,icon_pos,around,lzeros)
  end
  #--------------------------------------------------------------------------
  # * new method: displays a variable on map screen
  #--------------------------------------------------------------------------
  def show_variable(n)
    return unless SceneManager.scene.is_a?(Scene_Map)
    sv_window = SceneManager.scene.variables_window
    sv_window.show_variable(n)
  end
  #--------------------------------------------------------------------------
  # * new method: hides a displayed variable
  #--------------------------------------------------------------------------
  def hide_variable(n)
    return unless SceneManager.scene.is_a?(Scene_Map)
    sv_window = SceneManager.scene.variables_window
    sv_window.hide_variable(n)
  end
end
#==============================================================================
#  SvOptions
#==============================================================================
class SvOptions
  attr_accessor :id
  attr_accessor :x
  attr_accessor :y
  attr_accessor :text_color
  attr_accessor :x
  attr_accessor :text_direction
  attr_accessor :icon_index
  attr_accessor :icon_position
  attr_accessor :around
  attr_accessor :lzeros
  attr_accessor :visible
  #--------------------------------------------------------------------------
  # * new method: initialize
  #--------------------------------------------------------------------------
  def initialize(id,x,y,icon,color,dir,icon_pos,around,lzeros,visible)   
    @id = id   
    @x = x
    @y = y
    @text_color = color
    @text_direction = dir
    @icon_index = icon
    @icon_position = icon_pos
    @around = around
    @lzeros = lzeros
    @visible = visible   
  end
  #--------------------------------------------------------------------------
  # * new method: displays the variable on map screen
  #--------------------------------------------------------------------------
  def show
    @visible = true
  end
  #--------------------------------------------------------------------------
  # * new method: hides the variable from map screen
  #--------------------------------------------------------------------------
  def hide
    @visible = false
  end
end
#==============================================================================
#  Window_Variables
#==============================================================================
class Window_Variables < Window_Base
  @@items = {}
  #--------------------------------------------------------------------------
  # * new method: initialize
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, window_height)   
    self.opacity = 0
    self.visible = true
    refresh
  end
  #--------------------------------------------------------------------------
  # * new method: window_width
  #--------------------------------------------------------------------------
  def window_width
    return Graphics.width
  end
  #--------------------------------------------------------------------------
  # * new method: window_height
  #--------------------------------------------------------------------------
  def window_height
    return Graphics.height
  end
  #--------------------------------------------------------------------------
  # * new method: variable_width
  #--------------------------------------------------------------------------
  def variable_width
    return 160
  end
  #--------------------------------------------------------------------------
  # * new method: refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear   
    @@items.each{|k,vw| draw_item(vw) if vw.visible}
  end
  #--------------------------------------------------------------------------
  # * new method: refresh
  #--------------------------------------------------------------------------
  def draw_item(item)
    icon_x = draw_item_icon(item) unless item.icon_index.nil?
    change_color(text_color(item.text_color))
    cdr_sv_font
    x_offset = item.icon_position == :left ? 28 : 0
    text = $game_variables[item.id].round(item.around).to_s.rjust(item.lzeros, '0')   
    dir = item.text_direction
    draw_text(item.x+x_offset, item.y, variable_width, line_height, text, dir)
    reset_font_settings
    change_color(normal_color)
  end
  #--------------------------------------------------------------------------
  # * new method: draw_item_icon
  #--------------------------------------------------------------------------
  def draw_item_icon(item)
    case item.icon_position
      when :left
        icon_x = item.x
      when :right
        icon_x = item.x+variable_width
    end
    draw_icon(item.icon_index, icon_x, item.y)
    return icon_x
  end
  #--------------------------------------------------------------------------
  # * new method: sets the font options as specified on CDR_SV::FONT module
  #--------------------------------------------------------------------------
  def cdr_sv_font
    contents.font.name = CDR_SV::FONT::NAME
    contents.font.size = CDR_SV::FONT::SIZE
    contents.font.bold = CDR_SV::FONT::BOLD
    contents.font.italic = CDR_SV::FONT::ITALIC
    contents.font.shadow = CDR_SV::FONT::SHADOW
  end
  #--------------------------------------------------------------------------
  # * new method: resets the font settings as in default font
  #--------------------------------------------------------------------------
  def reset_font_settings
    contents.font.name = Font.default_name
    contents.font.size = Font.default_size
    contents.font.bold = Font.default_bold
    contents.font.italic = Font.default_italic
    contents.font.shadow = Font.default_shadow
  end
  #--------------------------------------------------------------------------
  # * new method: adds a new variable_window
  #--------------------------------------------------------------------------
  def sv_options(n,x,y,icon,color,dir,icon_pos, around, lzeros, visible = false)   
    if !@@items.has_key?(n)
      @@items[n] = SvOptions.new(n,x,y,icon,color,dir,icon_pos,around,lzeros,visible)
    else
      @@items[n].x = x     
      @@items[n].y = y
      @@items[n].icon_index = icon
      @@items[n].text_color = color
      @@items[n].text_direction = dir
      @@items[n].icon_position = icon_pos
      @@items[n].around = around
      @@items[n].lzeros = lzeros
      @@items[n].visible = visible
    end
  end
  #--------------------------------------------------------------------------
  # * new method: adds a new variable_window
  #--------------------------------------------------------------------------
  def show_variable(n)
    return if !@@items.has_key?(n)
    @@items[n].show
  end
  #--------------------------------------------------------------------------
  # * new method: removes a specific variable_window
  #--------------------------------------------------------------------------
  def hide_variable(n)
    return if !@@items.has_key?(n)
    @@items[n].hide
  end
  #--------------------------------------------------------------------------
  # * new method: clears the variable options data
  #--------------------------------------------------------------------------
  def self.clear
    @@items = {}
  end
end
#==============================================================================
#  Scene_map
#==============================================================================
class Scene_Map < Scene_Base
  attr_accessor :variables_window
  alias cdr_sv_start start
  def start
    cdr_sv_start
    @variables_window = Window_Variables.new
  end
  #--------------------------------------------------------------------------
  # * alias: updates each variable_window
  #--------------------------------------------------------------------------
  alias cdr_sv_update update
  def update
    cdr_sv_update
    @variables_window.refresh
  end
end
[close]

Aproveitando o tópico e a duvida, vc sabe se seria possível editar o tamanho de cada variável mostrada na tela através da chamada de script, pois ele é "universal", vc escolhe um tamanho e ele serve para todas as variáveis que serão mostradas na tela ? Mas, apenas se for algo bem simples de ser modificado, pq desse jeito pra mim já esta ótimo e não quero dar mais trabalho ^^


"Não se pode chegar à alvorada, a não ser pelo caminho da escuridão"

Eu coloquei um check pra ele automaticamente meter o .round se o número for quebrado, então acabei tirando a sua variável, se quiser de volta pra especificar o round dá pra implementar do mesmo jeito que você fez
Pra ser sincera, eu usei ela porque não importava o jeito que eu escrevia o negócio ele dava erro, duas horas depois fui ver que era porque eu tava colocando :right ao invés de :rtl na configuração de posição :viiish:
Enfim, ai vai:
Spoiler
=begin
================================================================================
CDR - Show Variables 1.3
-------------------------------------------------------------------------------
Author: Ceodore
Mail: ceodore@email.com
https://ceodoremaker.wordpress.com
===============================Change log=======================================
  04/04/2013 - 1.3 release. Bug fixes and new stuff
  02/04/2013 - 1.2 release. Added font options.
  01/04/2013 - 1.1 release. Fixed a minor bug.
  01/04/2013 - 1.0 release.
===============================Description======================================
  This implementation is meant to provide a way display any number of variables
  on the map.
=================================License========================================
  You may freely use and modify this script as long as you do not change the
  original author information. If you use this on your game, include the author
  on the credits.
===================================Use==========================================
  Open a Script event command and follow the instructions:
  Before showing a variable you need to define it's options. To do it, type
  the command:
  sv_options(n,x,y,icon,color,dir,icon_pos,fontsize,lzeros)
  Where n is the variable number and x and y are the value position on screen.
  The other are optional, but it's nice to define, you only need to do it once
  for each variable.
   
    icon -> The icon index
    color -> the color number
    dir -> the text direction, wich can be:
                :ltr (left to right)
                :rtl (Right)
                :mid (center)
    icon_pos -> The icon position, can be :left or :right
    fontsize -> Tamanho da fonte
    lzeros -> O número de zeros à esquerda
   
  show_variable(n)
  Shows a variable on screen as specified in sv_options()
  hide_variable(n)
  Hides the variable n if it's being displayed on screen.
================================================================================
=end
module CDR_SV
  # sub module containing default font options for the variable values
  module FONT
    NAME = ["Prototype"]
    BOLD = false
    ITALIC = false
    SHADOW = false
  end
end
#==============================================================================
#  DataManager
#==============================================================================
SuperDataManager = DataManager.dup
module DataManager
    #--------------------------------------------------------------------------
    # * intercept: clears the variable settings list
    #--------------------------------------------------------------------------
    def self.create_game_objects
      Window_Variables.clear
      SuperDataManager.create_game_objects
    end
end
#==============================================================================
#  Game_Interpreter
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # * new method: displays a variable on map screen
  #--------------------------------------------------------------------------
  def sv_options(n,x,y,icon=nil,color=1,dir=:ltr,icon_pos=:left,fontsize=Font.default_size,lzeros=0)
    return unless SceneManager.scene.is_a?(Scene_Map)
    sv_window = SceneManager.scene.variables_window
    case dir
      when :ltr
        text_direction = 0
      when :mid
        text_direction = 1
      when :rtl
        text_direction = 2
     end
    sv_window.sv_options(n,x,y,icon,color,text_direction,icon_pos,fontsize,lzeros)
  end
  #--------------------------------------------------------------------------
  # * new method: displays a variable on map screen
  #--------------------------------------------------------------------------
  def show_variable(n)
    return unless SceneManager.scene.is_a?(Scene_Map)
    sv_window = SceneManager.scene.variables_window
    sv_window.show_variable(n)
  end
  #--------------------------------------------------------------------------
  # * new method: hides a displayed variable
  #--------------------------------------------------------------------------
  def hide_variable(n)
    return unless SceneManager.scene.is_a?(Scene_Map)
    sv_window = SceneManager.scene.variables_window
    sv_window.hide_variable(n)
  end
end
#==============================================================================
#  SvOptions
#==============================================================================
class SvOptions
  attr_accessor :id
  attr_accessor :x
  attr_accessor :y
  attr_accessor :text_color
  attr_accessor :x
  attr_accessor :text_direction
  attr_accessor :icon_index
  attr_accessor :icon_position
  attr_accessor :fontsize
  attr_accessor :lzeros
  attr_accessor :visible
  #--------------------------------------------------------------------------
  # * new method: initialize
  #--------------------------------------------------------------------------
  def initialize(id,x,y,icon,color,dir,icon_pos,fontsize,lzeros,visible)   
    @id = id   
    @x = x
    @y = y
    @text_color = color
    @text_direction = dir
    @icon_index = icon
    @icon_position = icon_pos
    @fontsize = fontsize
    @lzeros = lzeros
    @visible = visible   
  end
  #--------------------------------------------------------------------------
  # * new method: displays the variable on map screen
  #--------------------------------------------------------------------------
  def show
    @visible = true
  end
  #--------------------------------------------------------------------------
  # * new method: hides the variable from map screen
  #--------------------------------------------------------------------------
  def hide
    @visible = false
  end
end
#==============================================================================
#  Window_Variables
#==============================================================================
class Window_Variables < Window_Base
  @@items = {}
  #--------------------------------------------------------------------------
  # * new method: initialize
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, window_height)   
    self.opacity = 0
    self.visible = true
    refresh
  end
  #--------------------------------------------------------------------------
  # * new method: window_width
  #--------------------------------------------------------------------------
  def window_width
    return Graphics.width
  end
  #--------------------------------------------------------------------------
  # * new method: window_height
  #--------------------------------------------------------------------------
  def window_height
    return Graphics.height
  end
  #--------------------------------------------------------------------------
  # * new method: variable_width
  #--------------------------------------------------------------------------
  def variable_width
    return 160
  end
  #--------------------------------------------------------------------------
  # * new method: refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear   
    @@items.each{|k,vw| draw_item(vw) if vw.visible}
  end
  #--------------------------------------------------------------------------
  # * new method: refresh
  #--------------------------------------------------------------------------
  def draw_item(item)
    icon_x = draw_item_icon(item) unless item.icon_index.nil?
    change_color(text_color(item.text_color))
    contents.font.size = item.fontsize
    cdr_sv_font
    x_offset = item.icon_position == :left ? 28 : 0
    text = $game_variables[item.id]
    if text.is_a? Float
      text.round(2)
    end
    text = text.to_s.rjust(item.lzeros, '0')   
    dir = item.text_direction
    draw_text(item.x+x_offset, item.y, variable_width, line_height, text, dir)
    reset_font_settings
    change_color(normal_color)
  end
  #--------------------------------------------------------------------------
  # * new method: draw_item_icon
  #--------------------------------------------------------------------------
  def draw_item_icon(item)
    case item.icon_position
      when :left
        icon_x = item.x
      when :right
        icon_x = item.x+variable_width
    end
    draw_icon(item.icon_index, icon_x, item.y)
    return icon_x
  end
  #--------------------------------------------------------------------------
  # * new method: sets the font options as specified on CDR_SV::FONT module
  #--------------------------------------------------------------------------
  def cdr_sv_font
    contents.font.name = CDR_SV::FONT::NAME
    contents.font.bold = CDR_SV::FONT::BOLD
    contents.font.italic = CDR_SV::FONT::ITALIC
    contents.font.shadow = CDR_SV::FONT::SHADOW
  end
  #--------------------------------------------------------------------------
  # * new method: resets the font settings as in default font
  #--------------------------------------------------------------------------
  def reset_font_settings
    contents.font.name = Font.default_name
    contents.font.bold = Font.default_bold
    contents.font.italic = Font.default_italic
    contents.font.shadow = Font.default_shadow
  end
  #--------------------------------------------------------------------------
  # * new method: adds a new variable_window
  #--------------------------------------------------------------------------
  def sv_options(n,x,y,icon,color,dir,icon_pos, fontsize, lzeros, visible = false)   
    if !@@items.has_key?(n)
      @@items[n] = SvOptions.new(n,x,y,icon,color,dir,icon_pos,fontsize,lzeros,visible)
    else
      @@items[n].x = x     
      @@items[n].y = y
      @@items[n].icon_index = icon
      @@items[n].text_color = color
      @@items[n].text_direction = dir
      @@items[n].icon_position = icon_pos
      @@items[n].fontsize = fontsize
      @@items[n].lzeros = lzeros
      @@items[n].visible = visible
    end
  end
  #--------------------------------------------------------------------------
  # * new method: adds a new variable_window
  #--------------------------------------------------------------------------
  def show_variable(n)
    return if !@@items.has_key?(n)
    @@items[n].show
  end
  #--------------------------------------------------------------------------
  # * new method: removes a specific variable_window
  #--------------------------------------------------------------------------
  def hide_variable(n)
    return if !@@items.has_key?(n)
    @@items[n].hide
  end
  #--------------------------------------------------------------------------
  # * new method: clears the variable options data
  #--------------------------------------------------------------------------
  def self.clear
    @@items = {}
  end
end
#==============================================================================
#  Scene_map
#==============================================================================
class Scene_Map < Scene_Base
  attr_accessor :variables_window
  alias cdr_sv_start start
  def start
    cdr_sv_start
    @variables_window = Window_Variables.new
  end
  #--------------------------------------------------------------------------
  # * alias: updates each variable_window
  #--------------------------------------------------------------------------
  alias cdr_sv_update update
  def update
    cdr_sv_update
    @variables_window.refresh
  end
end
[close]
Você adora as enormes árvores do XP? Você odeia as cores "datadas" delas? Que tal dar uma olhada no meu Remaster?

Não se preocupe fiz o msm erro que tu no começo, tu ate que percebeu rápido kkkk ... Então, minha variável around pode ate ser útil, mas para a minha situação seu script com o check é exatamente oque eu quero, assim n preciso ficar especificando toda hora o "around" sendo que usaria os números quebrados em duas ou três variáveis, além de agr poder mudar também o tamanho da fonte ficou perfeito !

Porém, eu troquei os scripts e coloquei oq vc enviou, mas os números quebrados voltaram a aparecer '-' Será que fiz algo de errado ? Estou usando essa chamada de script :
sv_options(4,410,57,0,0,:ltr,:left, 18, 0)


De resto só tenho a agradecer pela ajuda :)




"Não se pode chegar à alvorada, a não ser pelo caminho da escuridão"

Hmn, acho que esqueci de definir a variavel com o round   :medo:
No lugar dessas linhas:
if text.is_a? Float
      text.round(2)
    end

Troca por essa:
text = text.round(2) if text.is_a? Float
Você adora as enormes árvores do XP? Você odeia as cores "datadas" delas? Que tal dar uma olhada no meu Remaster?

Uffa !!! Finalmente funcionou perfeitamente ^_^
Spoiler
[close]

Muito obrigado, Doiza !!! Com certeza já tem seu lugarzinho nos créditos do Alvorecer :ok:


"Não se pode chegar à alvorada, a não ser pelo caminho da escuridão"