I tried incorporating both Kain Nobel's CMS and f0tz!'s pixelmovement into my game, but a conflict arose. I've managed to narrow it down to a few lines in each code, so hopefully it will be easy to identify the problem--and also easy to resolve. Currently, whenever I try to start the game I get this error message before the title screen loads:
Script 'CMS::Windowskin' line 212: TypeError occurred.
can't convert NilClass into Bitmap
The code for CMS:Windowskin:
And here's the code from Pixelmovement that's causing me trouble. Although there are multiple sections of this code, I systemically deleted each of them until the error message was resolved. RPG::Cache/Input is the culprit. I further narrowed the problem down to the lines between 14 and 34. If I delete those lines, I can get to the title screen. Unfortunately, deleting them results in a new error message when I try to start a new game.
I'd appreciate any help with resolving this problem.
Thanks,
tuatha
Script 'CMS::Windowskin' line 212: TypeError occurred.
can't convert NilClass into Bitmap
The code for CMS:Windowskin:
Code:#=============================================================================== # ** CMS::Windowskin #=============================================================================== #------------------------------------------------------------------------------- # * SDK Log #------------------------------------------------------------------------------- SDK.log('CMS::Windowskin', 'Kain Nobel ©', 2.5, '11.27.2008') #------------------------------------------------------------------------------- # * SDK Enabled Test : BEGIN #------------------------------------------------------------------------------- if SDK.enabled?('CMS::Windowskin') #=============================================================================== # ** CMS::Windowskin #------------------------------------------------------------------------------- # This module handles user-defined windowskin (outside of database). #=============================================================================== module CMS::Windowskin ################################################################################ # ~** CUSTOMIZABLE CONSTANTS - BEGIN **~ # ################################################################################ #----------------------------------------------------------------------------- # * Custom Windowskin is Enabled? #----------------------------------------------------------------------------- @custom = false #----------------------------------------------------------------------------- # * Windowskin for Back #----------------------------------------------------------------------------- @back = {'Window_Status' => 'Royal'} @back.default = 'dark_eternal' #----------------------------------------------------------------------------- # * Windowskin for Borders #----------------------------------------------------------------------------- @borders = {} @borders.default = 'Royal' #----------------------------------------------------------------------------- # * Windowskin for Scrolls #----------------------------------------------------------------------------- @scrolls = {} @scrolls.default = 'dark_eternal' #----------------------------------------------------------------------------- # * Windowskin for Arrows #----------------------------------------------------------------------------- @arrows = {} @arrows.default = 'Royal' #----------------------------------------------------------------------------- # * Windowskin for Pause #----------------------------------------------------------------------------- @pause = {} @pause.default = 'dark_eternal' #----------------------------------------------------------------------------- # * Windowskin for Cursor #----------------------------------------------------------------------------- @cursor = {} @cursor.default = 'Royal' ################################################################################ # ~** CUSTOMIZABLE CONSTANTS - END **~ # ################################################################################ #----------------------------------------------------------------------------- # * Enable #----------------------------------------------------------------------------- def self.enable @custom = true end #----------------------------------------------------------------------------- # * Disable #----------------------------------------------------------------------------- def self.disable @custom = false end #----------------------------------------------------------------------------- # * Custom? #----------------------------------------------------------------------------- def self.enabled? return @custom == true end #----------------------------------------------------------------------------- # * Default #----------------------------------------------------------------------------- def self.default return $data_system.windowskin_name end #----------------------------------------------------------------------------- # * Custom #----------------------------------------------------------------------------- def self.custom(win = '') a = @back[win] b = @borders[win] c = @scrolls[win] d = @cursor[win] e = @pause[win] f = @arrows[win] x = RPG::Cache.set_windowskin(a, b, c, d, e, f) return x end #----------------------------------------------------------------------------- # * Back = #----------------------------------------------------------------------------- def self.back=(file) @back = file.is_a?(String) ? file : default end #----------------------------------------------------------------------------- # * Borders = #----------------------------------------------------------------------------- def self.borders=(file) @borders = file.is_a?(String) ? file : default end #----------------------------------------------------------------------------- # * Scrolls = #----------------------------------------------------------------------------- def self.scrolls=(file) @scrolls = file.is_a?(String) ? file : default end #----------------------------------------------------------------------------- # * Cursor = #----------------------------------------------------------------------------- def self.cursor=(file) @cursor = file.is_a?(String) ? file : default end #----------------------------------------------------------------------------- # * Pause = #----------------------------------------------------------------------------- def self.pause=(file) @pause = file.is_a?(String) ? file : default end #----------------------------------------------------------------------------- # * Arrows = #----------------------------------------------------------------------------- def self.arrows=(file) @arrows = file.is_a?(String) ? file : default end end #=============================================================================== # ** Window_Base #------------------------------------------------------------------------------- # ... #=============================================================================== class Window_Base < Window #----------------------------------------------------------------------------- # * Alias Listing #----------------------------------------------------------------------------- alias_method :cms_windowskin_win_base_update, :update #----------------------------------------------------------------------------- # * Update #----------------------------------------------------------------------------- def update cms_windowskin_win_base_update if CMS::Windowskin.enabled? if self.windowskin != CMS::Windowskin.custom(self.class.to_s) self.windowskin = CMS::Windowskin.custom(self.class.to_s) end end end end #=============================================================================== # ** RPG::Cache #------------------------------------------------------------------------------- # Credit to poccil, this allows CMS menus to be composed of different skins. #=============================================================================== module RPG::Cache #----------------------------------------------------------------------------- # * RPG::Cache.get_windowskin(name) #----------------------------------------------------------------------------- def self.get_windowskin(name) unless name.nil? begin ; return windowskin(name) rescue ; return windowskin($data_system.windowskin_name) end end end #----------------------------------------------------------------------------- # * RPG::Cache.set_windowskin() #----------------------------------------------------------------------------- # Syntax # o n1 : Windowskin Background # o n2 : Windowskin Borders # o n3 : Windowskin Scrolls # o n4 : Windowskin Cursor # o n5 : Windowskin Pause # o n6 : Windowskin Arrows # o n7 : Rect Color (Overrides Windowskin Cursor) #----------------------------------------------------------------------------- def self.set_windowskin(k1, k2, k3, k4, k5, k6) # Create bitmap bitmap = Bitmap.new(192, 128) # Next we calculate the key key = ":windowskin:"+k1+"_"+k2+"_"+k3+"_"+k4+"_"+k5+"_"+k6 # Return @cache[key] unless nil or disposed if @cache[key] && !@cache[key].disposed? return @cache[key] end # Create Background bitmap.blt(0, 0, get_windowskin(k1), Rect.new(0, 0, 128, 128)) # Create Border (4 Sides) bitmap.blt(128, 0, get_windowskin(k2), Rect.new(128, 0, 16, 64)) bitmap.blt(176, 0, get_windowskin(k2), Rect.new(176, 0, 16, 64)) bitmap.blt(128, 0, get_windowskin(k2), Rect.new(128, 0, 192, 16)) bitmap.blt(128, 48, get_windowskin(k2), Rect.new(128, 48, 192, 16)) # Create Scroll bitmap.blt(144,16,get_windowskin(k3), Rect.new(144, 16, 32, 32)) # Create Cursor Rect bitmap.blt(128,64,get_windowskin(k4), Rect.new(128, 64, 32, 32)) # Create Pause bitmap.blt(160,64,get_windowskin(k5), Rect.new(160, 64, 32, 32)) # Create Arrows bitmap.blt(128,96,get_windowskin(key), Rect.new(128, 96, 64, 32)) @cache[key] = bitmap # Return Composit Windowskin return bitmap end end #------------------------------------------------------------------------------- # * SDK Enabled Test : END #------------------------------------------------------------------------------- end
And here's the code from Pixelmovement that's causing me trouble. Although there are multiple sections of this code, I systemically deleted each of them until the error message was resolved. RPG::Cache/Input is the culprit. I further narrowed the problem down to the lines between 14 and 34. If I delete those lines, I can get to the title screen. Unfortunately, deleting them results in a new error message when I try to start a new game.
Code:#=============================================================================== # RPG Module #=============================================================================== module RPG #============================================================================= # RPG::Cache Module #============================================================================= module Cache #--------------------------------------------------------------------------- # loads a bitmap #--------------------------------------------------------------------------- def self.load_bitmap(folder_name, filename, hue = 0) path = folder_name + filename if not @cache.include?(path) or @cache[path].disposed? if filename != "" @cache[path] = Bitmap.new(path) else @cache[path] = Bitmap.new(32, 32) end end if hue == 0 @cache[path] else key = [path, hue] if not @cache.include?(key) or @cache[key].disposed? @cache[key] = @cache[path].clone @cache[key].hue_change(hue) end @cache[key] end rescue end #--------------------------------------------------------------------------- # loads a collision map #--------------------------------------------------------------------------- def self.collision_map(filename) self.load_bitmap($pixelmovement.collision_folder, filename) end #--------------------------------------------------------------------------- # loads a height map #--------------------------------------------------------------------------- def self.height_map(filename) self.load_bitmap($pixelmovement.height_folder, filename) end #--------------------------------------------------------------------------- # loads a swamp map #--------------------------------------------------------------------------- def self.swamp_map(filename) self.load_bitmap($pixelmovement.swamp_folder, filename) end end end #=============================================================================== # Input Module #=============================================================================== module Input #----------------------------------------------------------------------------- # 4 Direction Diagonal movement #----------------------------------------------------------------------------- def self.dir4diag if Input.press?(LEFT) return 7 elsif Input.press?(RIGHT) return 3 elsif Input.press?(UP) return 9 elsif Input.press?(DOWN) return 1 else return 0 end end #----------------------------------------------------------------------------- # 8 Direction Diagonal movement #----------------------------------------------------------------------------- def self.dir8diag if Input.press?(RIGHT) and Input.press?(UP) return 6 elsif Input.press?(RIGHT) and Input.press?(DOWN) return 2 elsif Input.press?(LEFT) and Input.press?(UP) return 8 elsif Input.press?(LEFT) and Input.press?(DOWN) return 4 elsif Input.press?(LEFT) return 7 elsif Input.press?(RIGHT) return 3 elsif Input.press?(UP) return 9 elsif Input.press?(DOWN) return 1 else return 0 end end end
I'd appreciate any help with resolving this problem.
Thanks,
tuatha