I made a tiny little script to run my minigame system. I needed to save the variables used for best compatibility, but the next thing I knew, it didn't want to be compatible with Requiem ABS.
It's a really small code though, and I aliased for optimum compatibility. :\ (Though I don't full understand aliasing yet) I did try putting my code both below and above Vampyr SBABS though.
So I'm hoping someone could tell me why it's not working! Thanks for the support :3
CODE
#============================================================================== # ** Interpreter #------------------------------------------------------------------------------ # This interpreter runs event commands. This class is used within the # Game_System class and the Game_Event class. #==============================================================================
class Game_Interpreter #-------------------------------------------------------------------------- # * Event ID #-------------------------------------------------------------------------- def ev_id # Returns event id return @event_id end end
#============================================================================== # ** Scene_File #------------------------------------------------------------------------------ # This class performs the save and load screen processing. #==============================================================================
class Scene_File
alias oldWriteSaveMGSys write_save_data def write_save_data(file) oldWriteSaveMGSys(file) Marshal.dump($util, file) Marshal.dump($mgval, file) Marshal.dump($mgtype, file) Marshal.dump($mgquit, file) Marshal.dump($mganim, file) end
alias oldNewGameMGSys command_new_game def command_new_game oldNewGameMGSys $util = Utility.new $mgval = [] $mgtype = [] $mgquit = [] for i in 0..100 $mgval[i] = 0 $mgtype[i] = 0 end end
end
Similar parts in the Vampyr SBABS code:
Scene File
CODE
#------------------------------------------------------------------------------ # Scene File #------------------------------------------------------------------------------ class Scene_File < Scene_Base
alias vampyr_sbabs_sfile_do_load do_load alias vampyr_sbabs_sfile_write_save_data write_save_data alias vampyr_sbabs_sfile_read_save_data read_save_data
def do_load vampyr_sbabs_sfile_do_load $game_player.refresh for ally in $game_allies.compact ally.refresh end end
def command_new_game vampyr_sbabs_scenetitle_command_new_game for ally in $game_allies.compact ally.map_id = $data_system.start_map_id ally.moveto($data_system.start_x, $data_system.start_y) ally.move_random end end
end
This post has been edited by Titanhex: Oct 10 2011, 11:27 AM
Group: +Gold Member
Posts: 1,199
Type: Scripter
RM Skill: Undisclosed
Aliasing is relatively simple, say I have a cat, and I name him fred, then someone else comes along and nick-names him freddie, his original name is fred, but now he has a nickname freddie and I can call him by both. However, freddie is a nickname and is not the real name of my cat, so you can't nickname freddie. In Ruby's terms, you can't alias a def more than once.
You'd need a compatibility rewrite that implemented the two but only had 1 alias.
These should work:
spoiler
This part is fine:
CODE
#============================================================================== # ** Interpreter #------------------------------------------------------------------------------ # This interpreter runs event commands. This class is used within the # Game_System class and the Game_Event class. #==============================================================================
class Game_Interpreter #-------------------------------------------------------------------------- # * Event ID #-------------------------------------------------------------------------- def ev_id # Returns event id return @event_id end end
Replace Vampyr Scene_Title with:
CODE
class Scene_Title < Scene_Base
alias vampyr_sbabs_scenetitle_create_game_objects create_game_objects alias vampyr_sbabs_scenetitle_command_new_game command_new_game
def create_game_objects $game_monsters = [] $game_allies = [] $game_range = [] $game_drop = [] $game_bomb = [] vampyr_sbabs_scenetitle_create_game_objects $Vampyr_SBABS = Vampyr_SBABS.new $util = Utility.new $mgval = [] $mgtype = [] $mgquit = [] for i in 0..100 $mgval[i] = 0 $mgtype[i] = 0 end end
def command_new_game vampyr_sbabs_scenetitle_command_new_game for ally in $game_allies.compact ally.map_id = $data_system.start_map_id ally.moveto($data_system.start_x, $data_system.start_y) ally.move_random end end
end
Replace Vampyr Scene_File with:
CODE
#------------------------------------------------------------------------------ # Scene File #------------------------------------------------------------------------------ class Scene_File < Scene_Base
alias vampyr_sbabs_sfile_do_load do_load alias vampyr_sbabs_sfile_write_save_data write_save_data alias vampyr_sbabs_sfile_read_save_data read_save_data
def do_load vampyr_sbabs_sfile_do_load $game_player.refresh for ally in $game_allies.compact ally.refresh end end
I see. Didn't know you couldn't alias a def more than once.
But there's a problem, when I modify the script this way, I get the same error I've been running when trying to load a newly saved game:
Script 'Vampyr SBABS' line 4858: EOFError occured.
End of file reached.
I save, hit F12, and try to load and this error pops up. This is even when I put the edit mentioned RIGHT into the SBABS demo. (I suggest omitting the line $util = Utility.new so you can go on without a Util class.)
Ah thanks! I was overthinking what could have been the problem with the script edit. I went to bed after posting and was gonna wake up and check my code.
What's odd is the original file I stored this system in doesn't have a double $mgval. Wonder where it could have come from.