The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: PhoenixFire on August 06, 2014, 04:25:50 AM

Title: [Solved] RMX-OS Help
Post by: PhoenixFire on August 06, 2014, 04:25:50 AM
I know some of you wanted something to do, so here's an issue I have for you. I'm trying to get RMX-OS to work with XPAce, and I ran into an issue while rewriting the Main function. It ~looks~ correct, but there's supposedly an issue  ;9



Need some help with this one. I'm in the middle of putting this into XPA, and got an interesting error. I had to modify the Main script, and I think I may have somehow messed it up. The code I'm using is:

Spoiler for:
Code: [Select]
#==============================================================================

# ** Main

#------------------------------------------------------------------------------

#  After defining each class, actual processing begins here.

#==============================================================================

begin
ERROR_LOG_FILE = 'Error.log' # leave empty for no log

def mod_error(error)
  # load scripts
  scripts = load_data('Data/Scripts.rxdata')
  bt = error.backtrace.clone
  # change backtrace display to show script names
  bt.each_index {|i| bt[i] = bt[i].sub(/\ASection(\d+)/) {scripts[$1.to_i][1]} + "\n"}
  # new error message
  message = error.message + "\n" + bt.join('')
  # write to file if file defined
  if ERROR_LOG_FILE != ''
    File.open(ERROR_LOG_FILE, 'a') {|f| f.write("#{Time.now.to_s}:\n#{message}\n")}
end
return message


begin
rgss_main {
  # loading game data
  $data_actors        = load_data('Data/Actors.rxdata')
  $data_classes       = load_data('Data/Classes.rxdata')
  $data_skills        = load_data('Data/Skills.rxdata')
  $data_items         = load_data('Data/Items.rxdata')
  $data_weapons       = load_data('Data/Weapons.rxdata')
  $data_armors        = load_data('Data/Armors.rxdata')
  $data_enemies       = load_data('Data/Enemies.rxdata')
  $data_troops        = load_data('Data/Troops.rxdata')
  $data_states        = load_data('Data/States.rxdata')
  $data_animations    = load_data('Data/Animations.rxdata')
  $data_tilesets      = load_data('Data/Tilesets.rxdata')
  $data_common_events = load_data('Data/CommonEvents.rxdata')
  $data_system        = load_data('Data/System.rxdata')
  # active connection scene
  $scene = Scene_Servers.new
  Graphics.resize_screen(640, 480)
  # Prepare for transition
  Graphics.freeze
  $scene = Scene_Title.new
  # Call main method as long as $scene is effective
  $scene.main while $scene != nil
  Graphics.transition(20)
  # disconnection
  $network.disconnect
}
rescue SyntaxError
  $!.message.sub!($!.message, mod_error($!))
  raise
rescue
  $!.message.sub!($!.message, mod_error($!))
  raise
ensure
  # disconnection
  $network.disconnect
end

And the error I get is:
Spoiler for:
(https://dl.dropboxusercontent.com/u/25886192/rmxoserror.PNG)


I know that there's probably a little bit more to it, so, I've zipped the current project for you to try out.
NOTE: I did in fact get RMX-OS working perfectly with a vanilla install of it. Works great, so I know it's nothing to do with server/client config issues.


Download Zip: Work In Progress (http://rmxpace.com/rmxpace/WIP-XPAce.zip)
Title: Re: RMX-OS Help
Post by: &&&&&&&&&&&&& on August 06, 2014, 05:47:33 AM
add another end to the end
Title: Re: RMX-OS Help
Post by: PhoenixFire on August 06, 2014, 06:08:23 PM
It ended up needing 2 ends added, but now those errors are gone! It now boots up and immediately exits. I assume it's something to do with not having set up anything at all yet in the game, so I doubt it's an actual issue.

But yeah, so, RMX-OS works with XPA!!! wooooo!!!
Title: Re: RMX-OS Help
Post by: Zeriab on August 10, 2014, 08:32:48 AM
This type of issue is easily spotted by having proper indentation. Look :3
Code: [Select]
#==============================================================================
# ** Main
#------------------------------------------------------------------------------
#  After defining each class, actual processing begins here.
#==============================================================================

begin
  ERROR_LOG_FILE = 'Error.log' # leave empty for no log
 
  def mod_error(error)
    # load scripts
    scripts = load_data('Data/Scripts.rxdata')
    bt = error.backtrace.clone
    # change backtrace display to show script names
    bt.each_index {|i| bt[i] = bt[i].sub(/\ASection(\d+)/) {scripts[$1.to_i][1]} + "\n"}
    # new error message
    message = error.message + "\n" + bt.join('')
    # write to file if file defined
    if ERROR_LOG_FILE != ''
      File.open(ERROR_LOG_FILE, 'a') {|f| f.write("#{Time.now.to_s}:\n#{message}\n")}
  end
  return message
 
 
  begin
    rgss_main {
      # loading game data
      $data_actors        = load_data('Data/Actors.rxdata')
      $data_classes       = load_data('Data/Classes.rxdata')
      $data_skills        = load_data('Data/Skills.rxdata')
      $data_items         = load_data('Data/Items.rxdata')
      $data_weapons       = load_data('Data/Weapons.rxdata')
      $data_armors        = load_data('Data/Armors.rxdata')
      $data_enemies       = load_data('Data/Enemies.rxdata')
      $data_troops        = load_data('Data/Troops.rxdata')
      $data_states        = load_data('Data/States.rxdata')
      $data_animations    = load_data('Data/Animations.rxdata')
      $data_tilesets      = load_data('Data/Tilesets.rxdata')
      $data_common_events = load_data('Data/CommonEvents.rxdata')
      $data_system        = load_data('Data/System.rxdata')
      # active connection scene
      $scene = Scene_Servers.new
      Graphics.resize_screen(640, 480)
      # Prepare for transition
      Graphics.freeze
      $scene = Scene_Title.new
      # Call main method as long as $scene is effective
      $scene.main while $scene != nil
      Graphics.transition(20)
      # disconnection
      $network.disconnect
    }
  rescue SyntaxError
    $!.message.sub!($!.message, mod_error($!))
    raise
  rescue
    $!.message.sub!($!.message, mod_error($!))
    raise
  ensure
    # disconnection
    $network.disconnect
  end
Title: Re: [Solved] RMX-OS Help
Post by: Ohjoolly on October 27, 2014, 09:07:27 AM
I read for a better view seems to be good.