[RESOLVED] NoMethodError, help on fixing it

Started by gRaViJa, July 11, 2011, 01:46:45 pm

Previous topic - Next topic

gRaViJa

July 11, 2011, 01:46:45 pm Last Edit: July 12, 2011, 01:30:38 am by ForeverZer0
I have a script that mimics psn/xbl Achievements (made by Gameguy). When trying to implement it to my game, i get a NoMethodError:



The method that causes this error is the part that will show an alert when the player gets a new achievement. (Here's that part of the code that produces the error, exact line of error: if $game_system.queue.size > 0 && @frame < 1)


#===============================================================================
# Graphics
#-------------------------------------------------------------------------------
# **added method to control and draw all queued achievements.
#===============================================================================
module Graphics
 class << self
   alias gg_upd_awards_queue_lat update
 end
 def self.update
   @frame = 0 if @frame == nil
if $game_system.queue.size > 0 && @frame < 1
     award = Awards::Award[$game_system.queue[0]]
     if award != nil
       @sprite = Sprite_Award.new(award)
       @frame = Awards::Popup_Time
       Audio.se_play("Audio/SE/#{Awards::Popup_Sound[0]}",
         Awards::Popup_Sound[1], Awards::Popup_Sound[2])
     end
   end
   if @frame > 0
     @frame -= 1
     if @frame < 1
       @sprite.dispose
       $game_system.queue.shift
     end
   end
   gg_upd_awards_queue_lat
 end
end


If i understand it right, this adds a method to module graphics to let it draw achievements. I have other scripts that possibly make edits to Graphics Module as well, so i think that causes the error? If so, is it possible to edit this script to fix the error without changing other scripts? Because then a tidal wave of other errors might occure.

Full script here:

http://www.text-upload.com/read.php?id=102621&c=7454606

Help is appreciated!

Wizered67

I'm not 100% sure about this, but I think it has something to do with corrupting the old save files. You may want to try deleting old save files and doing a new game.

gRaViJa

I got a golden tip: it's because my splashscreen script calls the graphics module before this script. With this info I think i can solve this myself.

G_G

July 11, 2011, 02:32:56 pm #3 Last Edit: July 11, 2011, 02:34:23 pm by game_guy
Try placing my script below the splash screen.

EDIT: I updated the script. It checks to see if $game_system has been initialized now.

gRaViJa