¡Bienvenid@ a Mundo Maker!

¿Quieres aprender todo sobre el RPG Maker?



Regístrate y forma parte de Mundo Maker.
Conectarse

Recuperar mi contraseña

Temas importantes
----------------------------------------
Páginas con recursos RPG Maker
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
----------------------------------------
Afiliados
Estadísticas
Tenemos 3399 miembros registrados.
El último usuario registrado es agapitovillaporca_803.

Nuestros miembros han publicado un total de 79814 mensajes en 11259 argumentos.
Navega con Google Chrome
[DESCARGA]

Como mostrar una variable en una string

 :: RPG Maker :: Ayuda RPG

Ver el tema anterior Ver el tema siguiente Ir abajo

Como mostrar una variable en una string

Mensaje por luistop12 el 2016-05-18, 14:51

Quisiera mostrar una variable en vez de texto pero ya agoté lo que conosco xD

este es el código
Código:

    BWH[1] = "Como colocar el valor de un variable aquí"
   
    BWH[2] = $game_variables[135]
   
    BWH[3] = "\v[143]"
   

luistop12
Veterano
Veterano

0/3

Créditos 771

Gracias : 30

Volver arriba Ir abajo

Re: Como mostrar una variable en una string

Mensaje por silvanash el 2016-05-18, 15:44

text = "la variable vale #{$game_variables[x]}"

El #{} convierte en un string lo que haya entre corchetes. Funciona incluso si metes una llamada a un método en los corchetes, o una operación matemática.

"#{3 + 4}" -> "7".

No te olvides de poner comillas.

Edito:

Si es para mostrar una variable, podrías usar

text = " La variable vale " + $game_variables[x].to_s

.to_s convierte cosas en strings, y el + sirve para concatenar (unir) strings.

silvanash
Aventurero
Aventurero

0/3

Créditos 1417

Gracias : 176

Volver arriba Ir abajo

Re: Como mostrar una variable en una string

Mensaje por luistop12 el 2016-05-18, 18:02

Todos me dieron error D:

es un script de estado y es vx D: quizá eso reduce opciones.


luistop12
Veterano
Veterano

0/3

Créditos 771

Gracias : 30

Volver arriba Ir abajo

Re: Como mostrar una variable en una string

Mensaje por silvanash el 2016-05-18, 18:19

No tengo el VX a mano, pero para ir descartando cosas:

- ¿Qué mensaje de error te sale? NoMethod, syntax o algo diferente.

- ¿Estás usando el código en una class o en un module?

Y para testear, haz un evento de mapa con un comando de llamar script. En el comando pon "p $game_variables[135].to_s", sin las comillas. Inicia el juego y ejecuta el evento. Dime si te sale error y cuál es el mensaje de error.

silvanash
Aventurero
Aventurero

0/3

Créditos 1417

Gracias : 176

Volver arriba Ir abajo

Re: Como mostrar una variable en una string

Mensaje por luistop12 el 2016-05-18, 21:41

me dice no method y el script call tira una ventana que dice "0".

es que el script no es mio xD. solo quería mostrar una variable en vez de un texto.

luistop12
Veterano
Veterano

0/3

Créditos 771

Gracias : 30

Volver arriba Ir abajo

Re: Como mostrar una variable en una string

Mensaje por silvanash el 2016-05-18, 21:56

¿NoMethod qué más? Debería decirte algo sobre qué método en cuál clase falla. Y sería mejor que nos dijeras qué script estás editando.

El script call dice que el .to_s funciona correctamente, asi que el error viene por el script que estás usando, no por cosas del VX en sí.

silvanash
Aventurero
Aventurero

0/3

Créditos 1417

Gracias : 176

Volver arriba Ir abajo

Re: Como mostrar una variable en una string

Mensaje por newold el 2016-05-18, 22:23

El error te debería dar la línea del script donde ha fallado, o abriendo el editor de scripts tras el error el primer script que se muestra debería ser el que tuvo el error y estará desplazado hasta donde fue el error. El no method ese te está diciendo que algo que llama el script (algún método o variable) no está definido (normalmente en el error te dice la línea donde falló el script y el nombre de la variable o método que no existe o existía cuando el script trató de usarlo)

newold
Principiante
Principiante

0/3

Créditos 1060

Gracias : 59

Volver arriba Ir abajo

Re: Como mostrar una variable en una string

Mensaje por luistop12 el 2016-05-20, 02:18

Código:
=begin
================================================================================
                      Tales of-style Status Screen v1.0
                              by wltr3565
================================================================================
There's a lot of Scene_Status screen were made, but nothing that's used for
more personalization for each character. They only show name, elemental
resistances, and important things for battle. But none that used for characters'
full personal information. More than that, it was made by each reknown
scripters.
This one I made so the players can have fun for reading the characters'
personal information, despite from battle-related ones. And it's adjustable
for adapting with the story!
================================================================================
Features:
- Flip-based profile info-changing. Just press up and down!
- Shows elemental resistances with colors and texts.
- Shows the character's portrait like the new Tales of games' does!
- Changeable biodatas. So you can adapt it according to the story!
- By text-informations. Feel free to censor something :D
================================================================================
How to use:
Just adjust the script at the below. It adjusts characters' information and
icons for elemental-related information.
For altering the characters' information in the middle of the game, write this
in the script command:
$game_actors[who's id].[data] = [information]

who's id represents the actor's id, and data is to define what data to change.
the information is the information to add instead of the old one. The data
includes:
full_name
age
weight
height
bwh
biography
portrait

How to write the information is as the same as to write the starting one, like
below.

Example:
$game_actors[2].weight = "5? kg"
Let's say that Ulrika had her weight increased, but she doesn't want the
others to know about it. So, as you write above, the weight will show 5? kg.
================================================================================
Install:
Put it above main and below Scene_Status related scripts. Then adjust the things
below.
================================================================================
Terms of Use:
Credit me and your character designer is enough. Crediting who I thanked
especialy Yanfly is a great idea.
================================================================================
Thanks:
- Yanfly for the draw_actor_bio and elements method.
  Sorry if I ripped it without permission!
- Crimson Seas for the mdf. Hey, you lied to me before!
- Tales of games and Mana Khemia 2 (Censored weight)
================================================================================
=end
#===============================================================================
#  COMMENCING COMPATIBILITY FLAG
#===============================================================================
$imported = {} if $imported == nil
$imported["wltr3565's_Status_Screen"] = true
#===============================================================================
#  END COMPATIBILITY FLAG
#===============================================================================
module WLTR
  module BIODATA
#===============================================================================
# Enter the sound file for flipping between information.
#===============================================================================
    FLIP_SOUND = "Book"
   
#===============================================================================
# Do you want to show the character's class?
#  True  : Show it.
#  False : Don't show it.
#===============================================================================
    DRAW_CLASS = false
   
#===============================================================================
# Do you want to show the character's face in the status screen?
#  True  : Show it.
#  False : Show it.
#===============================================================================
    SHOW_FACE = false
   
#===============================================================================
# This will adjust the icons used for showing the corresponding element.
#  9 => 1
# Means Fire element will be indicated with an icon with index number 1.
#===============================================================================
    ELEMENT_ICONS  = {
      1 => 4684,  # Fire element.
      2 => 4753,  # Ice element.
      3 => 4791,  # Volt element.
      4 => 4754,  # Earth element.
      5 => 4702,  # Water element.
      7 => 4803,  # Light element.
      8 => 4767,  # Dark element.
      9 => 4758,  # Air element.
    10 => 4765,  # Light element.
    11 => 4764,  # Dark element.
    12 => 4759,  # Light element.
    13 => 4761,  # Dark element.
    14 => 4760,  # Light element.
    15 => 4762,  # Dark element.
    16 => 4766,  # Light element.
      }
     
#===============================================================================
# This will adjust the weakness term, since the resistance is showed by using
# text.
#===============================================================================
    DEFENSES_TERM = {
    1 => "Vulnerable",  # Weakness rank A (Fatal, 2 normal damage)
    2 => "Débil",  # Weakness rank B (Weak, 1.5 normal damage)
    3 => "Normal", # Weakness rank C (Normal)
    4 => "Resistente", # Weakness rank D (Resist, 0.5 normal damage)
    5 => "Inmune", # Weakness rank E (Immune, no damage taken)
    6 => "Absorbe", # Weakness rank F (Absorb, heals intead of taking damage)
      }
   
#===============================================================================
# This will adjust colors to use for indicating the resistance.
#===============================================================================
    RESISTANCE_COLOR = {
        1 => 2,  # Weakness rank A, with red color.
        2 => 21,  # Weakness rank B, with orange color.
        3 => 6,  # Weakness rank C, with yellow color.
        4 => 24,  # Weakness rank D, with green color.
        5 => 4,  # Weakness rank E, with light blue color.
        6 => 5,  # Weakness rank F, with purple color.
      }
 
#===============================================================================
# This will set the list of elements to be shown. The limit is 8 elements to fit
# the screen.
#===============================================================================
    ELEMENTS_SHOWN = [9, 10, 11, 12, 13, 14, 15, 16]
   
#===============================================================================
# This will set the term for showing the attack elements.
#===============================================================================
    ATTACK_ELEMENTS_TERM = "Ataque Elemental"
   
#===============================================================================
# This will set the term for showing the element resistances.
#===============================================================================
    ELEMENTS_RESISTANCE_TERM = "Resistencia Elemental"
   
#-------------------------------------------------------------------------------

    FULL_NAME = [] # Touching is probihited
   
#===============================================================================
# These will adjust the actors' starting full names. To fill it, write this:
#    FULL_NAME[n] = [name]
# n indicates the actor's id. [name] is the full name for that actor. Use %s for
# showing their current name if the game has a feature to change names.
# The data type must be a string.
#===============================================================================
    FULL_NAME[1] = "%s"
   
    FULL_NAME[2] = "%s"
   
    FULL_NAME[3] = "%s"
   
    FULL_NAME[4] = "%s"
   
    FULL_NAME[7] = "%s"
   
    FULL_NAME[8] = "%s"
   
    FULL_NAME[9] = "%s"
   
    FULL_NAME[10] = "%s"
   
    FULL_NAME[11] = "%s"
   
    FULL_NAME[12] = "%s"
   
    FULL_NAME[13] = "%s"
   
#-------------------------------------------------------------------------------

#===============================================================================
# Enter the term for the age.
#===============================================================================
    AGE_TERM = "Edad"

    AGE = [] # Touching is probihited
   
#===============================================================================
# These will adjust the actors' starting ages. To fill it, write this:
#    AGE[n] = [text]
# n indicates the actor's id. [text] is the information to show. The data type
# must be a string.
#===============================================================================
    AGE[1] = "17 Años"
   
    AGE[2] = "19 Años"
   
    AGE[3] = "20 Años"
   
    AGE[4] = "20 Años"
   
    AGE[7] = "102 Años"
   
    AGE[8] = "19 Años"

    AGE[9] = "23 Años"
   
    AGE[10] = "187 Años"
   
    AGE[11] = "18 Años"
   
    AGE[12] = "21 Años"
   
    AGE[13] = "39 Años"
   
#-------------------------------------------------------------------------------

#===============================================================================
# Enter the term for the weight.
#===============================================================================
    WEIGHT_TERM = "Arma"

    WEIGHT = [] # Touching is probihited.
   
#===============================================================================
# These will adjust the actors' starting weights. To fill it, write this:
#    WEIGHT[n] = [text]
# n indicates the actor's id. [text] is the information to show. The data type
# must be a string.
#===============================================================================
    WEIGHT[1] = "Espadas"
   
    WEIGHT[2] = "Bastones"
   
    WEIGHT[3] = "Ninguna"
   
    WEIGHT[4] = "Ninguna"
   
    WEIGHT[7] = "Garras Etéreas"
   
    WEIGHT[8] = "Shamisen (Laúd)"
   
    WEIGHT[9] = "Lanzas"
       
    WEIGHT[10] = "Guadañas y Hoces"
       
    WEIGHT[11] = "Arco"
       
    WEIGHT[12] = "Resortera"
       
    WEIGHT[13] = "Escudos"
   
#-------------------------------------------------------------------------------

#===============================================================================
# Enter the term for the height.
#===============================================================================
    HEIGHT_TERM = "Estilo"
   
    HEIGHT = [] # Touching is probihited.
   
#===============================================================================
# These will adjust the actors' starting heights. To fill it, write this:
#    HEIGHT[n] = [text]
# n indicates the actor's id. [text] is the information to show. The data type
# must be a string.
#===============================================================================
    HEIGHT[1] = "Esgrima"
   
    HEIGHT[2] = "Sanadora"
   
    HEIGHT[3] = "Domadora"
   
    HEIGHT[4] = "Domadora"
   
    HEIGHT[7] = "Ilusionista"
   
    HEIGHT[8] = "Bardo"
   
    HEIGHT[9] = "Tecnomago"
   
    HEIGHT[10] = "Sepulturero"
   
    HEIGHT[11] = "Kyūjutsu"
   
    HEIGHT[12] = "Pacifista (Trucos)"
   
    HEIGHT[13] = "Escudero"
   
#-------------------------------------------------------------------------------

#===============================================================================
# Enter the term for the bwh.
#===============================================================================
    BWH_TERM = "Crisalida"
   
    BWH = [] # Touching is probihited.
   
#===============================================================================
# These will adjust the actress' starting bwh. To fill it, write this:
#    BWH[n] = [text]
# n indicates the actress's id. [text] is the information to show. The data type
# must be a string. I highly suggest to not fill for the males!
#===============================================================================
   
    BWH[1] = ""
   
    BWH[2] = ""
   
    BWH[3] = ""
   
    BWH[4] = ""
   
    BWH[7] = ""
   
    BWH[8] = ""
   
    BWH[9] = ""
       
    BWH[10] = ""
   
    BWH[11] = ""
   
    BWH[12] = ""
   
    BWH[13] = ""
   
#-------------------------------------------------------------------------------

    # Straight from Yanfly's
    # When typing out biographies and descriptions, use \\N[x] to write out
    # the actor's name if the game allows renaming. For line splits, use |
    # at the each position you would want the description to start a new line.
    BIOGRAPHY ={ # If an actor ID is not listed here, then refer to class bio.
    # ID => Bio
      1 => '\\N[1] es un caballero santo de Lumir, que|' +
            'fué ascendido rapidamente debido a su diestra|' +
            'Habilidad con la espada. y su crisalida curativa. |' +
            '',
      2 => '\\N[2] es una chica humana con poco conocimiento |' +
            'de este mundo, posee un corazón muy gentíl. pero |' +
            'eso también la hace débil en cuestiones de decisión.|' +
            '',
      3 => '\\N[3] es una chica humana con un valiente y|' +
            'temerario caracter. es una auto considerada nazi|' +
            'de la ortografía y de la coherencia textual.|' +
            '',
      4 => '\\N[3] es una chica humana con un valiente y|' +
            'temerario caracter. es una auto considerada nazi|' +
            'de la ortografía y de la coherencia textual.|' +
            '',
      7 => '\\N[7] es un Hombre Gato, posee las bondades|' +
            'de ambas razas y una gran madurez en varias cuestiones.|' +
            'es ruinomaniaco nivel S.|' +
            '',
      8 => '\\N[8] es un simpatico muchacho. es bastante bromista|' +
            'y puede romper el hielo de las más difíciles situaciones.|' +
            'con sus palabras o su shamisen.|' +
            '',
      9 => '\\N[9] es un Esgrimago y en actualidad técnomago, mezcla|' +
            'sus habilidades rompiendo clichés de que el mago es débil.|' +
            'detesta las calabazas, y adora las plantas, oculta un misterio.|' +
            '',
      10 => '\\N[10] es un hombre Gato bastante mayor que posee Sabiduría|' +
            'en sus palabras. es considerado bastante sobrio en todas sus|' +
            'elecciones, es tan rápido con su guadaña que asombra a muchos|' +
            '',
      11 => '\\N[11] es un admirador del humor humano. algo excéntrico pero|' +
            'en muchos de sus modismos se parece a \\N[8] lo cual da mucho a|' +
            'pensar, su estilo de lucha es originalmente del mundo humano.|' +
            '',
      12 => '\\N[12] es un pacifista declarado. busca bondad en cada persona|' +
            'lo que no lo deja muy imparcial y como ingenuo. su arte de trucos|' +
            'es bantante diverso y útil como soporte pero no mucho como ataque.|' +
            '',
      13 => '\\N[12] es un Humano no elegido que viajó por accidente.|' +
            'envejeció y armó su familia en lumir. por eso es considerado|' +
            'Lumiriano Su poder de escudero es Auto soporte y Fuerza bestial.|' +
            '',
    } # Do not remove this.
   
#===============================================================================
# The font size for the biography.
#===============================================================================
  FONT_SIZE = 12
 
#-------------------------------------------------------------------------------

  PORTRAIT = [] # Touching is probihited.
 
#===============================================================================
# This will adjust the portrait's horizontal position. The bigger the number,
# the more it goes to the right.
#===============================================================================
  PORTRAIT_X = 0 - 0 #544 - 242
 
#===============================================================================
# This will adjust the portrait's vertical position. The bigger the number,
# the more it goes to the bottom.
#===============================================================================
  PORTRAIT_Y = 0 - 0 #416 - 270
 
#===============================================================================
# These will adjust the actors' starting portraits. To fill it, write this:
#    PORTRAIT[n] = [text]
# n indicates the actor's id. [text] is the information to show. The data type
# must be a string. To note, the file is picked from Graphics/Pictures folder.
#===============================================================================
  PORTRAIT[1] = "Maki - Estado"
 
  PORTRAIT[2] = "Yue - Estado"
 
  PORTRAIT[3] = "Sof - Estado"
 
  PORTRAIT[4] = "Sof - Estado"
 
  PORTRAIT[7] = "Muz - Estado"
 
  PORTRAIT[8] = "Serch - Estado"
 
  PORTRAIT[9] = "Jkl - Estado"
 
  PORTRAIT[10] = "Zororo - Estado"
 
  PORTRAIT[11] = "Japo - Estado"
 
  PORTRAIT[12] = "Alojzy - Estado"
 
  PORTRAIT[13] = "Kriz - Estado"
 
  end
end

#===============================================================================
# Below is very dangerous to read. Edit at your own risk and I'm not responsible
# about anything that will happen to you after you read and/or edit below.
#===============================================================================

class Game_Actor < Game_Battler
  attr_accessor :full_name
  attr_accessor :age
  attr_accessor :weight
  attr_accessor :height
  attr_accessor :bwh
  attr_accessor :biography
  attr_accessor :portrait
 
  alias biodata_setup setup
  def setup(actor_id)
    biodata_setup(actor_id)
   
    @full_name = WLTR::BIODATA::FULL_NAME[actor_id]
    @age = WLTR::BIODATA::AGE[actor_id]
    @weight = WLTR::BIODATA::WEIGHT[actor_id]
    @height = WLTR::BIODATA::HEIGHT[actor_id]
    @bwh = WLTR::BIODATA::BWH[actor_id]
    @biography = WLTR::BIODATA::BIOGRAPHY[actor_id]
    @portrait = WLTR::BIODATA::PORTRAIT[actor_id]
  end
end

class Window_Status < Window_Base
  def initialize(actor)
    super(0, 0, 544, 416)
    @actor = actor
    self.z = 100
    self.back_opacity = 0
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.dispose if self.contents != nil
    self.contents = Bitmap.new(self.width - 32, 416 * 3 - 32)
    @actor_portrait = Sprite.new(Viewport.new(0, 0, 544, 416))
    @actor_portrait.bitmap = Cache.picture(@actor.portrait)
    @actor_portrait.z = -100
    @actor_portrait.x = WLTR::BIODATA::PORTRAIT_X
    @actor_portrait.y = WLTR::BIODATA::PORTRAIT_Y
    draw_actor_name(@actor, 4, 0)
    draw_actor_class(@actor, 128, 0) if WLTR::BIODATA::DRAW_CLASS
    draw_actor_face(@actor, 128, 32) if WLTR::BIODATA::SHOW_FACE
    draw_basic_info(4, 32)
    draw_parameters(4, 120)
    draw_exp_info(4, 240)
    draw_equipments(4, 416)
    draw_elements(4, 416 + 120)
    draw_biodata(4, 416 * 2)
  end
  #--------------------------------------------------------------------------
  # * Draw Basic Information
  #    x : Draw spot X coordinate
  #    y : Draw spot Y coordinate
  #--------------------------------------------------------------------------
  def draw_basic_info(x, y)
    draw_actor_level(@actor, x, y + WLH * 0)
    draw_actor_state(@actor, x, y + WLH * 1)
    draw_actor_hp(@actor, x, y + WLH * 1)
    draw_actor_mp(@actor, x, y + WLH * 2)
  end
  #--------------------------------------------------------------------------
  # * Draw Parameters
  #    x : Draw spot X coordinate
  #    y : Draw spot Y coordinate
  #--------------------------------------------------------------------------
  def draw_parameters(x, y)
    draw_actor_parameter(@actor, x, y + WLH * 0, 0)
    draw_actor_parameter(@actor, x, y + WLH * 1, 1)
    draw_actor_parameter(@actor, x, y + WLH * 2, 2)
    if defined?(CSU) != nil
      draw_actor_parameter(@actor, x, y + WLH * 4, 3) if CSU::SCRIPTLIST.include?("Ultimate Battler Stat")
    else
      draw_actor_parameter(@actor, x, y + WLH * 3, 3)
    end
    self.contents.font.color = system_color
    if defined?(CSU)
      self.contents.draw_text(x, y + WLH * 3, 120, WLH, Vocab::mdf) if CSU::SCRIPTLIST.include?("Ultimate Battler Stat")
    end
    self.contents.font.color = normal_color
    if defined?(CSU)
      self.contents.draw_text(x + 120, y + WLH * 3, 36, WLH, @actor.mdf, 2) if CSU::SCRIPTLIST.include?("Ultimate Battler Stat") and defined?(CSU)
    end
  end
 
  def draw_elements(x, y)
    # Element Attacks
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 120, WLH, WLTR::BIODATA::ATTACK_ELEMENTS_TERM)
    self.contents.font.color = normal_color
    index = 0 if index == nil
    for i in @actor.element_set
      next unless WLTR::BIODATA::ELEMENTS_SHOWN.include?(i)
      self.draw_icon(WLTR::BIODATA::ELEMENT_ICONS[i], x + (24 * index), y + WLH)
      index += 1
    end
    # Element Resistances. Took from Yanfly's
    self.contents.font.color = system_color
    self.contents.draw_text(x, y + 48, 160, WLH, WLTR::BIODATA::ELEMENTS_RESISTANCE_TERM)
    self.contents.font.color = normal_color
    dx = 48; dy = 0
    for ele_id in WLTR::BIODATA::ELEMENTS_SHOWN
      next if ele_id > $data_system.elements.size
      self.draw_icon(WLTR::BIODATA::ELEMENT_ICONS[ele_id], x, y + 72 + dy)
      self.contents.font.color = resistance_color(ele_id)
      self.contents.font.size = Font.default_size
      self.contents.draw_text(x + dx, y + 72 + dy, 60, WLH, element_rate(ele_id))
      dy += WLH
    end
  end

  def draw_biodata(x, y)
    self.contents.font.color = normal_color
    name = sprintf(@actor.full_name, @actor.name)
    name = @actor.name if name == nil
    self.contents.draw_text(x, y, 544, WLH, name)
    y = y + (WLH * 2)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y + WLH, 160, WLH, WLTR::BIODATA::AGE_TERM) unless @actor.age == nil
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 48, y + WLH, 160, WLH, @actor.age, 2) unless @actor.age == nil
    self.contents.font.color = system_color
    self.contents.draw_text(x, y + (WLH * 2), 160, WLH, WLTR::BIODATA::WEIGHT_TERM) unless @actor.weight == nil
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 48, y + (WLH * 2), 160, WLH, @actor.weight, 2) unless @actor.weight == nil
    self.contents.font.color = system_color
    self.contents.draw_text(x, y + (WLH * 3), 160, WLH, WLTR::BIODATA::HEIGHT_TERM) unless @actor.height == nil
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 48, y + (WLH * 3), 160, WLH, @actor.height, 2) unless @actor.height == nil
    self.contents.font.color = system_color
    bwh = @actor.bwh
    self.contents.draw_text(x, y + (WLH * 4), 160, WLH, WLTR::BIODATA::BWH_TERM) if bwh != nil
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 48, y + (WLH * 4), 160, WLH, bwh, 2) if bwh != nil
    draw_actor_bio(x, y + WLH * 6)
  end
 
  # Took from Yanfly's
  def draw_actor_bio(x, y)
    @bio_sprite = Sprite.new
    @bio_sprite.bitmap = Bitmap.new(544, 416)
    @bio_sprite.bitmap.font.color = normal_color; dy = 0
    @bio_sprite.x = x + 8
    @bio_sprite.y = y + WLH * 2
    text = @actor.biography
    return if text == nil
    txsize = WLTR::BIODATA::FONT_SIZE + 4
    nwidth = 500
    dx = 0; dy = 0
   
    text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
    lines = text.split(/(?:[|]|\\n)/i)
    lines.each_with_index { |l, i|
      l.gsub!(/\\__(\[\d+\])/i) { "\\N#{$1}" }
      @bio_sprite.bitmap.draw_text(dx, i * txsize + dy, nwidth, WLH, l, 0)}
    @bio_sprite.z = 0
  end
   
  def resistance_color(ele_id)
    rate = @actor.element_rate(ele_id)
    if rate >= 200
      text = WLTR::BIODATA::RESISTANCE_COLOR[1]
    elsif rate >= 150
      text = WLTR::BIODATA::RESISTANCE_COLOR[2]
    elsif rate >= 100
      text = WLTR::BIODATA::RESISTANCE_COLOR[3]
    elsif rate >= 1
      text = WLTR::BIODATA::RESISTANCE_COLOR[4]
    elsif rate == 0
      text = WLTR::BIODATA::RESISTANCE_COLOR[5]
    elsif rate <= 0
      text = WLTR::BIODATA::RESISTANCE_COLOR[6]
    end
    color = text_color(text)
    return color
  end 
   
  # Took from Yanfly's
  def element_rate(ele_id)
    rate = @actor.element_rate(ele_id)
    if rate >= 200
      text = WLTR::BIODATA::DEFENSES_TERM[1]
    elsif rate >= 150
      text = WLTR::BIODATA::DEFENSES_TERM[2]
    elsif rate >= 100
      text = WLTR::BIODATA::DEFENSES_TERM[3]
    elsif rate >= 1
      text = WLTR::BIODATA::DEFENSES_TERM[4]
    elsif rate == 0
      text = WLTR::BIODATA::DEFENSES_TERM[5]
    elsif rate <= 0
      text = WLTR::BIODATA::DEFENSES_TERM[6]
    end
    return text
  end
 
  def dispose
    super
    @bio_sprite.dispose
    @actor_portrait.dispose
  end
 
  def update
    super
    if Input.trigger?(Input::UP)
      sound = RPG::SE.new(WLTR::BIODATA::FLIP_SOUND)
      sound.play
      @bio_sprite.y += 416 if self.oy > 0
      self.oy -= 416 if self.oy > 0
    elsif Input.trigger?(Input::DOWN)
      sound = RPG::SE.new(WLTR::BIODATA::FLIP_SOUND)
      sound.play
      @bio_sprite.y -= 416 if self.oy < 416 * 2
      self.oy += 416 if self.oy < 416 * 2
    end
  end
end

#===============================================================================
#
# END OF SCRIPT
#
#===============================================================================

ese es el script D:

luistop12
Veterano
Veterano

0/3

Créditos 771

Gracias : 30

Volver arriba Ir abajo

Re: Como mostrar una variable en una string

Mensaje por newold el 2016-05-20, 09:21

ese script en las líneas 419 a 439 configura unas imágenes que deben estar en la carpeta Graphics/Pictures de tu juego, ¿Tienes las imágenes indicadas ahí en esa carpeta?

Se supone que ahí pones el nombre de las imágenes de los retratos de los personajes que uses

newold
Principiante
Principiante

0/3

Créditos 1060

Gracias : 59

Volver arriba Ir abajo

Re: Como mostrar una variable en una string

Mensaje por luistop12 el 2016-05-20, 17:03

si, lo que quiero y no e podido hacer es donde dice nivel de relación social, poner el valor de una variable en vez de un texto.

luistop12
Veterano
Veterano

0/3

Créditos 771

Gracias : 30

Volver arriba Ir abajo

Re: Como mostrar una variable en una string

Mensaje por Contenido patrocinado Hoy a las 00:15


Contenido patrocinado


Volver arriba Ir abajo

Ver el tema anterior Ver el tema siguiente Volver arriba


 :: RPG Maker :: Ayuda RPG

Permisos de este foro:
No puedes responder a temas en este foro.