Age : 30 Inscrit le : 22/12/2011 Messages : 1600
| Sujet: Problème de lettre sur ce script. Mer 14 Mar 2012 - 16:20 | |
| Bonjours. Alors voilà, j'ai pris le script que voici: - Code:
-
============================================================================== # Informational Long Text Scene # by jfjohnny5 # 11/21/2010 #============================================================================== # Creates a new scene for displaying long text fields to be used as tutorials, # background story, or other informational material. # # The key to the "Long Text Window" is that the text content is loaded from # external text files and can be of almost any length, as the script # dynamically creates as many pages as are needed to display the content. # # Edit the COMMANDS list below to include the name for the given entry as well # as the relative path to the .txt file containing the long text. # # You must include the following image file for the "more text" indicator: # # <project folder>\Graphics\Pictures\more_text.png # #------------------------------------------------------------------------------ # use the following script call to create the scene: # # $scene = Scene_Tutorial.new # #============================================================================== $imported = {} if $imported == nil $imported["TutorialScene"] = true
#============================================================================== # CONFIGURATION #==============================================================================
module TUT # Customize menu options and associated text files here. Be sure that any # additional selections follow the numbering convention (0,1,2,3,4,5,etc). # Text file path is relative to the main directory for the RPGM project. # The default configuration points to files in a "Text" subdirectory. COMMANDS = { #ID => [Command Name, Text File] 0 => ["Combat", "Text/combat.txt"], 1 => ["Grade", "Text/skills.txt"], 2 => ["Cuisine", "Text/rows.txt"], 3 => ["Soutient", "Text/saving.txt"], 4 => ["Affects", "Text/Affects.txt"], 5 => ["Quête", "Text/Quête.txt"], 6 => ["Eglise", "Text/Eglise.txt"], }#Do Not Remove # The default text file to be loaded. This is also the text seen upon first # opening the window. DEFAULT = "Text/default.txt" RETURN_MENU = true # Return to menu after exiting? false = return to map MENU_INDEX = 7 # Menu slot to return to (only if above is true) end #============================================================================== #----------------------------END CONFIGURATION--------------------------------- #==============================================================================
#============================================================================== # Long Text Window #==============================================================================
class Window_LongText < Window_Base attr_reader :more_text #---------------------------------------------------------------------------- # Initialize #---------------------------------------------------------------------------- def initialize super(0, 0, Graphics.width*0.7, Graphics.height) @max_lines = (height-32)/WLH @more_text = false load_long_text end #---------------------------------------------------------------------------- # Refresh #---------------------------------------------------------------------------- def refresh self.contents.clear draw_long_text end #---------------------------------------------------------------------------- # Update #---------------------------------------------------------------------------- def update super update_icon end #---------------------------------------------------------------------------- # Load Long Text #---------------------------------------------------------------------------- def load_long_text(textFile=TUT::DEFAULT) file = File.open(textFile) text = "" @textArray = [] while line = file.gets text << line end text.gsub!("\n"," <%LINE_BREAK%> ") @textArray = text.split(" ") draw_long_text end #---------------------------------------------------------------------------- # Draw Long Text #---------------------------------------------------------------------------- def draw_long_text self.contents.clear y_off = 0 drawArray = [] tempArray = [] lines_count = 0 while !@textArray.empty? and lines_count < @max_lines-1 loop do if @textArray.first == "<%LINE_BREAK%>" @textArray.shift break end tempArray.clear tempArray.replace(drawArray) tempArray << @textArray.first drawRect = self.contents.text_size(tempArray.join(" ")) if drawRect.width < self.width-32 drawArray << @textArray.shift else break end end self.contents.draw_text(x, y+y_off, width, WLH, drawArray.join(" ")) drawArray.clear y_off += WLH lines_count += 1 end if !@textArray.empty? and lines_count == @max_lines-1 @more_text = true more_text_icon unless @icon_exists == true else @more_text = false if @icon_exists == true @icon.dispose @icon_exists = false end end end #---------------------------------------------------------------------------- # More Text Icon #---------------------------------------------------------------------------- def more_text_icon @icon = Sprite.new @icon.x = (self.width/2)-100 @icon.y = Graphics.height-30 @icon.z = 200 @icon.bitmap = Bitmap.new("Graphics/Pictures/more_text.png") @icon_exists = true end #---------------------------------------------------------------------------- # More Text Icon Update #---------------------------------------------------------------------------- def update_icon if @icon_exists if @icon.opacity > 145 and @opacityDown == true @icon.opacity -= 5 elsif @icon.opacity == 145 @icon.opacity += 5 @opacityDown = false end if @icon.opacity < 255 and @opacityDown == false @icon.opacity += 5 elsif @icon.opacity == 255 @icon.opacity -= 5 @opacityDown = true end end end end
#============================================================================== # Tutorial Select Window #==============================================================================
class Window_TutSelect < Window_Selectable #---------------------------------------------------------------------------- # Initialize #---------------------------------------------------------------------------- def initialize super(Graphics.width*0.7,0,Graphics.width*0.3,Graphics.height) @commands = TUT::COMMANDS @item_max = @commands.size refresh self.index = 0 end #-------------------------------------------------------------------------- # Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # Update #-------------------------------------------------------------------------- def update super refresh end #-------------------------------------------------------------------------- # Draw Item #-------------------------------------------------------------------------- def draw_item(index, enabled = true) cmdArray = @commands[index] rect = item_rect(index) rect.x += 4 rect.width -= 8 self.contents.clear_rect(rect) if self.active self.contents.font.color = normal_color else self.contents.font.color = Color.new(160,160,160) end self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(rect, cmdArray[0]) end end
#============================================================================== # Tutorial Scene #==============================================================================
class Scene_Tutorial < Scene_Base #---------------------------------------------------------------------------- # Start #---------------------------------------------------------------------------- def start super create_menu_background @long_text_window = Window_LongText.new @select_window = Window_TutSelect.new @select_window.active = true end #---------------------------------------------------------------------------- # Update (Frame Update) #---------------------------------------------------------------------------- def update super update_menu_background @long_text_window.update @select_window.update if @long_text_window.more_text == true @select_window.active = false @long_text_window.active = true else @select_window.active = true @long_text_window.active = false end if @select_window.active == true update_select_window elsif @long_text_window.active == true update_long_text_window end end #---------------------------------------------------------------------------- # Update Select Window #---------------------------------------------------------------------------- def update_select_window if Input.trigger?(Input::B) Sound.play_cancel if TUT::RETURN_MENU $scene = Scene_Menu.new(TUT::MENU_INDEX) else $scene = Scene_Map.new end elsif Input.trigger?(Input::C) Sound.play_decision cmdArray = TUT::COMMANDS[@select_window.index] @long_text_window.load_long_text(cmdArray[1]) end end #---------------------------------------------------------------------------- # Update Long Text Window #---------------------------------------------------------------------------- def update_long_text_window if Input.trigger?(Input::C) or Input.trigger?(Input::B) Sound.play_decision @long_text_window.draw_long_text end end #---------------------------------------------------------------------------- # Terminate #---------------------------------------------------------------------------- def terminate super dispose_menu_background @long_text_window.dispose @select_window.dispose end end Il marche correctement sauf au niveau des écritures: - Spoiler:
Tout les rectangles sont des lettres avec un accent (à; é; ç; è, â...) J'ai testé sur projet vierge et avec la police de base de RM et j'ai eu le même problème... Donc voilà je demande de l'aide parce que je n'ai aucune idée d'où le problème peux venir.=( |
|
Voyageur Lv.10
Age : 34 Inscrit le : 12/02/2009 Messages : 469
| Sujet: Re: Problème de lettre sur ce script. Mer 14 Mar 2012 - 18:41 | |
| tout simplement enlève les accents ^^
" é " => " e " : " enlève " => " enleve "
et je pense que ton texte sera correct et sans avoir des carré de partout x) |
|
Age : 30 Inscrit le : 22/12/2011 Messages : 1600
| Sujet: Re: Problème de lettre sur ce script. Mer 14 Mar 2012 - 18:45 | |
| Oui je savais ^^' Mais du coup se serait chiant à lire...surtout pour les"â" |
|
Voyageur Lv.10
Age : 34 Inscrit le : 12/02/2009 Messages : 469
| Sujet: Re: Problème de lettre sur ce script. Mer 14 Mar 2012 - 19:35 | |
| ouai mais... on va dire que si tu met par exemple "gateau" sans le "â" ce n'est pas grave on comprend quand même x) |
|
| Sujet: Re: Problème de lettre sur ce script. | |
| |
|