Replace all instances of
begin
    statement
end until conditionwith
loop do
  statement
  break if condition
endWatch out for getting the first character with a different syntax i.e. text.slice!(0)
Use this for write_save_data after removing any prior Marshal.dump instances
data = {
    "characters": 		characters,
    "frame_count": 		Graphics.frame_count,
    "$game_system":		$game_system,
    "$game_switches":		$game_switches,
    "$game_variables":		$game_variables,
    "$game_self_switches":	$game_self_switches,
    "$game_screen":		$game_screen,
    "$game_actors":		$game_actors,
    "$game_party":		$game_party,
    "$game_troop":		$game_troop,
    "$game_map":		$game_map,
    "$game_player":		$game_player
}
Marshal.dump(data, file)For load,
data = Marshal.load(file.read)
$game_system        = data[:"$game_system"]
$game_switches      = data[:"$game_switches"]
$game_variables     = data[:"$game_variables"]
$game_self_switches = data[:"$game_self_switches"]
$game_screen        = data[:"$game_screen"]
$game_actors        = data[:"$game_actors"]
$game_party         = data[:"$game_party"]
$game_troop         = data[:"$game_troop"]
$game_map           = data[:"$game_map"]
$game_player        = data[:"$game_player"]and in Window_SaveFile
@characters = data[:"characters"]
@frame_count = data[:"frame_count"]
@game_system = data[:"$game_system"]
@game_switches = data[:"$game_switches"]
@game_variables = data[:"$game_variables"]Avoid. Any calls to super from an aliased method that has been monkey patched will try to call a method with the aliased name.
Use mruby-onig-regexp and mruby-marshal, along with this patch. Make sure cc.defines = %w(MRB_INTEGER_DIVISION) and cxx.defines = %w(MRB_INTEGER_DIVISION) are both present in your build_config.rb
For building with emscripten, you need to take out any main loops. This is done by adding a new method in Main as
$prev_scene = nil
def main_update_loop
  if $scene != nil
    if $scene != $prev_scene
      if $prev_scene != nil
	$prev_scene.dispose
      end
      $scene.main
      $prev_scene = $scene
    end
    # Update game screen
    Graphics.update
    # Update input information
    Input.update
    # Frame update
    $scene.update
  else
    raise "END"
  end
endThen remove any infinite loop in any RGSS scene's main method and add a method dispose to every scene which esentially does everything that is supposed to be done after the loop breaks.