Sujet n°9613
Posté par Winers le 15 Avr - 16:11 (2011)
Titre : Bug Window_Command.
Bonjour !
J'ai rencontré un bug récemment.
Quand j'appuie sur "Echap" pour afficher le menu.
Il me disent :

"Erreur dans le script Window_Command, inspectez le rapport Log.txt.
????? 'Window_Command' ? 55 ??? TypeError ????????
cannot convert Finux into String"

J'ai le script : (La ligne qui bug est : self.contents.draw_text(rect, @commands[index]))

Script
Code:
#==============================================================================
# ■ Window_Message
# Pokemon Script Pr[font=default]oj[/font]ect - Krosk
# 18/07/07
#-----------------------------------------------------------------------------
# Scène à ne pas modifier de préférence
#-----------------------------------------------------------------------------
# Modifications portant sur la gestion de la fenêtre commande
#   pour qu'elle supporte des colonnes, et des changements de taille
#   de police.
# Nécessaire au combat (fenêtre skill et menu)
#
# Introduit:
#   @height : hauteur (largeur) d'une ligne
#   @heightsize : hauteur du texte
#   @column_max
#-----------------------------------------------------------------------------

class Window_Command < Window_Selectable
  attr_reader :item_max
  attr_reader :commands
 
  def initialize(width, commands, size = $fontsize, column = 1, height = nil)
    # コマンドの個数からウィンドウの高さを算出
    # ADD
    if size == $fontsize
      @heightsize = 15
    elsif size == $fontsizebig
      @heightsize = 15
    else
      @heightsize = 15
    end
    if height != nil
      @height = height
    else
      @height = @heightsize
    end
    super(-30, 0, width, commands.size * @height + 32, @height)
    @item_max = commands.size   
    @commands = commands
    @column_max = column   
    self.contents = Bitmap.new(width, @item_max * @height)
    self.contents.font.name = $fontface
    self.contents.font.size = 15   
    refresh
    self.index = 0
  end
 
  def draw_item(index, color = platine)
    self.contents.font.color = color
    # Modification pour le tracé du texte
    rect = Rect.new(1 + (index % @column_max) * (width/@column_max),
    @height * (index/@column_max) + (@height-@heightsize)/2, 10 + self.contents.width/@column_max, @heightsize)     
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index])   
    if @commands[index] == "COUPE" or  @commands[index] == "VOL" or @commands[index] == "SURF" or @commands[index] == "FORCE" or @commands[index] == "FLASH" or @commands[index] == "ECLATE-ROC" or @commands[index] == "CASCADE" or @commands[index] == "PLONGEE"
      self.contents.font.color = Color.new(0,115,255,255)     
      if $game_variables[11] == 2
        self.contents.font.color = Color.new(239,33,16,255)       
      end
      self.contents.draw_text(rect, @commands[index])     
    end 
  end   
 
  def enable_item(index)
    # Nouvelle fonction
    draw_item(index, platine)
  end
end


PS : J'avais crée un script et maintenant ce bug apparais.

J'espère que vous pourrez m'aider !
S'il vous plait !
Au revoir et à bientôt !

Posté par Nuri Yuri le 16 Avr - 11:19 (2011)
Met @commands[index].to_s à la place de @commands[index].

Posté par Winers le 16 Avr - 14:30 (2011)
Ca ma aidé un moment, maintenant je n'ai plus accès au Sac et Option.
Merci Yuri Imbécile heureux