Salve a tutti!
Sono nuovo di questo forum e avrei bisogno di un piccolo aiuto.
Sto lavorando su un piccolo gioco e sono a buon punto ma di punto ed in bianco ho rilevato un problema in uno script, ho aggiunto 2 nuovi script ma ho testato se erano loro il problema e non lo sono!
Questo script serve ad impostare il Menù... Quando apro il gioco va tutto bene ma se premo il tastino per aprire il Menù mi segnala una stringa dove rintraccia un errore, vi posto lo script e vi evidenzio il punto dell'errore.
Grazie in anticipo a tutti!
#============================================================================== # ■ Window_MenuStatus #============================================================================== # Autore: Melosx # Versione: 1.0 # Inserito in: Vx_Mod_System v 0.9 # #============================================================================== # * Descrizione # ----------------------------------------------------------------------------- # Modifica della disposizione degli elementi della window e agiunta la barra # dell'esperienza. #============================================================================== class Window_MenuStatus < Window_Selectable def initialize(x, y) super(0, 56, 544, 304) refresh self.active = true self.index = -1 end def refresh self.contents.clear self.contents.font.size = 16 @item_max = $game_party.members.size for actor in $game_party.members x = actor.index * 128 + 2 y = 0 draw_actor_graphic(actor, x + 20, y + (WLH + 16)) draw_actor_name(actor, x + 40, (y + 10) + WLH * 0) draw_actor_class(actor, x , (y + 40) + (WLH * 1)) draw_actor_state(actor, x + 5, y + 185) self.contents.draw_text( x, y + 160, 120, WLH, "Status:", 0) draw_actor_level(actor, x , y + 43) draw_actor_hp(actor, x , (y + 89) + WLH * 0, width = 105) draw_actor_mp(actor, x + 5 , (y + 89) + WLH * 1, width = 105) draw_actor_exp_gauge(actor, x + 5 , (y + 225)) draw_exp_info(actor, x, (y + 219)) end end def update super if cursor_movable? last_index = @index if Input.repeat?(Input::RIGHT) cursor_down(Input.trigger?(Input::RIGHT)) end if Input.repeat?(Input::LEFT) cursor_up(Input.trigger?(Input::LEFT)) end if @index != last_index Sound.play_cursor end end update_cursor call_update_help end def update_cursor if @index < 0 self.cursor_rect.empty elsif @index < @item_max self.cursor_rect.set(@index * 128, 0 , 128, 272) elsif @index >= 100 self.cursor_rect.set(@index * 128, 0 , 128, 272) else self.cursor_rect.set(0, 0, 512, 272) end end def draw_exp_info(actor, x, y) self.contents.font.color = text_color(0) s1 = actor.exp_s s2 = actor.corr_exp s3 = s1-s2 s4 = actor.pros_lvl_exp exp = s3.to_s + " / " + s4.to_s self.contents.draw_text(x, y + WLH * 0, 100, WLH, "Esperienza") self.contents.draw_text(x, y + WLH * 1 - 10, 100, WLH, exp, 2) end end #============================================================================== # ** Game_Actor #------------------------------------------------------------------------------ # * aggiunte #============================================================================== class Game_Actor < Game_Battler def corr_exp return @exp_list[@level] end def pros_lvl_exp return @exp_list[@level+1]-@exp_list[@level] end end #============================================================================== # ** Window_Base #------------------------------------------------------------------------------ # * aggiunte + alias #============================================================================== class Window_Base < Window alias melosx_draw_actor_hp_gauge draw_actor_hp_gauge alias melosx_draw_actor_mp_gauge draw_actor_mp_gauge def draw_actor_hp_gauge(actor, x, y, width = 120) gw = width * actor.hp / actor.maxhp gc1 = text_color(20) gc2 = text_color(21) gauge_cornice_color = text_color(0) gauge_cornice2_color = text_color(15) self.contents.fill_rect(x - 1, y + WLH - 9, width + 4, 10, gauge_cornice2_color) self.contents.fill_rect(x, y + WLH - 8, width + 2, 8, gauge_cornice_color) self.contents.fill_rect(x + 1, y + WLH - 8 + 1, width, 6, text_color(15)) self.contents.gradient_fill_rect(x + 1, y + WLH - 8 + 1, gw, 6, gc1, gc2) end def draw_actor_mp_gauge(actor, x, y, width = 120) gw = width * actor.mp / [actor.maxmp, 1].max gc1 = text_color(22) gc2 = text_color(23) gauge_cornice_color = text_color(0) gauge_cornice2_color = text_color(15) self.contents.fill_rect(x - 1, y + WLH - 9, width + 4, 10, gauge_cornice2_color) self.contents.fill_rect(x, y + WLH - 8, width + 2, 8, gauge_cornice_color) self.contents.fill_rect(x + 1, y + WLH - 8 + 1, width, 6, text_color(15)) self.contents.gradient_fill_rect(x + 1, y + WLH - 8 + 1, gw, 6, gc1, gc2) end def draw_actor_exp_gauge(actor, x, y, width = 95) s1 = actor.exp_s s2 = actor.corr_exp s3 = s1-s2 s4 = actor.pros_lvl_exp gw = width * s3 / s4 gc1 = text_color(14) gc2 = text_color(6) gauge_back_color = text_color(15) gauge_cornice_color = text_color(15) gauge_cornice2_color = text_color(0) self.contents.fill_rect(x - 1, y + WLH - 1, width + 4, 10, gauge_cornice_color) self.contents.fill_rect(x, y + WLH, width + 2, 8, gauge_cornice2_color) self.contents.fill_rect(x + 1, y + WLH + 1, width, 6, gauge_back_color) self.contents.gradient_fill_rect(x + 1, y + WLH + 1, gw, 6, gc1, gc2) end end
La stringa d'errore è:
def draw_actor_exp_gauge(actor, x, y, width = 95) s1 = actor.exp_s s2 = actor.corr_exp s3 = s1-s2
(Precisamente dice: undefined method '-' for "-------": String)
Modificato da Oswold, 27 April 2013 - 17:46 PM.