[XP] Versioning for RMX-OS

Started by Blizzard, May 30, 2010, 04:42:57 am

Previous topic - Next topic

Blizzard

May 30, 2010, 04:42:57 am Last Edit: March 23, 2019, 11:32:19 am by Blizzard
Versioning for RMX-OS
Authors: Blizzard
Version: 1.21
Type: RMX-OS Plugin
Key Term: RMX-OS Plugin



Introduction

This script allows you to create updates for your game and is fully integrated into RMX-OS which makes external systems unnecessary.

This script is to be distributed under the same terms and conditions like the scripts it was created for: RMX-OS.


Features


  • allows the definition of update procedures
  • completely integrated into RMX-OS and your game
  • makes external update systems unnecessary



Screenshots

N/A for this sort of script


Demo

N/A


Script

Just make a new script above main and paste this code into it.
Spoiler: ShowHide

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Versioning for RMX-OS by Blizzard
# Version: 1.21
# Type: RMX-OS Add-on
# Date: 30.5.2010
# Date v1.01: 12.9.2010
# Date v1.1: 17.9.2010
# Date v1.2: 12.6.2013
# Date v1.21: 29.7.2014
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#  This script is to be distributed under the same terms and conditions like
#  the script it was created for: RMX-OS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
#   This script must be placed below RMX-OS and requires RMX-OS to work
#   properly. It is able to update the game client connecting to the server to
#   the newest game version.
#   
#   
# Instructions:
#   
#   The server extension validates the game version from the client and if the
#   client game version is lower than the server game version, the server will
#   refuse a connection. Instead the server will notify the client that it is
#   possible to update. After the player has confirmed that he wants to update
#   the client, the server will initiate version updating of the server. For
#   the server to know which files need to be sent, you need to create version
#   log files.
#   
#   
# Version Logs:
#   
#   The version log files on the server have a simple format. Each file is
#   named like "NUMBER.txt" where NUMBER is the version.
#   
#   examples:
#     
#     10.txt - version log for updating from version 9 to 10
#     15.txt - version log for updating from version 14 to 15
#     5475685.txt - version log for updating from version 5475684 to 5475685
#     
#   Version log files have a specific format that allows you to define which
#   files need to be updated. The basic format is:
#     
#     :COMMAND
#     FILES
#   
#   The following commands are at your disposal:
#     
#     file - update a single file
#     dir - update an entire directory with all subdirectories recursively
#     delete - delete a file OR a directory with all subdirectories recursively
#   
#   When using the ":delete" command, the FILES parameter is the name of the
#   file or directory that is affected.
#   When using the ":file" or the ":dir" command, there are 2 FILES parameters.
#   The first is the source file path and the second the destination file path.
#   You can add many files as you want with one single command.
#   
#   example:
#     
#     :file
#     versions/24/Game.rgssad
#     Game.rgssad
#     versions/Fonts.zip
#     fonts/fonts.dat
#     :dir
#     versions/24/BGM
#     Audio/BGM
#     :delete
#     utils/screenshot.dll
#     game.ico
#     artwork
#     :dir
#     versions/24/Audio/ME
#     Audio/ME
#     
#   The example above will do following:
#     
#     1. The file "versions/24/Game.rgssad" from the RMX-OS root directory will
#        be transferred to the client and store in the file "Game.rgssad" in
#        his game's root directory.
#     2. The file "versions/Fonts.zip" from the RMX-OS root directory will be
#        transferred to the client and stored in the file "fonts/fonts.dat" in
#        his game's root directory.
#     3. The directory "versions/24/BGM" and all of its contents (recursively)
#        from the RMX-OS root directory will be transferred to the client and
#        store in the directory "Audio/BGM" in his game's root directory.
#     4. The file or directory "utils/screenshot.dll" will be deleted.
#     5. The file or directory "game.ico" will be deleted.
#     6. The file or directory "artwork" will be deleted.
#     7. The directory "versions/24/Audio/ME" and all of its contents
#        (recursively) from the RMX-OS root directory will be transferred to
#        the client and stored in the directory "Audio/ME" in his game's root
#        directory.
#   
#   
# Notes:
#   
#   - There is no syntax checking or other verification of your version log
#     files. It is recommended not to use batch processing with one command but
#     use a command for every single file or directory.
#     
#     example:
#     
#       Instead of this type of writing:
#       
#       :file
#       versions/24/Game.rgssad
#       Game.rgssad
#       versions/Fonts.zip
#       fonts/fonts.dat
#     
#       use this type of writing:
#       
#       :file
#       versions/24/Game.rgssad
#       Game.rgssad
#       :file
#       versions/Fonts.zip
#       fonts/fonts.dat
#       
#   - The constant INTERNAL_VERSION is independent from RMXOS::GAME_VERSION,
#     keep that in mind.
#   - Make sure to update the client scripts each time because you need to
#     update the constant INTERNAL_VERSION in the configuration of this script to
#     make sure the client knows it's up to date. Either update Scripts.rxdata
#     or update Game.rgssad where Scripts.rxdata is contained.
#   - Update is done only all at once. First all files are downloaded into a
#     temporary directory. After a successful download of ALL files, first the
#     files and directories that need to be delete are deleted, then the
#     downloaded files are moved into the actual game's directory and are
#     updated.
#   - Multiple version updates work one after another and are all done at once.
#     If one version update fails for some reason, the previous updates will
#     not be lost.
#   - It is recommended to keep version updates small. Big updates are more
#     likely to break. You can simply split an update into several updates if
#     it's too big.
#   
#   
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

if !defined?(RMXOS) || RMXOS::VERSION < 2.0
  raise 'ERROR: The "Versioning" requires RMX-OS 2.0 or higher.'
end

$rmxos_versioning = 1.21

#==============================================================================
# module RMXOS
#==============================================================================

module RMXOS
 
  CONNECTION_VERSION_MISMATCH = 1034
  UPDATING_END                = 1035
 
  #============================================================================
  # module RMXOS::Options
  #============================================================================

  module Options
 
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    # START Configuration
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
    INTERNAL_VERSION = 1 # internal version number, use integers only
    EXECUTABLE = 'Game.exe' # game executable (usually Game.exe)

    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    # END Configuration
    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
  end
 
  #============================================================================
  # module RMXOS::Data
  #============================================================================
 
  module Data
   
    AnswerNo      = 'No'
    AnswerYes     = 'Yes'
    UpdatingNow   = 'Updating now. This may take a while.'
    UpdatePrompt  = 'Your client needs to be updated. Continue?'
    UpdateRestart = 'Update finished. If the game does not restart automatically, please restart it manually.'
   
    TempDir = ENV['TEMP'].gsub('\\', '/') + '/RMXP_update' # system temp folder
    # don't change this
    TempDir += '/' + Options::INTERNAL_VERSION.to_s
   
  end

  #============================================================================
  # RMXOS::Network
  #============================================================================

  class Network
   
    def request_connection
      self.send('CON', RMXOS::VERSION, RMXOS::Options::GAME_VERSION, RMXOS::Options::INTERNAL_VERSION)
    end
   
    def request_update
      if FileTest.exist?(RMXOS::Data::TempDir)
        Dir.clear(RMXOS::Data::TempDir)
      else
        Dir.mkdirs(RMXOS::Data::TempDir)
      end
      @delete_queue = []
      self.send('UPDT', RMXOS::Options::INTERNAL_VERSION)
    end
   
    alias check_connection_versioning_later check_connection
    def check_connection(message)
      case message
      when /\VFAIL\Z/ # game version mismatch
        @messages.push(CONNECTION_VERSION_MISMATCH)
        return true
      when /\AMKDIR\t(.+)/ # make directory
        Dir.mkdirs("#{RMXOS::Data::TempDir}/#{$1}")
        return true
      when /\AFILE\t(.+)\t(.+)/ # copy file
        path = "#{RMXOS::Data::TempDir}/#{$1}"
        Dir.create_path(path)
        data = eval($2)
        file = File.open(path, 'wb')
        file.write(data)
        file.close
        return true
      when /\AFILE\t(.+)/ # copy empty file
        path = "#{RMXOS::Data::TempDir}/#{$1}"
        Dir.create_path(path)
        file = File.open(path, 'wb')
        file.close
      when /\AFILC\t(.+)\t(.+)/ # append to file (in case of big files)
        path = "#{RMXOS::Data::TempDir}/#{$1}"
        Dir.create_path(path)
        data = eval($2)
        file = File.open(path, 'ab')
        file.write(data)
        file.close
        return true
      when /\ADELE\t(.+)/ # delete directory / file
        @delete_queue.push($1)
        return true
      when /\AUEND\Z/ # updating end
        Dir.clear(RMXOS::Data::TempDir)
        Dir.rmdirs(RMXOS::Data::TempDir)
        @messages.push(UPDATING_END)
        return true
      when /\AUNEX\Z/ # execute update
        @delete_queue.each {|filename|
            if FileTest.directory?(filename)
              Dir.clear(filename)
              Dir.rmdirs(filename)
            else
              File.delete(filename) rescue nil
            end
            Graphics.update}
        Dir.copy(RMXOS::Data::TempDir, '.')
        Dir.clear(RMXOS::Data::TempDir)
        @delete_queue = []
        return true
      end
      return check_connection_versioning_later(message)
    end
   
  end
 
end

#==============================================================================
# Dir
#==============================================================================

class Dir
 
  def self.clear(source)
    dirs = [source]
    while dirs.size > 0
      dir = dirs.shift
      dirs += self.clear_non_recursive(dir)
    end
  end
 
  def self.clear_non_recursive(source)
    dirs = []
    Dir.foreach(source) {|name|
        if name != '.' && name != '..'
          filename = "#{source}/#{name}"
          if FileTest.directory?(filename)
            dirs.push(filename)
          elsif FileTest.file?(filename)
            File.delete(filename) rescue nil
          end
        end}
    return dirs
  end
 
  def self.copy(source, destination)
    dirs = [[source, destination]]
    while dirs.size > 0
      dir = dirs.shift
      Dir.mkdirs(dir[1]) if !FileTest.exist?(dir[1])
      dirs += self.copy_non_recursive(dir[0], dir[1])
    end
  end
 
  def self.copy_non_recursive(source, destination)
    dirs = []
    Dir.foreach(source) {|name|
        if name != '.' && name != '..'
          filename = "#{source}/#{name}"
          target = "#{destination}/#{name}"
          if FileTest.directory?(filename)
            dirs.push([filename, target])
          elsif FileTest.file?(filename)
            File.copy(filename, target) rescue nil
          end
        end}
    return dirs
  end
 
  def self.create_path(source)
    dirs = source.split('/')
    dirs.pop
    Dir.mkdirs(dirs.join('/')) if dirs.size > 0
  end
 
  def self.mkdirs(source)
    dirs = source.split('/')
    path = dirs.shift
    loop do
      Dir.mkdir(path) rescue nil if !FileTest.exist?(path)
      break if dirs.size == 0
      path += '/' + dirs.shift
    end
  end
 
  def self.rmdirs(source)
    all_dirs = [source]
    dirs = [source]
    while dirs.size > 0
      dir = dirs.shift
      new_dirs = self.get_subdirs(dir)
      dirs += new_dirs
      all_dirs += new_dirs
    end
    all_dirs.sort.reverse.each {|dir| Dir.rmdir(dir) rescue nil}
  end
 
  def self.get_subdirs(source)
    dirs = []
    Dir.foreach(source) {|name|
        if name != '.' && name != '..'
          filename = "#{source}/#{name}"
          dirs.push(filename) if FileTest.directory?(filename)
        end}
    return dirs
  end
 
end

#==============================================================================
# File
#==============================================================================

class File

  def self.copy(source, destination)
    file = File.open(source, 'rb')
    data = file.read
    file.close
    file = File.open(destination, 'wb')
    file.write(data)
    file.close
    Graphics.update # prevent script is hanging error
  end
 
end

#==============================================================================
# Window_Dialog
#==============================================================================

class Window_Dialog < Window_Command
 
  def initialize(width, commands = ['Yes', 'No'], caption = 'Are you sure?')
    commands.push('')
    @caption = caption
    @cursor_width = 32
    super(width, commands)
    if $fontface != nil
      self.contents.font.name = $fontface
      self.contents.font.size = $fontsize
    elsif $defaultfonttype != nil
      self.contents.font.name = $defaultfonttype
      self.contents.font.size = $defaultfontsize
    end
    self.x, self.y, self.z = 320 - self.width/2, 240 - self.height/2, 1500
    @item_max, self.opacity = commands.size-1, 192
    commands.each {|c|
        w = self.contents.text_size(c).width
        @cursor_width = w if @cursor_width < w}
    @cursor_width += 32
    refresh
    update_cursor_rect
  end
 
  def refresh
    super
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, self.width-40, 32, @caption, 1)
  end
 
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(4, 32 * (index+1), self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index], 1)
  end
 
  def update_cursor_rect
    if @index < 0 || @item_max == 0
      self.cursor_rect.empty
    else
      x = (self.contents.width - @cursor_width) / 2
      self.cursor_rect.set(x, (@index+1)*32, @cursor_width, 32)
    end
  end
 
end

#==============================================================================
# Scene_Servers
#==============================================================================

class Scene_Servers
 
  alias update_versioning_later update
  def update
    if @dialog_window == nil
      update_versioning_later
      if @wait_count == 0 && @update_mode
        @update_mode = nil
        @help_window.set_text(@helptext)
        Dir.clear(RMXOS::Data::TempDir)
        Dir.rmdirs(RMXOS::Data::TempDir)
      end
    else
      @dialog_window.update
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        @dialog_window.dispose
        @dialog_window = nil
      elsif Input.trigger?(Input::C)
        $game_system.se_play($data_system.decision_se)
        if @dialog_window.index == 0
          @help_window.set_text(RMXOS::Data::UpdatingNow)
          @wait_count = RMXOS::Options::SERVER_TIMEOUT * 2
          $network.request_update
          @update_mode = true
        end
        @dialog_window.dispose
        @dialog_window = nil
      end
    end
  end
 
  alias waiting_for_server_versioning_later waiting_for_server
  def waiting_for_server
    waiting_for_server_versioning_later
    $network.messages.each {|message|
        case message
        when RMXOS::CONNECTION_VERSION_MISMATCH # version mismatch
          @dialog_window = Window_Dialog.new(416, [RMXOS::Data::AnswerYes,
              RMXOS::Data::AnswerNo], RMXOS::Data::UpdatePrompt)
          refresh_server_states
          @refresh_count = RMXOS::Options::SERVER_REFRESH
          return false
        when RMXOS::UPDATING_END # updating done
          @update_mode = false
          p RMXOS::Data::UpdateRestart
          Thread.new {system(RMXOS::Options::EXECUTABLE)}
          exit
          return false
        end}
    return true
  end
 
end


Make a new file with an .rb extension in the Extensions folder of RMX-OS and copy-paste this script into it.
Spoiler: ShowHide
module RMXOS
 
  def self.load_current_extension
    return Versioning
  end
 
end

#======================================================================
# module Versioning
#======================================================================

module Versioning

  VERSION = 1.21
  RMXOS_VERSION = 2.0
  SERVER_THREAD = false
 
  # START Configuration
  INTERNAL_VERSION = 2 # game version
  VERSION_LOG_PATH = 'Extensions' # where are the version log files located
  CHUNK_MAX_SIZE = 5000 # maximum number of bytes transferred at once
  # END Configuration
 
  def self.initialize
    @mutex = Mutex.new
  end
 
  def self.mutex
    return @mutex
  end
 
  def self.main
    while RMXOS.server.running
      @mutex.synchronize {
        self.server_update
      }
      sleep(0.1)
    end
  end
 
  def self.server_update
  end
 
  def self.client_update(client)
    case client.message
    when /\ACON\t(.+)\t(.+)\t(.+)/ # connection request
      version = $3.to_i
      if version < INTERNAL_VERSION
        client.send('VFAIL')
        return true
      end
      client.message = RMXOS.make_message('CON', $1, $2)
      return false
    when /\AUPDT\t(.+)/ # update request
      version = $1.to_i
      while version < INTERNAL_VERSION
        version += 1
        file = File.open("#{VERSION_LOG_PATH}/#{version}.txt", 'rb')
        lines = file.readlines
        file.close
        lines.each {|line|
          line.gsub!("\r") {''}
          line.gsub!("\n") {''}}
        self.parse_version(client, lines)
        client.send('UNEX')
      end
      client.send('UEND')
      return true
    end
    return false
  end
 
  def self.parse_version(client, lines)
    command = ''
    while lines.size > 0
      current = lines.shift
      next if current.size == 0
      if current[0, 1] == ':'
        command = current
      else
        case command
        when ':file'
          self.send_file(client, current, lines.shift)
        when ':dir'
          self.send_dir(client, current, lines.shift)
        when ':delete'
          client.send('DELE', current)
        end
      end
    end
  end
 
  def self.send_file(client, source, destination)
    file = File.open(source, 'rb')
    data = file.read
    file.close
    if data.size <= CHUNK_MAX_SIZE
      rawdata = data.inspect
      client.send('FILE', destination, rawdata)
    else
      client.send('FILE', destination)
      while data.size > CHUNK_MAX_SIZE
        current = data[0, CHUNK_MAX_SIZE].inspect
        data = data[CHUNK_MAX_SIZE, data.size - CHUNK_MAX_SIZE]
        client.send('FILC', destination, current)
      end
      rawdata = data.inspect
      client.send('FILC', destination, rawdata)
    end
  end
 
  def self.send_dir(client, source, destination)
    client.send('MKDIR', destination)
    Dir.foreach(source) {|name|
      if name != '.' && name != '..'
        filename = "#{source}/#{name}"
        if FileTest.directory?(filename)
          self.send_dir(client, filename, "#{destination}/#{name}")
        elsif FileTest.file?(filename)
          self.send_file(client, filename, "#{destination}/#{name}")
        end
      end
    }
  end
 
end




Instructions

In the script in the first comment.


Compatibility

Requires RMX-OS to work.


Credits and Thanks


  • Boris "Blizzard" Mikić



Author's Notes

Remember to activate the server extension by adding the server extension filename to the list in the configuration.

If you find any bugs, please report them here:
http://forum.chaos-project.com

That's it! N-Joy! =D
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

AliveDrive

Quote from: Blizzard on September 09, 2011, 02:26:33 am
The permanent solution for your problem would be to stop hanging out with stupid people.

Blizzard

As I said, I will release it later. Now it is "later". xD
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

SBR*

Oh yeah! Now the only thing left to do is making MySQL work again :'(... It keeps on giving me errors that say "Host 'localhost' is not allowed to connect to the server". I tried searching it on google, but it didn't work. I'm now trying to FULLY delete it...

Wizered67

May 30, 2010, 11:44:13 am #4 Last Edit: May 30, 2010, 06:35:21 pm by Wizered67
I'm slightly confused on this (sorry for being noobish)
So in the RMX-OS folder that we downloaded do we put in the game and rename it "versions/2/Game"? If so, my computer won't let me rename things with "/"......


Nevermind, I think I get it....



Edit: Now I'm having more problems. At first, it showed that there was no "2.txt" so I tried restarting the server. Now it doesn't seem to do this anymore, but it now says "You have been disconected" and gives this error in the error logs.....

Spoiler: ShowHide
Quoteundefined method `gsub!' for nil:NilClass
./Extensions/AU.rb:54:in `block in client_update'
C:/Users/Brian/Desktop/RMX-OS 1.14/RMX-OS Server/Extensions/AU.rb:54:in `each'
C:/Users/Brian/Desktop/RMX-OS 1.14/RMX-OS Server/Extensions/AU.rb:54:in `client_update'
C:/Users/Brian/Desktop/RMX-OS 1.14/RMX-OS Server/Data/Client.rb:43:in `block in handle'
C:/Users/Brian/Desktop/RMX-OS 1.14/RMX-OS Server/Data/Client.rb:43:in `each_value'
C:/Users/Brian/Desktop/RMX-OS 1.14/RMX-OS Server/Data/Client.rb:43:in `handle'
C:/Users/Brian/Desktop/RMX-OS 1.14/RMX-OS Server/Data/Server.rb:275:in `block in run'
2010-05-30 15:45:55 UTC; -1 () - Error:


edit: Are you sure syntax is the problem, because I get this error even when I just copy one of the examples for the comments in the script

Blizzard

Quote from: Blizzard on May 30, 2010, 04:42:57 am
# Notes:
#   
#   - There is no syntax checking or other verification of your version log
#     files. It is recommended not to use batch processing with one command but
#     use a command for every single file or directory.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

I thought you were retired >___>

Anyways nice job!

Blizzard

May 31, 2010, 02:46:35 am #7 Last Edit: May 31, 2010, 02:55:21 am by Blizzard
I promised to post this before I retired. Since I couldn't post it months ago, I've posted it now. Think of it as a script that traveled through  time into the future. :V:
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

tipsta

June 05, 2010, 07:00:50 am #8 Last Edit: June 05, 2010, 07:17:11 am by tipsta
Well,
Its a great idea, but im having trouble getting it to work.

Currently im getting this error,

undefined method `gsub!' for nil:NilClass
./Extensions/(RMX-OS) Version.rb:54:in `block in client_update'
C:/Documents and Settings/Owner/Desktop/Project/Server/Extensions/(RMX-OS) Version.rb:54:in `each'
C:/Documents and Settings/Owner/Desktop/Project/Server/Extensions/(RMX-OS) Version.rb:54:in `client_update'
C:/Documents and Settings/Owner/Desktop/Project/Server/Data/Client.rb:43:in `block in handle'
C:/Documents and Settings/Owner/Desktop/Project/Server/Data/Client.rb:43:in `each_value'
C:/Documents and Settings/Owner/Desktop/Project/Server/Data/Client.rb:43:in `handle'
C:/Documents and Settings/Owner/Desktop/Project/Server/Data/Server.rb:275:in `block in run'


And my version file looks like,

:file
v/Scripts.rgssad
Scripts.rgssad


Not sure if i have done something wrong, or if its the script itself.

Also,
Would it be possible to set this up so the server directs the clients to download the file from a web server?
So basically,

Client connects
Server tells client it needs to be updated
Client Accepts
Server reads update file and tells client to download from "http://url.of.updates.com/updates/*number/*file.*";
Client downloads from "http://url.of.updates.com/updates/*number/*file.*";


I think it would be better than downloading the updates from the server.

Yours,
Tipsta

Blizzard

Quote from: tipsta on June 05, 2010, 07:00:50 am
Well,
Its a great idea, but im having trouble getting it to work.

Currently im getting this error,

undefined method `gsub!' for nil:NilClass
./Extensions/(RMX-OS) Version.rb:54:in `block in client_update'
C:/Documents and Settings/Owner/Desktop/Project/Server/Extensions/(RMX-OS) Version.rb:54:in `each'
C:/Documents and Settings/Owner/Desktop/Project/Server/Extensions/(RMX-OS) Version.rb:54:in `client_update'
C:/Documents and Settings/Owner/Desktop/Project/Server/Data/Client.rb:43:in `block in handle'
C:/Documents and Settings/Owner/Desktop/Project/Server/Data/Client.rb:43:in `each_value'
C:/Documents and Settings/Owner/Desktop/Project/Server/Data/Client.rb:43:in `handle'
C:/Documents and Settings/Owner/Desktop/Project/Server/Data/Server.rb:275:in `block in run'


And my version file looks like,

:file
v/Scripts.rgssad
Scripts.rgssad


Not sure if i have done something wrong, or if its the script itself.


If you are getting that error, then you haven't set it up right or put your files in the right folder.

Quote from: tipsta on June 05, 2010, 07:00:50 am
Also,
Would it be possible to set this up so the server directs the clients to download the file from a web server?
So basically,

Client connects
Server tells client it needs to be updated
Client Accepts
Server reads update file and tells client to download from "http://url.of.updates.com/updates/*number/*file.*";
Client downloads from "http://url.of.updates.com/updates/*number/*file.*";


I think it would be better than downloading the updates from the server.


This is not a download system, this is an updating system. It uses the connection to the game server to update the game.
If you want a system that downloads files, get one.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

tipsta

Well, i don't think i set it up wrong because if i leave my update file (2.txt) empty it works until it throws the error, "Unable to find temp dir"

Blizzard

I think your operating system is messed up. The script uses the temporary folder of the operating system and when you are getting that error, then it's possible that you TEMP environment variable doesn't exist.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Wizered67

Yes!!!!!! I finnally figured out why I was getting that error before! It was all because I had listed my extensions in the wrong order!

Anyway, now that thats over, it gives an error saying
No such file or directory -C:/Users/ME/AppData/Local/Temp/RMXP_update


So do I have to go in and MAKE this folder and put the updates in there? Please can you help me. I'm hopelessly lost!

Blizzard

No, the script automatically makes those folders that you need.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Wizered67

So then how come it's giving me this error?
What can I do to fix it?

Blizzard

Well, obviously the folders aren't created. To which folder does the path exist?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Wizered67

I'm not completely sure I understand your question, but if I know it right then:
I have the AppData folder, then local, then temp, just not the RMXP_Update folder.

Blizzard

I'll remember to check that then. The game should create the RMPX_update folder.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Wizered67

Thanks Blizzard. I appreciate you looking into it even though you're retired.

G_G

Quote from: Wizered67 on June 25, 2010, 11:31:21 am
Thanks Blizzard. I appreciate you looking into it even though you're retired.


*whispers* Dont remind him! He may remember then not fix it :V*whispers*

Wizered67

Are you still looking into my problem? Sorry, but its been a while since there has been a response on this thread......

Blizzard

I got a new laptop just a week ago, I haven't looked into it yet. I'll see if I can go it today or tomorrow.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

I can't seem to get this script to work. I placed it in the right spot. I just don't understand how to get it to update, I make a new .txt file called 2, and it doesn't do anything.

Blizzard

Have you added any commands in that file? Have you changed the version on the server extension? Have you changed the version on the client?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

where do I save the 2.txt file? that may be one problem I am having

Blizzard

Wherever you specify it in the script. That's what the constant VERSION_LOG_PATH is for. It defines the relative path from wherever the server is running.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

So I have it in a folder located at Extensions\Updates\2.txt, and I changed the VERSION_LOG_PATH to Extensions\Updates, but it still won't update :/

Blizzard

Make sure you use \\ because \ is the escape character in strings. Best you just used /, that one works just fine on Windows operating systems.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

August 03, 2010, 11:01:36 pm #28 Last Edit: August 03, 2010, 11:16:49 pm by Trider250
ok ,I did that. I have a question though.
if my scripts are located at C:\Users\WindowsUser\Desktop\RMX-OS Client\Data\Scripts.rxdata
how would I make a .txt file?

:file
C:/Users/WindowsUser/Desktop/RMX-OS Client/Data/Scripts.rxdata

and thats it?

oh and I get this error when I try to update

A client at 2010-08-04 03:14:42 UTC has caused an error:
undefined method `gsub!' for nil:NilClass
./Extensions/Updates.rb:54:in `block in client_update'
C:/Users/WindowsUser/Desktop/RMX-OS Server/Extensions/Updates.rb:54:in `each'
C:/Users/WindowsUser/Desktop/RMX-OS Server/Extensions/Updates.rb:54:in `client_update'

C:/Users/WindowsUser/Desktop/RMX-OS Server/Data/Client.rb:43:in `block in handle'
C:/Users/WindowsUser/Desktop/RMX-OS Server/Data/Client.rb:43:in `each_value'
C:/Users/WindowsUser/Desktop/RMX-OS Server/Data/Client.rb:43:in `handle'
C:/Users/WindowsUser/Desktop/RMX-OS Server/Data/Server.rb:275:in `block in run'

Blizzard

The text file is not the file that is transfered, it contains a list of files that should be transfered for the update from the previous version to the version specified by the number in the file name.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

ok, I understand. But what does this error mean?

A client at 2010-08-04 03:14:42 UTC has caused an error:
undefined method `gsub!' for nil:NilClass
./Extensions/Updates.rb:54:in `block in client_update'
C:/Users/WindowsUser/Desktop/RMX-OS Server/Extensions/Updates.rb:54:in `each'
C:/Users/WindowsUser/Desktop/RMX-OS Server/Extensions/Updates.rb:54:in `client_update'

C:/Users/WindowsUser/Desktop/RMX-OS Server/Data/Client.rb:43:in `block in handle'
C:/Users/WindowsUser/Desktop/RMX-OS Server/Data/Client.rb:43:in `each_value'
C:/Users/WindowsUser/Desktop/RMX-OS Server/Data/Client.rb:43:in `handle'
C:/Users/WindowsUser/Desktop/RMX-OS Server/Data/Server.rb:275:in `block in run'

Blizzard

August 04, 2010, 06:00:57 pm #31 Last Edit: August 04, 2010, 06:02:06 pm by Blizzard
It means that no line could be read because the file was not found at the location that you specified. Or you left the update specification file empty. I think the latter should apply because if the path was incorrect, it should have crashed a few lines before.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250


Blizzard

Are you sure you are running the game with proper permissions? Because that seems to me that Windows is not letting you access the system temp folder.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

I ran as administrator and it still pops up... Should I create the Directory manually? But what about other users? :/

Blizzard

It was always working fine for me on XP.

If you want, you can change the directory for the temp folder in the script. There should be a piece of code saying ENV['TEMP'] or ENV['TEMP'] + '/'. Just change it to ''. This will put the temporary folder into the game's folder. But that probably isn't so safe either because usually on Vista/7 programs aren't supposed to write into their folder in Program Files. But as I said, you can try.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

you were right, still no good. :/

G_G


Trider250

August 04, 2010, 09:05:11 pm #38 Last Edit: August 05, 2010, 04:57:03 am by Blizzard
ok, I'll try turning off UAC

EDIT: turned of UAC and it still did not work

Blizzard

Please don't doublepost. Use the Modify button instead.

Well, then I don't really know. Somebody posted the same problem in the topic and I haven't really been able to look into it yet. I'm not sure what's the cause either. :/
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250


Blizzard

It's explained in the instructions.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ForeverZer0

Quote from: Blizzard on September 08, 2010, 02:52:16 pm
It's explained in the instructions.


You should just make that an auto-reply to this thread.  :)
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Blizzard

Possibly a good idea. xD Sure, there is no demo, but I explained it really thoroughly in the instructions how to use it, how to set up where the files are located and how it works. :/ If people don't understand relative folder paths (which is, honestly, a very basic thing today), they won't be able to use this. "." means current folder and ".." means parent folder. Folders are separated with "/" characters and that's already it. :/ I really don't understand why it is so hard to get it.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

too bad this won't work with windows 7 -.- or my computer just doesn't like me.

Blizzard

I am able to run it on Windows 7 x64 without problems.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

mine is 32-bit so maybe that is why it won't create the folder

Ryex

that would make absolutely no difference. have the game run as administrator. that should fix the problem
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

September 12, 2010, 04:04:04 am #48 Last Edit: September 12, 2010, 09:34:17 am by Blizzard
As I already said, when you run your client, it does not have the permission to write on your harddisk.

EDIT: My bad, that problem happens when you don't configure the version log file properly.

Anyway, I updated the script a small change. It might help you with the problem.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

September 12, 2010, 09:11:36 pm #49 Last Edit: September 12, 2010, 09:18:54 pm by Trider250
:DDDD Thanks you sooo much, that fixed the creation of the tmp folder. It works now :)

EDIT:

Quick Question though, where do we put the files that we want to be update, because I get the error that Data/Map001.rxdata does not exist

Blizzard

Wherever you want. You just need to specify where it is in the extension relatively from the folder where RMX-OS.rb is located.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

jrbault

AAARRRGGHHH!!!! I dont know what i'm doing wrong.
my version log looks like this

:file
updates/version2/Data/Actors.rxdata
Actors.rxdata

I created a folder in my rmx-os server folder called updates. In the folder i put another named version2, that has all the files for second "edition" of my game. but i keep getting this error.

Spoiler: ShowHide
H:/Documents and Settings/Jeremy/Desktop/RMX-OS Server/Data/Server.rb:275:in `block in run'
2010-09-13 09:59:23 UTC; -1 () - Error:
No such file or directory -  updates/version2/Data/Actors.rxdata
./Extensions/updater.rb:87:in `initialize'

Blizzard

Are you sure that the file is there? Also, your target location should be Data/Actors.rxdata, not Actors.rxdata.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

jrbault

K updated the log file

and this is my path directory for the actors data

H:\Documents and Settings\Jeremy\Desktop\RMX-OS Server\updates\version2\Data

Blizzard

Wait a moment, do you have a space before the filename? It seems to me that the first folder is called " updates" rather than "updates".
I just tested it and it works fine for me.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

jrbault

you sir are awesome and i feel kinda retarded. Sorry for all the trouble. thanks again

Blizzard

Lol! Good that I took a really, really good look at the update definition you posted. xD
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

September 13, 2010, 07:47:35 pm #57 Last Edit: September 13, 2010, 07:52:00 pm by Trider250
dang it, I thought it was fixed, but now I get the error that there is no such file or directory for the RMXP_update folder


and the weirdest part is that I decided to manually put the folder in there, and I get the same error because it deletes the folder :/

Wizered67

I am so close to getting this to work its not even funny. The probelm I'm having now is that whenever I try to update it, it says thats its updating for a while, and then says that scripts.rxdata could not be found. In the script, it mentions that you need to update scripts.rxdata OR game.rgssad which is what I'm updating. I'd really appreciate if you could help me get this to work.
:'(

jrbault

whenever i run my game it gives me the updating message but when its done it pops this up and kicks me off.
Spoiler: ShowHide


The next time i start my game though it starts fine and it has been updated. so its more of an annoyance then a problem.

Blizzard

September 17, 2010, 04:27:19 pm #60 Last Edit: September 17, 2010, 05:16:15 pm by Blizzard
That's weird. I think you don't have administrative rights on your PC or something because that should be deleting the temporary files. Anyway, I'll edit the script so it handles that a bit better.

EDIT: Ok, try now.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

hmmm, So now it says "update finished and if game doesn't start automatically then restart it", so It restarts automatically but it still says I have to update again afterwards.  :???:

Blizzard

September 18, 2010, 04:01:50 pm #62 Last Edit: September 18, 2010, 04:04:30 pm by Blizzard
You didn't update your files properly. If the server is set to version 5 and the client is set to version 4, then you have to replace the Game.rgssad that has been compiled with scripts (or the Scripts.rxdata if your game is unencrypted) that has the new client version defined (which would be 5 in this particular example). Then, when the game is restarted, it will use the new scripts that have the version defined as 5 and the client won't have to be updated "again".
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

September 18, 2010, 08:23:17 pm #63 Last Edit: September 18, 2010, 09:06:59 pm by Trider250
oh kk, i'll try it

EDIT:ok I did that, but it keeps getting closed by the 'remote host'

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

jrbault

ok yet another quick question.  This list time i tried updating it gave me the updating message and then after about a minute it says the server didn't  respond.  Are my updates to large?

Blizzard

I'm not sure, I can't reproduce the problem.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Trider250

yeah The error I get on the client is 'server won't respond' I have the same problem as him lol

Blizzard

I'll take a look at it then. I had no problems with it.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

BeAddicted

Whenever I want to connect to the server I become this error "error! Your client is out of date! Client Version: 1.15; Server Version: 1.15"
When I dont use versioning it works normal.

Blizzard

Quote from: Blizzard on September 18, 2010, 04:01:50 pm
You didn't update your files properly. If the server is set to version 5 and the client is set to version 4, then you have to replace the Game.rgssad that has been compiled with scripts (or the Scripts.rxdata if your game is unencrypted) that has the new client version defined (which would be 5 in this particular example). Then, when the game is restarted, it will use the new scripts that have the version defined as 5 and the client won't have to be updated "again".
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

BeAddicted


Blizzard

Weird. Try changing the version on both client and server to 1.16. It's possible that it's literally a computation error (so-called floating point precision error, you can look it up if you are interested).
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

BeAddicted

Ok I'm silly^^ when I start the server there stands no extensions found,
but I don't know why. I've made a new rb-file in the extensions folder and copied the script into it

Blizzard

You didn't define in the configuration file which extensions to use. (Also, change back the versions, that obviously wasn't the problem you were having.)
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

kanade

okaaay... my problem is ... i have a file what is big (177kb ... Scripts.rxdata) ^^ what do u mean with split the file / in the comments on the script?

sry for bad english ... me from switzerland ^^

- kanade-chan

[Luke]

Okay, I haven't read the code, but I bet that Scripts.rxdata is one of the files that you definitely CANNOT update through a script. You know, Versioning is a script, so it's inside that file. But what do I know :p

Blizzard

Actually you can. All scripts are read and loaded upon start up and you can delete or edit the original file without problems. But you have to make sure that the new file works right when you put it up for updating. If you don't set up the new file properly, it will either keep trying to update the scripts or not work at all.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Wizered67

February 20, 2011, 01:55:46 pm #78 Last Edit: February 20, 2011, 01:58:54 pm by Wizered67
After all this time of not realizing my mistake, I've finally figured out what I was doing wrong! Now I think the script should work. Basically my problem now is that my Game.rgssad is too big for the updater and it crashes with "Server has Disconnected". Is there any way for me to make it smaller? Thanks in advance.

edit: The error the server gives is:

An operation was attempted on something that wasn't a socket. In sender line 21. I'm assuming that this is because my update was too big, but I could be wrong.

Blizzard

If the client gets disconnected during the transfer, then yes, this can be the cause of the problem.
You can split up the RGSSAD archive if you don't add the graphic files when you create it. Keep in mind that it would be a good idea to have an alternate encryption for the graphic files then.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Wizered67

February 20, 2011, 02:11:55 pm #80 Last Edit: February 20, 2011, 02:21:56 pm by Wizered67
Good idea. I'll try it and hopefully it will help.
edit: I tried not adding graphics and audio, but I still get the same error. The Game.rgssad size is 1.49 MB. I'm not sure if this is too big. Also, if it makes a difference, the client error was actually server did not respons, not the disconnection.

Blizzard

I have had a problem with transfer of large files earlier, but I solved that problem a long time ago. I have no problem transferring a file of 60 MB. :/
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Wizered67

That's weird.....I'll check if I'm doing soemthing wrong.

Vaelen

Hi short question. I can update in my Lan without any problems. Now a friend tested it (normaly we work with svn) and he can't update. Always a error with Server did not respond. Normal connection works fine.

maybe you know the problem.. or do I need a other port forwarded?
thx blizz for the great work (I don't have to do) ;)
RMX-OS gonna be legen.... wait-for-it... www.youtube.com/watch?v=Dqf1BmN4Dag

Blizzard

Did you install both client plugin and server extension properly? Is the plugin below the RMX-OS script? Does the RMX-OS server tell you that it has successfully loaded the server extension?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Vaelen

The Plugin is below the RMX-OS script and above the main.
The Extension is loaded and like i said it works fine for me.. but not for my friends.
I tried it in a virtual box and it works fine too.. so I don't have any idea why it doesn't work outsite..

One thing is, I can only connect through local ip adresses (192.168..) or over loopback (127..)  if I try to connect over my outside IP (wich is shown as online) I can't connect, my friends can. But I think that behaviour is normal. But with this I can reconstruct the error message. .. but that doesn't help very much why every one can connect to my server but the update don't work..
thx blizz for the great work (I don't have to do) ;)
RMX-OS gonna be legen.... wait-for-it... www.youtube.com/watch?v=Dqf1BmN4Dag

Blizzard

Well, the only thing that's left is that you should check once more time if the proper port has been forwarded. :/
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Vaelen

54629 in the settings of the server and port forwarded.. .. hmm  ok maybe its his firewall or UAC..  I will try with several other friends.. maybe it will work someday on a root server
thx blizz for the great work (I don't have to do) ;)
RMX-OS gonna be legen.... wait-for-it... www.youtube.com/watch?v=Dqf1BmN4Dag

mroedesigns

July 18, 2011, 02:53:45 am #88 Last Edit: July 18, 2011, 02:55:55 am by mroedesigns
Having a problem getting this to update correctly. It recognizes it needs an update, but disconnects when it tries. I'm updating game.exe, so that might be why, but it's also throwing an error saying the directory doesn't exist when it does. The 'Version' folder is in the RMX-OS Server folder, and I changed the path in the extension to Version from Extensions.

Spoiler: ShowHide


and here's what 2.txt says, located in the Version folder.
:file
   Version/2/Game.exe
   Game.exe

G_G

The client itself is trying to open "/Version/2/Game.exe" thats clear. Maybe it has something to do with trying to overwrite Game.exe, which it can't since Game.exe is the one processing everything and since its open, it very well can't be replaced can it?

mroedesigns

Well I tried it with Version/2/Data/Scripts.rxdata and it's giving me the same error. Client side it tries to update, says is updating, and then says you've been disconnected from the server. And the server is showing the same error as below.

I'm thinking I've got the relative directory wrong? It was just 'Extensions' so I changed it to 'Version' and put everything in that folder (2.txt and the folder '2' (with 2/Data/Scripts.rxdata)

Blizzard

It should be working like that. O_o
Try removing "Version/" after ":file". I don't think it will work, but try it anyway.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

mroedesigns

Nope, it's giving me the same error. It's trying the directory as just '2/Data/Scripts.rxdata' so I wonder if that has something to do with it? Is it not pointing to the Version folder correctly perhaps?

A client at 2011-07-18 08:55:10 UTC has caused an error:
No such file or directory - 2/Data/Scripts.rxdata

Blizzard

Are you sure that you have configured the extension right? I set the VERSION_LOG_PATH to "Version" and it worked just fine when I put everything into the Version folder.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

mroedesigns

Spoiler: ShowHide
module RMXOS
 
  def self.load_current_extension
    return Versioning
  end
 
end

#======================================================================
# module Versioning
#======================================================================

module Versioning

  VERSION = 1.1
  RMXOS_VERSION = 1.15
  SERVER_THREAD = false
 
  # START Configuration
  GAME_VERSION = 1 # game version
  VERSION_LOG_PATH = 'Version' # where are the version log files located
  CHUNK_MAX_SIZE = 5000 # maximum number of bytes transferred at once
  # END Configuration
 
  def self.initialize
  end
 
  def self.main
    while RMXOS.server.running
      self.server_update
      sleep(0.1)
    end
  end
 
  def self.server_update
  end
 
  def self.client_update(client)
    case client.message
    when /\ACON(.+)\t(.+)/ # connection request
      version = $1.to_i
      if version < GAME_VERSION
        client.send('VNO')
        return true
      end
      client.message = "CON#{$2}"
    when /\AUPD(.+)/ # update request
      version = $1.to_i
      while version < GAME_VERSION
        version += 1
        file = File.open("#{VERSION_LOG_PATH}/#{version}.txt", 'r')
        lines = file.readlines
        file.close
        lines.each {|line|
          line.gsub!("\r") {''}
          line.gsub!("\n") {''}}
        self.parse_version(client, lines)
        client.send('UEX')
      end
      client.send('UEN')
      return true
    end
    return false
  end
 
  def self.parse_version(client, lines)
    command = ''
    while lines.size > 0
      current = lines.shift
      next if current.size == 0
      if current[0, 1] == ':'
        command = current
      else
        case command
        when ':file'
          self.send_file(client, current, lines.shift)
        when ':dir'
          self.send_dir(client, current, lines.shift)
        when ':delete'
          client.send("DEL#{current}")
        end
      end
    end
  end
 
  def self.send_file(client, source, destination)
    file = File.open(source, 'rb')
    data = file.read
    file.close
    if data.size <= CHUNK_MAX_SIZE
      rawdata = data.inspect
      client.send("FIL#{destination}\t#{rawdata}")
    else
      client.send("FIL#{destination}\t")
      while data.size > CHUNK_MAX_SIZE
        current = data[0, CHUNK_MAX_SIZE].inspect
        data = data[CHUNK_MAX_SIZE, data.size - CHUNK_MAX_SIZE]
        client.send("APP#{destination}\t#{current}")
      end
      rawdata = data.inspect
      client.send("APP#{destination}\t#{rawdata}")
    end
  end
 
  def self.send_dir(client, source, destination)
    client.send("MKD#{destination}")
    Dir.foreach(source) {|name|
      if name != '.' && name != '..'
        filename = "#{source}/#{name}"
        if FileTest.directory?(filename)
          self.send_dir(client, filename, "#{destination}/#{name}")
        elsif FileTest.file?(filename)
          self.send_file(client, filename, "#{destination}/#{name}")
        end
      end
    }
  end
 
end


named Updater.rb and i know its in the config extensions right because the server starts and loads all the extensions correctly [right now only blizz-abs and this since im testing compatibility]

G_G

*adds to "Blizzards will eventually look at" list* :V

mroedesigns

Hopefully sooner rather than later haha

Blizzard

Lol! As I said, it works for me. :/
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

mroedesigns

July 18, 2011, 05:23:57 pm #98 Last Edit: July 18, 2011, 05:43:49 pm by mroedesigns
Well it doesn't work for me :/ ill post the script as well since the extensions already posted..

Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Versioning for RMX-OS by Blizzard
# Version: 1.1
# Type: RMX-OS Add-on
# Date: 30.5.2010
# Date v1.01: 12.9.2010
# Date v1.1: 17.9.2010
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#  This script is to be distributed under the same terms and conditions like
#  the script it was created for: RMX-OS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
#   This script must be placed below RMX-OS and requires RMX-OS v1.15 or
#   higher to work properly. It is able to update the game client connecting
#   to the server to the newest game version.
#  
#  
# Instructions:
#  
#   The server extension validates the game version from the client and if the
#   client game version is lower than the server game version, the server will
#   refuse a connection. Instead the server will notify the client that it is
#   possible to update. After the player has confirmed that he wants to update
#   the client, the server will initiate version updating of the server. For
#   the server to know which files need to be sent, you need to create version
#   log files.
#  
#  
# Version Logs:
#  
#   The version log files on the server have a simple format. Each file is
#   named like "NUMBER.txt" where NUMBER is the version.
#  
#   examples:
#    
#     10.txt - version log for updating from version 9 to 10
#     15.txt - version log for updating from version 14 to 15
#     5475685.txt - version log for updating from version 5475684 to 5475685
#    
#   Version log files have a specific format that allows you to define which
#   files need to be updated. The basic format is:
#    
#     :COMMAND
#     FILES
#  
#   The following commands are at your disposal:
#    
#     file - update a single file
#     dir - update an entire directory with all subdirectories recursively
#     delete - delete a file OR a directory with all subdirectories recursively
#  
#   When using the ":delete" command, the FILES parameter is the name of the
#   file or directory that is affected.
#   When using the ":file" or the ":dir" command, there are 2 FILES parameters.
#   The first is the source file path and the second the destination file path.
#   You can add many files as you want with one single command.
#  
#   example:
#    
#     :file
#     versions/24/Game.rgssad
#     Game.rgssad
#     versions/Fonts.zip
#     fonts/fonts.dat
#     :dir
#     versions/24/BGM
#     Audio/BGM
#     :delete
#     utils/screenshot.dll
#     game.ico
#     artwork
#     :dir
#     versions/24/Audio/ME
#     Audio/ME
#    
#   The example above will do following:
#    
#     1. The file "versions/24/Game.rgssad" from the RMX-OS root directory will
#        be transferred to the client and store in the file "Game.rgssad" in
#        his game's root directory.
#     2. The file "versions/Fonts.zip" from the RMX-OS root directory will be
#        transferred to the client and stored in the file "fonts/fonts.dat" in
#        his game's root directory.
#     3. The directory "versions/24/BGM" and all of its contents (recursively)
#        from the RMX-OS root directory will be transferred to the client and
#        store in the directory "Audio/BGM" in his game's root directory.
#     4. The file or directory "utils/screenshot.dll" will be deleted.
#     5. The file or directory "game.ico" will be deleted.
#     6. The file or directory "artwork" will be deleted.
#     7. The directory "versions/24/Audio/ME" and all of its contents
#        (recursively) from the RMX-OS root directory will be transferred to
#        the client and stored in the directory "Audio/ME" in his game's root
#        directory.
#  
#  
# Notes:
#  
#   - There is no syntax checking or other verification of your version log
#     files. It is recommended not to use batch processing with one command but
#     use a command for every single file or directory.
#    
#     example:
#    
#       Instead of this type of writing:
#      
#       :file
#       versions/24/Game.rgssad
#       Game.rgssad
#       versions/Fonts.zip
#       fonts/fonts.dat
#    
#       use this type of writing:
#      
#       :file
#       versions/24/Game.rgssad
#       Game.rgssad
#       :file
#       versions/Fonts.zip
#       fonts/fonts.dat
#      
#   - Make sure to update the client scripts each time because you need to
#     update the constant GAME_VERSION in the configuration of this script to
#     make sure the client knows it's up to date. Either update Scripts.rxdata
#     or update Game.rgssad where Scripts.rxdata is contained.
#   - Update is done only all at once. First all files are downloaded into a
#     temporary directory. After a successful download of ALL files, first the
#     files and directories that need to be delete are deleted, then the
#     downloaded files are moved into the actual game's directory and are
#     updated.
#   - Multiple version updates work one after another and are all done at once.
#     If one version update fails for some reason, the previous updates will
#     not be lost.
#   - It is recommended to keep version updates small. Big updates are more
#     likely to break. You can simply split an update into several updates if
#     it's too big.
#  
#  
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

if !defined?(RMXOS) || RMXOS::VERSION < 1.15
 raise 'ERROR: The "Versioning" requires RMX-OS 1.15 or higher.'
end

$rmxos_versioning = 1.1

#==============================================================================
# module RMXOS
#==============================================================================

module RMXOS
 
 CONNECTION_VERSION_MISMATCH = 134
 UPDATING_END                = 135
 
 #============================================================================
 # module RMXOS::Options
 #============================================================================

 module Options
 
   #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   # START Configuration
   #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
   GAME_VERSION = 1 # internal version number, use integers only
   EXECUTABLE = 'Game.exe' # game executable (usually Game.exe)

   #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   # END Configuration
   #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
 end
 
 #============================================================================
 # module RMXOS::Data
 #============================================================================
 
 module Data
   
   AnswerNo      = 'No'
   AnswerYes     = 'Yes'
   UpdatingNow   = 'Updating now. This may take a while.'
   UpdatePrompt  = 'Your client needs to be updated. Continue?'
   UpdateRestart = 'Update finished. If the game does not restart automatically, please restart it manually.'
   
   TempDir = ENV['TEMP'].gsub('\\', '/') + '/RMXP_update' # system temp folder
   # don't change this
   TempDir += Options::GAME_VERSION.to_s
   
 end

 #============================================================================
 # RMXOS::Network
 #============================================================================

 class Network
   
   def request_connection
     self.send("CON#{RMXOS::Options::GAME_VERSION}\t#{RMXOS::VERSION}")
   end
   
   def request_update
     if FileTest.exist?(RMXOS::Data::TempDir)
       Dir.clear(RMXOS::Data::TempDir)
     else
       Dir.mkdirs(RMXOS::Data::TempDir)
     end
     @delete_queue = []
     self.send("UPD#{RMXOS::Options::GAME_VERSION}")
   end
   
   alias check_connection_versioning_later check_connection
   def check_connection(message)
     case message
     when /\AVNO\Z/ # game version mismatch
       @messages.push(CONNECTION_VERSION_MISMATCH)
       return true
     when /\AMKD(.+)/ # make directory
       Dir.mkdirs("#{RMXOS::Data::TempDir}/#{$1}")
       return true
     when /\AFIL(.+)\t\Z/ # copy empty file
       path = "#{RMXOS::Data::TempDir}/#{$1}"
       Dir.create_path(path)
       file = File.open(path, 'wb')
       file.close
     when /\AFIL(.+)\t(.+)/ # copy file
       path = "#{RMXOS::Data::TempDir}/#{$1}"
       Dir.create_path(path)
       data = eval($2)
       file = File.open(path, 'wb')
       file.write(data)
       file.close
       return true
     when /\AAPP(.+)\t(.+)/ # append to file (in case of big files)
       path = "#{RMXOS::Data::TempDir}/#{$1}"
       Dir.create_path(path)
       data = eval($2)
       file = File.open(path, 'ab')
       file.write(data)
       file.close
       return true
     when /\ADEL(.+)/ # delete directory / file
       @delete_queue.push($1)
       return true
     when /\AUEN\Z/ # updating end
       Dir.clear(RMXOS::Data::TempDir)
       Dir.rmdirs(RMXOS::Data::TempDir)
       @messages.push(UPDATING_END)
       return true
     when /\AUEX\Z/ # execute update
       @delete_queue.each {|filename|
           if FileTest.directory?(filename)
             Dir.clear(filename)
             Dir.rmdirs(filename)
           else
             File.delete(filename) rescue nil
           end
           Graphics.update}
       Dir.copy(RMXOS::Data::TempDir, '.')
       Dir.clear(RMXOS::Data::TempDir)
       @delete_queue = []
       return true
     end
     return check_connection_versioning_later(message)
   end
   
 end
 
end

#==============================================================================
# Dir
#==============================================================================

class Dir
 
 def self.clear(source)
   dirs = [source]
   while dirs.size > 0
     dir = dirs.shift
     dirs += self.clear_non_recursive(dir)
   end
 end
 
 def self.clear_non_recursive(source)
   dirs = []
   Dir.foreach(source) {|name|
       if name != '.' && name != '..'
         filename = "#{source}/#{name}"
         if FileTest.directory?(filename)
           dirs.push(filename)
         elsif FileTest.file?(filename)
           File.delete(filename) rescue nil
         end
       end}
   return dirs
 end
 
 def self.copy(source, destination)
   dirs = [[source, destination]]
   while dirs.size > 0
     dir = dirs.shift
     Dir.mkdirs(dir[1]) if !FileTest.exist?(dir[1])
     dirs += self.copy_non_recursive(dir[0], dir[1])
   end
 end
 
 def self.copy_non_recursive(source, destination)
   dirs = []
   Dir.foreach(source) {|name|
       if name != '.' && name != '..'
         filename = "#{source}/#{name}"
         target = "#{destination}/#{name}"
         if FileTest.directory?(filename)
           dirs.push([filename, target])
         elsif FileTest.file?(filename)
           File.copy(filename, target) rescue nil
         end
       end}
   return dirs
 end
 
 def self.create_path(source)
   dirs = source.split('/')
   dirs.pop
   Dir.mkdirs(dirs.join('/')) if dirs.size > 0
 end
 
 def self.mkdirs(source)
   dirs = source.split('/')
   path = dirs.shift
   loop do
     Dir.mkdir(path) rescue nil if !FileTest.exist?(path)
     break if dirs.size == 0
     path += '/' + dirs.shift
   end
 end
 
 def self.rmdirs(source)
   all_dirs = [source]
   dirs = [source]
   while dirs.size > 0
     dir = dirs.shift
     new_dirs = self.get_subdirs(dir)
     dirs += new_dirs
     all_dirs += new_dirs
   end
   all_dirs.sort.reverse.each {|dir| Dir.rmdir(dir) rescue nil}
 end
 
 def self.get_subdirs(source)
   dirs = []
   Dir.foreach(source) {|name|
       if name != '.' && name != '..'
         filename = "#{source}/#{name}"
         dirs.push(filename) if FileTest.directory?(filename)
       end}
   return dirs
 end
 
end

#==============================================================================
# File
#==============================================================================

class File

 def self.copy(source, destination)
   file = File.open(source, 'rb')
   data = file.read
   file.close
   file = File.open(destination, 'wb')
   file.write(data)
   file.close
   Graphics.update # prevent script is hanging error
 end
 
end

#==============================================================================
# Window_Dialog
#==============================================================================

class Window_Dialog < Window_Command
 
 def initialize(width, commands = ['Yes', 'No'], caption = 'Are you sure?')
   commands.push('')
   @caption = caption
   @cursor_width = 32
   super(width, commands)
   if $fontface != nil
     self.contents.font.name = $fontface
     self.contents.font.size = $fontsize
   elsif $defaultfonttype != nil
     self.contents.font.name = $defaultfonttype
     self.contents.font.size = $defaultfontsize
   end
   self.x, self.y, self.z = 320 - self.width/2, 200 - self.height/2, 1500
   @item_max, self.opacity = commands.size-1, 192
   commands.each {|c|
       w = self.contents.text_size(c).width
       @cursor_width = w if @cursor_width < w}
   @cursor_width += 32
   refresh
   update_cursor_rect
 end
 
 def refresh
   super
   self.contents.font.color = system_color
   self.contents.draw_text(4, 0, self.width-40, 32, @caption, 1)
 end
 
 def draw_item(index, color)
   self.contents.font.color = color
   rect = Rect.new(4, 32 * (index+1), self.contents.width - 8, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.draw_text(rect, @commands[index], 1)
 end
 
 def update_cursor_rect
   if @index < 0 || @item_max == 0
     self.cursor_rect.empty
   else
     x = (self.contents.width - @cursor_width) / 2
     self.cursor_rect.set(x, (@index+1)*32, @cursor_width, 32)
   end
 end
 
end

#==============================================================================
# Scene_Servers
#==============================================================================

class Scene_Servers
 
 alias update_versioning_later update
 def update
   if @dialog_window == nil
     update_versioning_later
     if @wait_count == 0 && @update_mode
       @update_mode = nil
       @help_window.set_text(@helptext)
       Dir.clear(RMXOS::Data::TempDir)
       Dir.rmdirs(RMXOS::Data::TempDir)
     end
   else
     @dialog_window.update
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.cancel_se)
       @dialog_window.dispose
       @dialog_window = nil
     elsif Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       if @dialog_window.index == 0
         @help_window.set_text(RMXOS::Data::UpdatingNow)
         @wait_count = RMXOS::Options::SERVER_TIMEOUT * 2
         $network.request_update
         @update_mode = true
       end
       @dialog_window.dispose
       @dialog_window = nil
     end
   end
 end
 
 alias waiting_for_server_versioning_later waiting_for_server
 def waiting_for_server
   waiting_for_server_versioning_later
   $network.messages.each {|message|
       case message
       when RMXOS::CONNECTION_VERSION_MISMATCH # version mismatch
         @dialog_window = Window_Dialog.new(416, [RMXOS::Data::AnswerYes,
             RMXOS::Data::AnswerNo], RMXOS::Data::UpdatePrompt)
         return false
       when RMXOS::UPDATING_END # updating done
         @update_mode = false
         p RMXOS::Data::UpdateRestart
         Thread.new {system(RMXOS::Options::EXECUTABLE)}
         exit
         return false
       end}
   return true
 end
 
end

Blizzard

As I said, I don't know why it doesn't work for you. :/ It works fine for me regardless of the absolute path. Have you checked the capitalization of the letters? "Version" is different from "version". That's the last thing I can think of. :/
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

G_G

Just a suggestion. Make the folder "Version" in your client folder. Then inside it make a folder "2". Thats where the error is pointing towards.

mroedesigns

I tried it, didn't work. I figured the version folder would go in the server though? I also tried putting it in the Extensions folder like Extensions/Version/2/Scripts.rxdata but it's doing the same thing.

mroedesigns

So I probably shouldn't be double-posting so soon, but I still haven't been able to figure this out. Either I'm putting the directory structure together wrong, or I'm missing something. But the fact that everything up to that point (game version checking, recognizes the update is needed, and tries to update) works is really confusing me. Anyone have any idea what could be causing this?

diagostimo

i know that this might be a bit of necro, but if your still having the issue of it relizing it needs to update but closing the conection to the server, i resolved this after a mess around, so i coppied the client folder to the desktop, with the game version as 1, i then edited some tilling in my project that is still in the rpg m os folder, then changed its game version to 2, also changing its extension version to 2, i test the rpg m os folders client, and it works, i can see the tiles i just edited, i also add 2.txt to the extensions folder and add this comand to it:

:dir
C:/Documents and Settings/User/Desktop/2112 with rmx-os/RMX-OS Client/Data
Data

then i launch the client i copied to my desktop that is still at version 1, it updates it and allows the game to launch, i can see the tiles i edited.
obviously i got:
C:/Documents and Settings/User/Desktop/2112 with rmx-os/RMX-OS Client/Data
from the location of folder that im using to apply the update so it will vary depending wheres yours is, i hope this is some help to who ever it may concern :)

Xolitude

Would I be allowed/be able to re-write this for my own RPG Maker VX master-server?

Blizzard

Yes, sure. Feel free to do so. Just don't forget to include me in the credits and release it under the same license.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Xolitude

Quote from: Blizzard on March 31, 2013, 07:30:53 pm
Yes, sure. Feel free to do so. Just don't forget to include me in the credits and release it under the same license.


Of course ^.^

Is it possible to write it for RPG Maker VX client+server?

Blizzard

Yeah, you only have to change to code to fit your server and the VX client.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Xolitude

Quote from: Blizzard on March 31, 2013, 08:20:53 pm
Yeah, you only have to change to code to fit your server and the VX client.


Oh ok :)

Blizzard

Updated to work with RMX-OS 2.0.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

goth1sniper

this is the error i get when updateing the Scripts.rxdata file
Tue Jun 17 09:15:46 Pacific Daylight Time 2014:
Invalid argument - C:/Users/User/AppData/Local/Temp/RMXP_update1/Data/Scripts.rxdata
Versioning updater:242:in `initialize'
Versioning updater:242:in `open'
Versioning updater:242:in `check_connection'
(RMX-OS) Script:929:in `listen'
(RMX-OS) Script:926:in `each'
(RMX-OS) Script:926:in `listen'
(RMX-OS) Script:5873:in `waiting_for_server_versioning_later'
Versioning updater:481:in `waiting_for_server'
(RMX-OS) Script:5685:in `waiting?'
(RMX-OS) Script:5821:in `update_versioning_later'
Versioning updater:452:in `update'
(RMX-OS) Script:5550:in `main'
(RMX-OS) Script:5547:in `loop'
(RMX-OS) Script:5552:in `main'
-<:::RMX-OS Main:::>-:47


Here is the update text file
:file
versions/2/Scripts.rxdata
Data/Scripts.rxdata


If I try it with this it works
:file
versions/2/test.txt
Data/test.txt

Blizzard

Check if the file exists. It might be possible that your PC doesn't allow temporary files. :/
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

goth1sniper

The file is there.
if i do this
:file
versions/2/test.txt
Data/test.txt

It workes but if I add the scripts file it gives me the error.
I even made a blank text file an named it test.rxdata an it gave me the error.
It has somthing to do with the .rxdata

Blizzard

No, I meant check if it exists in the temporary folder on the client's PC.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

goth1sniper

Quote from: Blizzard on June 17, 2014, 03:45:03 pm
Check if the file exists. It might be possible that your PC doesn't allow temporary files. :/


Oh om sorry.
No It wont send it. I looked in C:\Users\User\AppData\Local\Temp\RMXP_update1\Data
The text file I send will be in there When I test the update with that.

Sylphe

Having exactly the same error "Script  'Versionning' at line 241 : Errno::EINVAL occurred.

Invalid Argument -
C:/Users ... /Temp/RMXP_update2/Game.rgssad

The line is "file = File.open(path, 'wb')"
Maybe it is because it tries to Open the rgssad file ?

:/ annoying error though
blindly follow his heart can lead to the loss

Sylphe, descendant of Zoldik Family.
Quote from: TedBearTRY KEEP UP

whitespirits

OK so im having an error with this system similar to everyone else

Spoiler: ShowHide


I have my config set to

:dir
versions\2

is it again to do with the temps not being there? is there a way around it?


Blizzard

Just change the temp dir in the extended configuration then.

TempDir = ENV['TEMP'].gsub('\\', '/') + '/RMXP_update' # system temp folder


TempDir = 'RMXP_update'
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

whitespirits

Thanks blizz i see it makes the folder now in game Dir its still having this error tho man

Spoiler: ShowHide

Blizzard

Ok, you didn't set up the version file properly in the first place. Look at the examples. Do you see any \ characters? No, they are all / characters, because \ is an escape character that is not interpreted as an actual character.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

whitespirits

Thanks for replies blizz, im still having error either way the go :(
I have a folder in server dir called versions with a 2.txt file inside and a folder called 2 with all the updated game files in

Spoiler: ShowHide

Blizzard

July 26, 2014, 12:54:39 pm #121 Last Edit: July 26, 2014, 12:55:55 pm by Blizzard
You should revert the TempDir change to the original.

Also, you haven't configured WHERE the folder should be copied. That's why your path contains two consecutive slash characters ("//") and it doesn't work. You file should look like this.


:dir
versions/2
.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Sylphe

I changed the temp like you said and I get the same error

Invalid Argument RMXP_update2/Game.rgssad

I did'nt do any mistake in my version file (3.txt) :

:file
last_game_version/Stanland_Online/Game.rgssad
Game.rgssad
:file
last_game_version/Stanland_Online/MAJ_Log.txt
MAJ_Log.txt
:dir
last_game_version/Stanland_Online/Audio/SE
Audio/SE

The Game.rgssad isn't created at all in the folder RMXP_update2, it still empty :(
blindly follow his heart can lead to the loss

Sylphe, descendant of Zoldik Family.
Quote from: TedBearTRY KEEP UP

Blizzard

No, you have to change the TempDir back to what it was in the original script.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

whitespirits

Hi Blizz thanks for patience! im rolling with another error :( feel like im getting closer tho :)

Spoiler: ShowHide



Blizzard

You probably should define the proper folders and fine, not just "everything in versions/2".
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

whitespirits

I just tried single files copy and pasting examples and changing the files and its all the same errors on which ever file i choose :(

Blizzard

Then I'm really out of ideas. When I do the same thing, it works.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Blizzard

Alright, I found and fixed the problem with "big" files.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

whitespirits

Great blizz have u changed script for us to use?

Sylphe

 Last Edit: July 29, 2014, 09:58:45 PM by Blizzard »

I think he did x)
blindly follow his heart can lead to the loss

Sylphe, descendant of Zoldik Family.
Quote from: TedBearTRY KEEP UP

Blizzard

Yes, I did. I actually only had to change one line in the extension
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ShinoTakadora

June 21, 2015, 11:19:17 pm #132 Last Edit: June 22, 2015, 02:08:37 pm by ShinoTakadora
Good day,
We have an error in our test client.
We will be happy if you help us. Thanks in advance.

VERSION_LOG_PATH = 'C:\Ruby\bin\Server\Extensions\versions'

* There is a file 2.txt
:dir
clients\2


"clients\2" directory is exists. Folder "2" is contains files of game client.

When my friend tries to update client, in the console there is an error:
"No such file or directory - clients\2".

Blizzard

Hm, you shouldn't put the logs in the same folder where the versions are supposed to be.

As for the actual error, I'm not sure. Where exactly is the game located? There is no place in the code where a folder named "ver" is referenced.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ShinoTakadora

Quote from: Blizzard on June 22, 2015, 02:44:09 am
Hm, you shouldn't put the logs in the same folder where the versions are supposed to be.

As for the actual error, I'm not sure. Where exactly is the game located? There is no place in the code where a folder named "ver" is referenced.


Oh, sorry, I forgot to correct a typographical error.
"No such file or directory - clients\2".

Also we have tried to allocate a separate file using the command ":file", but nothing happened.
Client doesn't see the files and directories.


Blizzard

The files are usually first extracted into a temp directory. Try changing the temp directory name in the client script. Currently it should be something with ENV["TEMP"]
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ShinoTakadora

September 02, 2015, 07:54:30 am #136 Last Edit: September 04, 2015, 11:09:01 am by ShinoTakadora
I'm sorry, that I didn't answer soon. Thanks for the help.

Also, there is two small problems.
:delete doesn't remove the directory.
Example:

:delete
Versions/Clients/2/Audio/ME

Directory and files are not deleted, although the client shows: "Updated".

:dir isn't working.
Example:

:dir
Versions/Clients/2/Audio/BGM
Audio/BGM


Instead, I receive: "Server is not responding", even though the folder appeared in the directory "Temp", but not in the client.

However, the :file is working well. Just don't send mp3 files. Also music file in mp3 not removed with :delete. Could there be a problem with this?

I apologize for my English in advance.

Blizzard

It's possible that Windows is being a bitch with permissions. Try to run the game as admin.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ShinoTakadora

Quote from: Blizzard on September 02, 2015, 08:56:10 am
It's possible that Windows is being a bitch with permissions. Try to run the game as admin.


Sorry, it hasn't helped. :(

And now, I tried to check a game client with my friend.

Outcome - "Server not responding". :^_^':
He could not update anything, even files with the :file.

Blizzard

This is a network problem. Make sure your firewall and router are configured properly.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ShinoTakadora

Quote from: Blizzard on September 02, 2015, 01:49:56 pm
This is a network problem. Make sure your firewall and router are configured properly.


But people can play with me on the server, didn't works only auto-update.
Also, if I make a mistake and enter a non-existent file or directory, appears message in the console:
"No such file or directory".
That means that people can connect, I suppose, О.о

Blizzard

I'm really not sure what the problem could be then if people can connect and play.
Make sure that you define only files and folders that actually exist on the server. Otherwise you will likely have problems.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ShinoTakadora

Quote from: Blizzard on September 02, 2015, 04:14:12 pm
I'm really not sure what the problem could be then if people can connect and play.
Make sure that you define only files and folders that actually exist on the server. Otherwise you will likely have problems.


Another small issue. If the client is updated, what should appear in the server console?
Thanking you in advance.

Blizzard

The game should display a message that it needs to be restarted.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ShinoTakadora

Quote from: Blizzard on September 03, 2015, 01:03:48 pm
The game should display a message that it needs to be restarted.


Sorry. Not the game client, namely the server console. :^_^':

Blizzard

I haven't touched this code in years, but quickly looking through the server extension, it probably doesn't print out anything when the server is done sending.

Are you sure you're setting it up right? If there are mistakes in the formatting of the update file, it won't work. Also make sure that the version of the client and the server don't match so that updating is initiated properly. Be careful to use forward slashes (/) when specifying directories instead of backward slashes (/). Also keep in mind that you can't copy files from the server to a client location if that client location doesn't exist in the directory tree. I can't remember exactly, but I don't think I added code to handle this case so it's best to avoid it to be safe.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ShinoTakadora

Quote from: Blizzard on September 03, 2015, 03:49:52 pm
I haven't touched this code in years, but quickly looking through the server extension, it probably doesn't print out anything when the server is done sending.

Are you sure you're setting it up right? If there are mistakes in the formatting of the update file, it won't work. Also make sure that the version of the client and the server don't match so that updating is initiated properly. Be careful to use forward slashes (/) when specifying directories instead of backward slashes (/). Also keep in mind that you can't copy files from the server to a client location if that client location doesn't exist in the directory tree. I can't remember exactly, but I don't think I added code to handle this case so it's best to avoid it to be safe.


Thank you that you spend time on the solution to my problem.
I read all posts in this thread for the fifth time, studying the problems of others. :^_^':

There was another small question.
With each new version of an update of the game, version of the game should be changed in:

(RMX-OS) Options Script - GAME_VERSION = 2
Versioning for RMX-OS Script - INTERNAL_VERSION = 2
Ruby File Versioning for RMX-OS - INTERNAL_VERSION = 2
..and in the server configuration file - GAME_VERSION = 2

Is it right?

However, the game doesn't get updated. I have reviewed all the settings of the router, I tried different combinations of commands, and even now I can't update the game client. When friends trying to update, files appear in the folder "Temp", but still there is an error: "Server is not responding".
I recieved another message "The client has been updated". However, it's not updated, and requires updating again.
In this topic has already appeared people with similar problems, but I can't find a solution. :(

Blizzard

September 04, 2015, 02:53:50 pm #147 Last Edit: September 04, 2015, 02:56:38 pm by Blizzard
GAME_VERSION is not really important for this script. It's only used for display to the player. INTERNAL_VERSION is the one that is being used. The update will start if INTERNAL_VERSION of the client is less than INTERNAL_VERSION on the server. The idea is that a client with e.g. version 4 can ask a server with version 7 to send him the data packs for version 5, then 6, then finally 7. Each datapack should obviously define INTERNAL_VERSION in its scripts differently (5, 6 and 7).

If you're having trouble with the temp folder, try changing it to something else in the client script. This line:

TempDir = ENV['TEMP'].gsub('\\', '/') + '/RMXP_update' # system temp folder


Change it to let's say this:

TempDir = 'temp/'


This might solve the problem of not being able to download and copy the files properly. But IDK if it will solve the "Server did not respond" issue.

EDIT: BTW, I updated the client script in the first post. Something caught my attention that might cause problems so I fixed it quickly.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

ShinoTakadora

All right, we have tried many different ways, again.
I can update the client now. :haha:
When my friends trying to update, they are also get registered files in the log "2.txt" and files appeared in a folder "Temp", but the connection is dropped, and the file "Game.rgssad" isn't downloaded completely. It breaks the file, or don't download it fully. :facepalm: