Poulet trizo Lv.3
Age : 33 Inscrit le : 12/04/2010 Messages : 49
| Sujet: [VX] Système de bloc note Mer 28 Avr 2010 - 20:31 | |
| Un grand merci à Skillo pour l'énorme travaille qu'il à fournie pour amélioré mon script et donc sortir une nouvelle version^^ bien voici la démo: http://www.mediafire.com/?m0yjmzzozto
Auteur: Adurna et Skilloversion: 2.0 date de dernière modification:11/05/2010 et les screens: Ancienne version içi: - Spoiler:
auteur:Adurna version:1.0 date de dernière modification:21.02.10 screen:v1.0 v1.1 description:ce system permet au joueur de prendre de note pour ne pas oublier des indice, des idées, des conseille, ect... il est trés simple d'utilisation: par évent->appelle de script : - Code:
-
$scene = Scene_Note.new il faut le configuré un tout petit peut -gardé un héros vierge pour le script , il sert de mémoire comme décrit içi: - Code:
-
Actor_note= 1 #index du héros qui sert de "mémoire" code:[spoiler] - Code:
-
###################################################################### ######### ######### ###### Note system V1.0 By Adurna ###### ### ### ###### realise: 21.02.1 ###### ######### ######### ###################################################################### module Adurna Actor_note= 1 #index du héros qui sert de "mémoire" Nbr_carac_max = 100 #nombre de caractère max comprit entre 0 et 100 end
class Scene_Note < Scene_Base #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super create_menu_background @actor = $game_actors[Adurna::Actor_note] @edit_window = Window_NoteEdit.new(@actor,Adurna::Nbr_carac_max) @input_window = Window_NoteInput.new end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super dispose_menu_background @edit_window.dispose @input_window.dispose end #-------------------------------------------------------------------------- # * Return to Original Screen #-------------------------------------------------------------------------- def return_scene $scene = Scene_Map.new end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_menu_background @edit_window.update @input_window.update if Input.repeat?(Input::B) if @edit_window.index > 0 # Not at the left edge Sound.play_cancel @edit_window.back end elsif Input.trigger?(Input::C) if @input_window.is_decision # If cursor is positioned on [OK] if @edit_window.name == "" # If name is empty @edit_window.restore_default # Return to default name if @edit_window.name == "" Sound.play_buzzer else Sound.play_decision end else Sound.play_decision @actor.name = @edit_window.name # Change actor name return_scene end elsif @input_window.character != "" # If text characters are not empty if @edit_window.index == @edit_window.max_char # at the right edge Sound.play_buzzer else Sound.play_decision @edit_window.add(@input_window.character) # Add text character end end end end end
class Window_NoteEdit < Window_Base
attr_reader :name # name attr_reader :index # cursor position attr_reader :max_char # maximum number of characters #-------------------------------------------------------------------------- # * Object Initialization # actor : actor # max_char : maximum number of characters #-------------------------------------------------------------------------- def initialize(actor, max_char) super(0, 0, 545, 170) @actor = actor @name = actor.name @max_char = max_char name_array = @name.split(//)[0...@max_char] # Fit within max length @name = "" for i in 0...name_array.size @name += name_array[i] end @default_name = @name @index = name_array.size self.active = false refresh update_cursor end #-------------------------------------------------------------------------- # * Return to Default Name #-------------------------------------------------------------------------- def restore_default @name = @default_name @index = @name.split(//).size refresh update_cursor end #-------------------------------------------------------------------------- # * Add Text Character # character : text character to be added #-------------------------------------------------------------------------- def add(character) if @index < @max_char and character != "" @name += character @index += 1 refresh update_cursor end end #-------------------------------------------------------------------------- # * Delete Text Character #-------------------------------------------------------------------------- def back if @index > 0 name_array = @name.split(//) # Delete one character @name = "" for i in 0...name_array.size-1 @name += name_array[i] end @index -= 1 refresh update_cursor end end #-------------------------------------------------------------------------- # * Get rectangle for displaying items # index : item number #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.x = 1212- (@max_char + 1) * 12 + index * 24 rect.y = 0 rect.width = 24 rect.height = WLH return rect end def item_rect2(index) rect2 = Rect.new(0, 0, 0, 0) rect2.x = 732- (@max_char + 1) * 12 + index * 24 rect2.y = 24 rect2.width = 24 rect2.height = WLH return rect2 end def item_rect3(index) rect3 = Rect.new(0, 0, 0, 0) rect3.x = 252- (@max_char + 1) * 12 + index * 24 rect3.y = 48 rect3.width = 24 rect3.height = WLH return rect3 end def item_rect4(index) rect4 = Rect.new(0, 0, 0, 0) rect4.x = -228- (@max_char + 1) * 12 + index * 24 rect4.y = 72 rect4.width = 24 rect4.height = WLH return rect4 end def item_rect5(index) rect5 = Rect.new(0, 0, 0, 0) rect5.x = -708- (@max_char + 1) * 12 + index * 24 rect5.y = 96 rect5.width = 24 rect5.height = WLH return rect5 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear name_array = @name.split(//) for i in 0...@max_char c = name_array[i] c = '_' if c == nil if i<20 self.contents.draw_text(item_rect(i), c, 1) end if i>19 if i<40 self.contents.draw_text(item_rect2(i), c, 1) end end if i>19 if i<60 self.contents.draw_text(item_rect3(i), c, 1) end end if i>59 if i<80 self.contents.draw_text(item_rect4(i), c, 1) end end if i>79 self.contents.draw_text(item_rect5(i), c, 1) end end end #-------------------------------------------------------------------------- # * Update cursor #-------------------------------------------------------------------------- def update_cursor self.cursor_rect = item_rect(@index) end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_cursor end end
class Window_NoteInput < Window_Base ADURNA = [ 'A','B','C','D','E', 'a','b','c','d','e', '/','*','-','+','=', 'F','G','H','I','J', 'f','g','h','i','j', '"','{','}','[',']', 'K','L','M','N','O', 'k','l','m','n','o', '~','(',')','@','|', 'P','Q','R','S','T', 'p','q','r','s','t', '?','.','/','§',',', 'U','V','W','X','Y', 'u','v','w','x','y', ';',':','!','µ','%', 'Z',' ',' ',' ',' ', 'z',' ',' ',' ',' ', '¤','¨','°','²','^', 'Ä','Ë','Ï','Ö','Ü', 'ä','ë','ï','ö','ü', '<','>','£','$','♪', '1','2','3','4','5', 'â','ê','î','ô','û', 'Â','Ê','Î','Ô','Û', '6','7','8','9','0', 'è','é','à','ù','ç', '&',' ',' ',' ','OK'] TABLE = [ADURNA]
def initialize(mode = 0) super(0, 170, 545, 248) @mode = mode @index = 0 refresh update_cursor end
def character if @index < 133 return TABLE[@mode][@index] else return "" end end
def is_mode_change return (@index == 133) end
def is_decision return (@index == 134) end
def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.x = index % 15 * 32 + index % 15 / 5 * 16 rect.y = index / 15 * WLH rect.width = 32 rect.height = WLH return rect end
def refresh self.contents.clear for i in 0..134 rect = item_rect(i) rect.x += 2 rect.width -= 4 self.contents.draw_text(rect, TABLE[@mode][i], 1) end end
def update_cursor self.cursor_rect = item_rect(@index) end
def cursor_down(wrap) if @index <120 @index += 15 elsif wrap @index -= 120 end end
def cursor_up(wrap) if @index >= 15 @index -= 15 elsif wrap @index += 120 end end
def cursor_right(wrap) if @index % 15 < 14 @index += 1 elsif wrap @index -= 14 end end
def cursor_left(wrap) if @index % 15 > 0 @index -= 1 elsif wrap @index += 14 end end
def cursor_to_decision @index = 134 end #-------------------------------------------------------------------------- # * Move to Next Page #-------------------------------------------------------------------------- def cursor_pagedown @mode = (@mode + 1) % TABLE.size refresh end #-------------------------------------------------------------------------- # * Move to Previous Page #-------------------------------------------------------------------------- def cursor_pageup @mode = (@mode + TABLE.size - 1) % TABLE.size refresh end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super last_mode = @mode last_index = @index if Input.repeat?(Input::DOWN) cursor_down(Input.trigger?(Input::DOWN)) end if Input.repeat?(Input::UP) cursor_up(Input.trigger?(Input::UP)) end if Input.repeat?(Input::RIGHT) cursor_right(Input.trigger?(Input::RIGHT)) end if Input.repeat?(Input::LEFT) cursor_left(Input.trigger?(Input::LEFT)) end if Input.trigger?(Input::A) cursor_to_decision end if Input.trigger?(Input::R) cursor_pagedown end if Input.trigger?(Input::L) cursor_pageup end if Input.trigger?(Input::C) and is_mode_change cursor_pagedown end if @index != last_index or @mode != last_mode Sound.play_cursor end update_cursor end end
v1.1 - Spoiler:
- Code:
-
###################################################################### ######### ######### ###### Note system V1.1 By Adurna ###### ### ### ###### realise: 21.02.1 ###### ######### ######### ###################################################################### module Adurna Actor_note= 1 Nbr_carac_max = 100 Font = "font_note" end
class Scene_Note < Scene_Base #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super create_menu_background @actor = $game_actors[Adurna::Actor_note] @edit_window = Window_NoteEdit.new(@actor,Adurna::Nbr_carac_max) @edit_window.opacity = 0 @input_window = Window_NoteInput.new @input_window.opacity = 0 @font = Sprite.new @font.bitmap = Cache.picture(Adurna::Font) @font.x =0 @font.y =0 end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super @font.dipose dispose_menu_background @edit_window.dispose @input_window.dispose end #-------------------------------------------------------------------------- # * Return to Original Screen #-------------------------------------------------------------------------- def return_scene $scene = Scene_Map.new end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_menu_background @edit_window.update @input_window.update if Input.repeat?(Input::B) if @edit_window.index > 0 # Not at the left edge Sound.play_cancel @edit_window.back end elsif Input.trigger?(Input::C) if @input_window.is_decision # If cursor is positioned on [OK] if @edit_window.name == "" # If name is empty @edit_window.restore_default # Return to default name if @edit_window.name == "" Sound.play_buzzer else Sound.play_decision end else Sound.play_decision @actor.name = @edit_window.name # Change actor name return_scene end elsif @input_window.character != "" # If text characters are not empty if @edit_window.index == @edit_window.max_char # at the right edge Sound.play_buzzer else Sound.play_decision @edit_window.add(@input_window.character) # Add text character end end end end end
class Window_NoteEdit < Window_Base
attr_reader :name # name attr_reader :index # cursor position attr_reader :max_char # maximum number of characters #-------------------------------------------------------------------------- # * Object Initialization # actor : actor # max_char : maximum number of characters #-------------------------------------------------------------------------- def initialize(actor, max_char) super(0, 0, 545, 170) @actor = actor @name = actor.name @max_char = max_char name_array = @name.split(//)[0...@max_char] # Fit within max length @name = "" for i in 0...name_array.size @name += name_array[i] end @default_name = @name @index = name_array.size self.active = false refresh update_cursor end #-------------------------------------------------------------------------- # * Return to Default Name #-------------------------------------------------------------------------- def restore_default @name = @default_name @index = @name.split(//).size refresh update_cursor end #-------------------------------------------------------------------------- # * Add Text Character # character : text character to be added #-------------------------------------------------------------------------- def add(character) if @index < @max_char and character != "" @name += character @index += 1 refresh update_cursor end end #-------------------------------------------------------------------------- # * Delete Text Character #-------------------------------------------------------------------------- def back if @index > 0 name_array = @name.split(//) # Delete one character @name = "" for i in 0...name_array.size-1 @name += name_array[i] end @index -= 1 refresh update_cursor end end #-------------------------------------------------------------------------- # * Get rectangle for displaying items # index : item number #-------------------------------------------------------------------------- def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.x = 1212- (@max_char + 1) * 12 + index * 24 rect.y = 0 rect.width = 24 rect.height = WLH return rect end def item_rect2(index) rect2 = Rect.new(0, 0, 0, 0) rect2.x = 732- (@max_char + 1) * 12 + index * 24 rect2.y = 24 rect2.width = 24 rect2.height = WLH return rect2 end def item_rect3(index) rect3 = Rect.new(0, 0, 0, 0) rect3.x = 252- (@max_char + 1) * 12 + index * 24 rect3.y = 48 rect3.width = 24 rect3.height = WLH return rect3 end def item_rect4(index) rect4 = Rect.new(0, 0, 0, 0) rect4.x = -228- (@max_char + 1) * 12 + index * 24 rect4.y = 72 rect4.width = 24 rect4.height = WLH return rect4 end def item_rect5(index) rect5 = Rect.new(0, 0, 0, 0) rect5.x = -708- (@max_char + 1) * 12 + index * 24 rect5.y = 96 rect5.width = 24 rect5.height = WLH return rect5 end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear name_array = @name.split(//) for i in 0...@max_char c = name_array[i] c = '_' if c == nil if i<20 self.contents.draw_text(item_rect(i), c, 1) end if i>19 if i<40 self.contents.draw_text(item_rect2(i), c, 1) end end if i>19 if i<60 self.contents.draw_text(item_rect3(i), c, 1) end end if i>59 if i<80 self.contents.draw_text(item_rect4(i), c, 1) end end if i>79 self.contents.draw_text(item_rect5(i), c, 1) end end end #-------------------------------------------------------------------------- # * Update cursor #-------------------------------------------------------------------------- def update_cursor self.cursor_rect = item_rect(@index) end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_cursor end end
class Window_NoteInput < Window_Base ADURNA = [ 'A','B','C','D','E', 'a','b','c','d','e', '/','*','-','+','=', 'F','G','H','I','J', 'f','g','h','i','j', '"','{','}','[',']', 'K','L','M','N','O', 'k','l','m','n','o', '~','(',')','@','|', 'P','Q','R','S','T', 'p','q','r','s','t', '?','.','/','§',',', 'U','V','W','X','Y', 'u','v','w','x','y', ';',':','!','µ','%', 'Z',' ',' ',' ',' ', 'z',' ',' ',' ',' ', '¤','¨','°','²','^', 'Ä','Ë','Ï','Ö','Ü', 'ä','ë','ï','ö','ü', '<','>','£','$','♪', '1','2','3','4','5', 'â','ê','î','ô','û', 'Â','Ê','Î','Ô','Û', '6','7','8','9','0', 'è','é','à','ù','ç', '&',' ',' ',' ','OK'] TABLE = [ADURNA]
def initialize(mode = 0) super(0, 170, 545, 248) @mode = mode @index = 0 refresh update_cursor end
def character if @index < 133 return TABLE[@mode][@index] else return "" end end
def is_mode_change return (@index == 133) end
def is_decision return (@index == 134) end
def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.x = index % 15 * 32 + index % 15 / 5 * 16 rect.y = index / 15 * WLH rect.width = 32 rect.height = WLH return rect end
def refresh self.contents.clear for i in 0..134 rect = item_rect(i) rect.x += 2 rect.width -= 4 self.contents.draw_text(rect, TABLE[@mode][i], 1) end end
def update_cursor self.cursor_rect = item_rect(@index) end
def cursor_down(wrap) if @index <120 @index += 15 elsif wrap @index -= 120 end end
def cursor_up(wrap) if @index >= 15 @index -= 15 elsif wrap @index += 120 end end
def cursor_right(wrap) if @index % 15 < 14 @index += 1 elsif wrap @index -= 14 end end
def cursor_left(wrap) if @index % 15 > 0 @index -= 1 elsif wrap @index += 14 end end
def cursor_to_decision @index = 134 end #-------------------------------------------------------------------------- # * Move to Next Page #-------------------------------------------------------------------------- def cursor_pagedown @mode = (@mode + 1) % TABLE.size refresh end #-------------------------------------------------------------------------- # * Move to Previous Page #-------------------------------------------------------------------------- def cursor_pageup @mode = (@mode + TABLE.size - 1) % TABLE.size refresh end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super last_mode = @mode last_index = @index if Input.repeat?(Input::DOWN) cursor_down(Input.trigger?(Input::DOWN)) end if Input.repeat?(Input::UP) cursor_up(Input.trigger?(Input::UP)) end if Input.repeat?(Input::RIGHT) cursor_right(Input.trigger?(Input::RIGHT)) end if Input.repeat?(Input::LEFT) cursor_left(Input.trigger?(Input::LEFT)) end if Input.trigger?(Input::A) cursor_to_decision end if Input.trigger?(Input::R) cursor_pagedown end if Input.trigger?(Input::L) cursor_pageup end if Input.trigger?(Input::C) and is_mode_change cursor_pagedown end if @index != last_index or @mode != last_mode Sound.play_cursor end update_cursor end end
pour cela il faut un image nommée font_note dans le dossier pictures un grand merci à Mist' qui m'a tiré d'un bon ptit problème!!!
Dernière édition par adurna le Jeu 22 Juil 2010 - 15:46, édité 2 fois |
|