Rpg˛S Forum uses cookies. Read the Privacy Policy for more info. To remove this message, please click the button to the right:    I accept the use of cookies

Vai al contenuto

Rpg˛S Forum uses cookies. Read the Privacy Policy for more info. To remove this message, please click the button to the right:    I accept the use of cookies

Screen Contest #90

Kamikun





Avatar

 [Risolto]Problema Marshal.dump


Best Answer Holy87 , 24 September 2019 - 09:12 AM

Non puoi dumpare le window, perché sono oggetti grafici. Anche se hai fatto dispose, la finestra continua ad esistere e quando salvi ti darà errore.

Dopo @wind.dispose, metti @wind = nil.

Vai al post intero

  • Si prega di effettuare il log in prima di rispondere
[Risolto]Problema Marshal.dump - - - - -

    Gabriel
  • Utente avanzato

  • Utenti
  • Rens: 1
  • 0
  • StellettaStellettaStelletta
  • 293 messaggi
  • Sesso:Maschio
  • Provenienza:Firenze
  • Abilitā:Maestro

#1 Inviato 23 September 2019 - 20:14 PM

Ciao a tutti, sto riscontrando un problema per il quale devo oggettivamente gettare la spugna e chiedere un aiuto a chi digerisce il ruby meglio di me.

Il mio problema comprende i seguenti script:

-Charlie Fleed CTB vers. 3.2
- 1-Scene CMS (Alternate Version) by LegACy vers. 1.01

Più in particolare, ho un problema quando viene richiamata la finestra di aiuto skill/oggetti/comandi in battaglia (sempre facente parte il Charlie Fleed CTB):

 

#==============================================================================
# ** Window_Help_Tiny
#------------------------------------------------------------------------------
#  This window shows skill and item explanations along with actor status.
#==============================================================================

class Window_Help_Tiny < Window_Help
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super
    self.height = 56
    self.contents = Bitmap.new(width - 32, height - 32)
    begin
      if HELP_WINDOW_WINDOWSKIN_NAME != ""
        self.windowskin = RPG::Cache.windowskin(HELP_WINDOW_WINDOWSKIN_NAME)
      end
    rescue
      p HELP_WINDOW_WINDOWSKIN_NAME + " not found."
    end
    self.opacity = HELP_WINDOW_WINDOWSKIN_OPACITY
    self.x = HELP_WINDOW_X
    self.y = HELP_WINDOW_Y
    @bg = Sprite.new()
    begin
      @bg.bitmap=RPG::Cache.picture(HELP_WINDOW_BG_PICTURE_NAME)
    rescue
      if HELP_WINDOW_BG_PICTURE_NAME != ""
        p HELP_WINDOW_BG_PICTURE_NAME + " not found."
      end
    end
    @bg.x = self.x
    @bg.y = self.y
    @bg.z = self.z - 5
    @bg.visible = self.visible
  end
  
  #--------------------------------------------------------------------------
  # * Set Text
  #  text  : text string displayed in window
  #  align : alignment (0..flush left, 1..center, 2..flush right)
  #--------------------------------------------------------------------------
  def set_text(text, align = 0)
    # If at least one part of text and alignment differ from last time
    if text != @text or align != @align
      # Redraw text
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(10, 4, self.width - 200, 24, text, align)
      @text = text
      @align = align
      @actor = nil
    end
    self.visible = true
  end
  
  #--------------------------------------------------------------------------
  # ● 
  #--------------------------------------------------------------------------  
  def dispose
    super
    @bg.dispose
  end
  
  #--------------------------------------------------------------------------
  # ● 
  #--------------------------------------------------------------------------  
  def visible=(value)
    super
    @bg.visible = value
  end
end

La finestra si apre senza problemi in battaglia utilizzando il seguente CallScript in una pagina di eventi di battaglia:
Event.png

L'evento viene processato senza problemi, la finestra si apre con la scritta impostata, effettua l'animazione del mostro, si chiude, e poi la battaglia termina.
Il problema avviene quando si prova poi a salvare il gioco (al menù ci si accede tranquillamente e funzionano tutti i comandi, tranne il save):

Screen2.png

Guardando il "debug" (grazie per non averlo implementato, Enterbrain), ci si ferma a questo punto del menù custom, il metodo di scrittura dei salvataggi (istruzione Marshal.dump($game_system, file))
 

    #--------------------------------------------------------------------------
    # * Frame Update (when save window is active)
    #--------------------------------------------------------------------------
    def update_save
      # If B button was pressed
      if Input.trigger?(Input::B)
        # Play cancel SE
        $game_system.se_play($data_system.cancel_se)
        # Switch to menu screen
        @file_window.active = false
        @command_window.active = true
        return
      end
      # If C button was pressed
      if Input.trigger?(Input::C)
        # Play save SE
        $game_system.se_play($data_system.save_se)
        file = File.open("Save#{@file_window.index + 1}.rxdata", "wb")
        characters = []
        for i in 0...$game_party.actors.size
          actor = $game_party.actors[i]
          characters.push([actor.character_name, actor.character_hue])
        end
        Marshal.dump(characters, file)
        # Write frame count for measuring play time
        Marshal.dump(Graphics.frame_count, file)
        # Increase save count by 1
        $game_system.save_count += 1
        # Save magic number
        # (A random value will be written each time saving with editor)
        $game_system.magic_number = $data_system.magic_number
        # Write each type of game object
        Marshal.dump($game_system, file)
        Marshal.dump($game_switches, file)
        Marshal.dump($game_variables, file)
        Marshal.dump($game_self_switches, file)
        Marshal.dump($game_screen, file)
        Marshal.dump($game_actors, file)
        Marshal.dump($game_party, file)
        Marshal.dump($game_troop, file)
        Marshal.dump($game_map, file)
        Marshal.dump($game_player, file)
        file.close
        @file_window.refresh        
        @filestat_window.refresh
        return
      end
    end

Qualcuno sa darmi una spiegazione per questo errore?
Ho capito che il Marshal.dump permette di esportare degli oggetti ruby per poi essere riletti in seguito, ma non capisco come possa una finestra che viene normalmente utilizzata in tutte le battaglie dare errore quando richiamata (e disposata) "manualmente".


Modificato da Gabriel, 24 September 2019 - 21:24 PM.

Con la mia lama fenderò le tenebre e con il mio scudo proteggerò i deboli

2912.png


    Guardian of Irael
  • Coniglietto Rosso

  • Rpg˛S Admin
  • Rens: 195
  • 19
  • StellettaStellettaStellettaStellettaStellettaStelletta
  • 58413 messaggi
  • Sesso:Maschio
  • Provenienza:Bagnaia (Viterbo)
  • Abilitā:Apprendista


#2 Inviato 23 September 2019 - 20:44 PM

(L'autore sembra visitare ancora il suo DA https://www.devianta...om/charliefleedpotresti magari provare a vedere lì se ti risponde, era qui sul forum, parla italiano, lo dico in caso avessi trovato lo script altrove)

^ ^


(\_/)
(^ ^) <----coniglietto rosso, me!     
(> <)

 
Il mio Tumblr dove seguire i miei progetti, i progetti della Reverie : : Project ^ ^
 
KdUDtQt.png disponibile su Google Play, qui i dettagli! ^ ^
 
FwnGMI3.png completo! Giocabile online, qui i dettagli! ^ ^  
 
REVERIE : : RENDEZVOUS (In allenamento per apprendere le buone arti prima di cominciarlo per bene ^ ^) Trovate i dettagli qui insieme alla mia intervista (non utilizzerò più rpgmaker) ^ ^

Spoiler


    Gabriel
  • Utente avanzato

  • Utenti
  • Rens: 1
  • 0
  • StellettaStellettaStelletta
  • 293 messaggi
  • Sesso:Maschio
  • Provenienza:Firenze
  • Abilitā:Maestro

#3 Inviato 23 September 2019 - 21:31 PM

(L'autore sembra visitare ancora il suo DA https://www.devianta...om/charliefleedpotresti magari provare a vedere lì se ti risponde, era qui sul forum, parla italiano, lo dico in caso avessi trovato lo script altrove)

^ ^

Se nessuno potrà aiutarmi chiederò direttamente a lui, sperando che si ricordi un po' del suo vecchio CTB  :biggrin:


Con la mia lama fenderò le tenebre e con il mio scudo proteggerò i deboli

2912.png


    Holy87
  • Prode Guerriero

  • Rpg˛S Staff
  • Rens: 458
  • 6
  • StellettaStellettaStellettaStellettaStellettaStelletta
  • 7431 messaggi
  • Sesso:Maschio
  • Provenienza:San Giorgio a Cremano
  • Abilitā:Maestro

#4 Inviato 24 September 2019 - 09:12 AM

  Best Answer

Non puoi dumpare le window, perché sono oggetti grafici. Anche se hai fatto dispose, la finestra continua ad esistere e quando salvi ti darà errore.

Dopo @wind.dispose, metti @wind = nil.


"Io non volevo solo partecipare alle discussioni. Volevo avere il potere di farle fallire" [cit.]

BannerOverdrive35.png
Cap3.png

578.png
 

Miei script per RPG Maker VX Ace:

Spoiler

 
I miei tutorial:
Spoiler

    Gabriel
  • Utente avanzato

  • Utenti
  • Rens: 1
  • 0
  • StellettaStellettaStelletta
  • 293 messaggi
  • Sesso:Maschio
  • Provenienza:Firenze
  • Abilitā:Maestro

#5 Inviato 24 September 2019 - 11:40 AM

Non puoi dumpare le window, perché sono oggetti grafici. Anche se hai fatto dispose, la finestra continua ad esistere e quando salvi ti darà errore.

Dopo @wind.dispose, metti @wind = nil.

Avevo una vaga idea che il problema potesse essere quello (perchè leggendo la descrizione del  "dispose" c'è scritto che ammazza l'immagine, ma non dice nulla riguardo la finestra stessa).
Stasera provo e ti dico.

Edit: testato e funziona, grazie Holy.


Modificato da Gabriel, 24 September 2019 - 19:57 PM.

Con la mia lama fenderò le tenebre e con il mio scudo proteggerò i deboli

2912.png





  • Feed RSS