Admannon's RTP Importer - Printable Version +- irpg Community (https://irpg.in.th) +-- Forum: irpg Fabella RPG Maker Academia (https://irpg.in.th/forum-4.html) +--- Forum: RGSS and JS Showcase (https://irpg.in.th/forum-26.html) +--- Thread: Admannon's RTP Importer (/thread-1163.html) |
Admannon's RTP Importer - admannon - 04-29-2013 Admannon's RTP Importer สคริปต์เขียนโดย : Admannon รายละเอียด : เป็นสคริปต์ที่ไว้ดึงทรัพยาการของ RGSS มาไว้ในไฟล์ตนเอง กรณีที่ต้องการให้เล่นเกมโดยไม่ใช้ RTP Update : 14-07-2013 : ปรับรูปลักษณ์ แก้บัคเพิ่มเติม และเร่งความเร็วให้มากขึ้น สกรีนช๊อต : วิธีการใช้งาน : นำสคริปต์ไปวางไว้เหนือ Main เวลาใช้ก็ใส่ข้อความนี้ใน Main นะครับ [shcode=rails]RGSSManager.new [/shcode] ส่วนวิธีที่ทำให้ไม่ต้องดึงตัว RTP มาใช้ เพียงแค่เปลี่ยน RTP ให้เป็น None ตามขั้นตอน ข้อตกลงการนำไปใช้งาน : เอาไปไว้ที่ไหน ให้เครดิตถึง Admannon ด้วยนะครับ /ohgod/ohgod/ohgod/ohgod/ohgod/ohgod/ohgod/ohgod/ohgod/ohgod โค๊ดสคริปต์ [shcode=rails]#============================================================================== # ** RGSS-RTP Standart Importer #------------------------------------------------------------------------------ # By Admannon #============================================================================== class RGSSManager #-------------------------------------------------------------------------- # - Class Variables #-------------------------------------------------------------------------- @@graphics_folders = [ "Animations", "Autotiles", "Battlebacks", "Battlers", "Characters", "Icons", "Titles", "Gameovers", "Panoramas", "Pictures", "Tilesets", "Fogs", "Transitions", "Windowskins" ] @@audio_folders = ["BGM", "BGS", "ME", "SE"] @@rtp_path = ENV["CommonProgramFiles(x86)"] + "\\Enterbrain\\RGSS\\Standard" @@origin_path = Dir.getwd #-------------------------------------------------------------------------- # - Object initialization #-------------------------------------------------------------------------- def initialize graphics_initialize loading_rxdata_data create_quere_folder import_quere import_file graphics_finalize end #-------------------------------------------------------------------------- # - Graphics initialization #-------------------------------------------------------------------------- def graphics_initialize # Change Font @font_name = Font.default_name Font.default_name = "Consolas" @font_size = Font.default_size Font.default_size = 16 @frame_rate = Graphics.frame_rate Graphics.frame_rate = 120 # Freeze Current Graphics Graphics.freeze # Create Header @header_viewport = Viewport.new(0, 0, 640, 32) @process_viewport = Viewport.new(8, 48, 624, 32) @info_viewport = Viewport.new(8, 80, 624, 32) @header = Sprite.new(@viewport) @header.bitmap = Bitmap.new(640, 32) @header.bitmap.font.size = 32 @header.bitmap.font.color = Color.new(0, 0, 0) @header.bitmap.fill_rect(0, 0, 640, 32, Color.new(255, 255, 255)) @header.bitmap.draw_text(0, 0, 640, 32, "Admannon\'s File Importer", 1) # Create Process @process = Sprite.new(@process_viewport) @process.bitmap = Bitmap.new(624, 32) @process.bitmap.draw_text(0, 0, 624, 16, "Process : ") @process.bitmap.fill_rect(0, 16, 624, 16, Color.new(255, 255, 255)) @process.bitmap.fill_rect(1, 17, 622, 14, Color.new(0, 0, 0, 0)) # Create Running Process @run_process = Sprite.new(@process_viewport) @run_process.y = 16 @run_process.zoom_x = 0 @run_process.bitmap = Bitmap.new(780, 16) @run_process.bitmap.fill_rect(0, 0, 624, 16, Color.new(255, 255, 255)) # Create Run Status @run_status = -1 # Create Info @info = Sprite.new(@info_viewport) @info.bitmap = Bitmap.new(624, 32) # Transition execution Graphics.transition end def graphics_update if @run_status < 0 @run_process.zoom_x = 0.375; @run_process.ox = 624 @run_process.x = (@run_process.x + 8) % ((1 + @run_process.zoom_x) * 624); elsif @run_status < 100 @run_process.x = 0 @run_process.ox = 0 @run_process.zoom_x = @run_status / 100.0; end Graphics.update Input.update end #-------------------------------------------------------------------------- # - Graphics finalization #-------------------------------------------------------------------------- def graphics_finalize Graphics.freeze unless @header.nil? @header.bitmap.dispose @header.dispose end unless @process.nil? @process.bitmap.dispose @process.dispose end unless @run_process.nil? @run_process.bitmap.dispose @run_process.dispose end unless @info.nil? @info.bitmap.dispose @info.dispose end Font.default_name = @font_name Font.default_size = @font_size Graphics.frame_rate = @frame_rate end #-------------------------------------------------------------------------- # - Create Folder Quere #-------------------------------------------------------------------------- def create_quere_folder @graphics_import = {} @audio_import = {} for i in @@graphics_folders @graphics_import[i] = Array.new end for i in @@audio_folders @audio_import[i] = Array.new end @files = 0 end #-------------------------------------------------------------------------- # - Load data #-------------------------------------------------------------------------- def loading_rxdata_data @datas = 0 graphics_log("Loading \"Data/Actors.rxdata\"") @actors = load_data("Data/Actors.rxdata") @datas += @actors.size - 1 graphics_log("Loading \"Data/Skills.rxdata\"") @skills = load_data("Data/Skills.rxdata") @datas += @skills.size - 1 graphics_log("Loading \"Data/Items.rxdata\"") @items = load_data("Data/Items.rxdata") @datas += @items.size - 1 graphics_log("Loading \"Data/Weapons.rxdata\"") @weapons = load_data("Data/Weapons.rxdata") @datas += @weapons.size - 1 graphics_log("Loading \"Data/Armors.rxdata\"") @armors = load_data("Data/Armors.rxdata") @datas += @armors.size - 1 graphics_log("Loading \"Data/Enemies.rxdata\"") @enemies = load_data("Data/Enemies.rxdata") @datas += @enemies.size - 1 graphics_log("Loading \"Data/Animations.rxdata\"") @animations = load_data("Data/Animations.rxdata") @datas += @animations.size - 1 graphics_log("Loading \"Data/Tilesets.rxdata\"") @tilesets = load_data("Data/Tilesets.rxdata") @datas += @tilesets.size - 1 graphics_log("Loading \"Data/CommonEvents.rxdata\"") @commonevents = load_data("Data/CommonEvents.rxdata") @datas += @commonevents.size - 1 graphics_log("Loading \"Data/System.rxdata\"") @system = load_data("Data/System.rxdata") @datas += 1 graphics_log("Create Map Data : ") map_name = Dir.glob("Data/Map*.rxdata") map_name.delete("Data/MapInfos.rxdata") @maps = [] map_name.each do |m| graphics_log("Loading \"%s\"" % m, 1) @maps.push load_data(m) @datas += 1 end @run_status = 0 graphics_log("", 0) graphics_log("", 1) end #-------------------------------------------------------------------------- # - Add String to Screen Log #-------------------------------------------------------------------------- def graphics_log(string, line = 0, bitmap = @info.bitmap) height = bitmap.font.size bitmap.fill_rect(0, height * line, bitmap.width, height, Color.new(0, 0, 0, 0)) bitmap.draw_text(0, height * line, bitmap.width, height, string) graphics_update end #-------------------------------------------------------------------------- # - Check Import #-------------------------------------------------------------------------- def import_check(type, directory, filename) return if filename.empty? if Dir[type + "/" + directory + "/" + filename + ".*"].empty? if type == "Graphics" import = @graphics_import elsif type == "Audio" import = @audio_import end unless import[directory].include?(filename) graphics_log("Quered : " + type + "/" + directory + "/" + filename, 1) #Graphics.update import[directory].push filename @files += 1 end end end #-------------------------------------------------------------------------- # - Quere Event Data #-------------------------------------------------------------------------- def import_quere_event(ev) ev.list.each do |l| case l.code when 131 # Change Windowskin import_check("Graphics", "Windowskins", l.parameters[0]) when 132 # Change Battle BGM import_check("Audio", "BGM", l.parameters[0].name) when 133 # Change Battle End ME import_check("Audio", "ME", l.parameters[0].name) when 209 # Set Move Route l.parameters[1].list.each do |mr| case mr.code when 41 # Change Graphic import_check("Graphics", "Characters", mr.parameters[0]) when 44 # Play SE import_check("Audio", "SE", mr.parameters[0].name) end end when 222 # Execute Transition import_check("Graphics", "Transitions", l.parameters[0]) when 241 # Play BGM import_check("Audio", "BGM", l.parameters[0].name) when 245 # Play BGS import_check("Audio", "BGS", l.parameters[0].name) when 249 # Play ME import_check("Audio", "ME", l.parameters[0].name) when 250 # Play SE import_check("Audio", "SE", l.parameters[0].name) when 322 # Change Actor Graphic import_check("Graphics", "Characters", l.parameters[1]) import_check("Graphics", "Battlers", l.parameters[3]) end end end #-------------------------------------------------------------------------- # - Quere RGSS Data #-------------------------------------------------------------------------- def import_quere # Quere Actor Data @actors.each do |i| next if i.nil? graphics_log("Checking Actor ID : %d" % i.id) import_check("Graphics", "Characters", i.character_name) import_check("Graphics", "Battlers", i.battler_name) @run_status += 100.0 / @datas end # Quere Skill Data @skills.each do |i| next if i.nil? graphics_log("Checking Skill ID : %d" % i.id) import_check("Graphics", "Icons", i.icon_name) import_check("Audio", "SE", i.menu_se.name) @run_status += 100.0 / @datas end # Quere Item Data load_data("Data/Items.rxdata").each do |i| next if i.nil? graphics_log("Checking Item ID : %d" % i.id) import_check("Graphics", "Icons", i.icon_name) import_check("Audio", "SE", i.menu_se.name) @run_status += 100.0 / @datas end # Quere Weapon Data @weapons.each do |i| next if i.nil? graphics_log("Checking Weapon ID : %d" % i.id) import_check("Graphics", "Icons", i.icon_name) @run_status += 100.0 / @datas end # Quere Armor Data @armors.each do |i| next if i.nil? graphics_log("Checking Armor ID : %d" % i.id) import_check("Graphics", "Icons", i.icon_name) @run_status += 100.0 / @datas end # Quere Enemy Data @enemies.each do |i| next if i.nil? graphics_log("Checking Enemy ID : %d" % i.id) import_check("Graphics", "Battlers", i.battler_name) @run_status += 100.0 / @datas end # Quere Animation Data @animations.each do |i| next if i.nil? graphics_log("Checking Animation ID : %d" % i.id) import_check("Graphics", "Animations", i.animation_name) i.timings.each { |a| import_check("Audio", "SE", a.se.name) } @run_status += 100.0 / @datas end # Quere Tileset Data @tilesets.each do |i| next if i.nil? graphics_log("Checking Tileset ID : %d" % i.id) import_check("Graphics", "Tilesets", i.tileset_name) i.autotile_names.each { |a| import_check("Graphics", "Autotiles", a) } import_check("Graphics", "Panoramas", i.panorama_name) import_check("Graphics", "Fogs", i.fog_name) import_check("Graphics", "Battlebacks", i.battleback_name) @run_status += 100.0 / @datas end # Quere Common Event Data @commonevents.each do |i| next if i.nil? graphics_log("Checking Common Event ID : %d" % i.id) import_quere_event(i) @run_status += 100.0 / @datas end # Quere System Data import_check("Graphics", "Windowskins", @system.windowskin_name) import_check("Graphics", "Titles", @system.title_name) import_check("Graphics", "Gameovers", @system.gameover_name) import_check("Graphics", "Transitions", @system.battle_transition) import_check("Audio", "BGM", @system.title_bgm.name) import_check("Audio", "BGM", @system.battle_bgm.name) import_check("Audio", "ME", @system.battle_end_me.name) import_check("Audio", "ME", @system.gameover_me.name) import_check("Audio", "SE", @system.cursor_se.name) import_check("Audio", "SE", @system.decision_se.name) import_check("Audio", "SE", @system.cancel_se.name) import_check("Audio", "SE", @system.buzzer_se.name) import_check("Audio", "SE", @system.equip_se.name) import_check("Audio", "SE", @system.shop_se.name) import_check("Audio", "SE", @system.save_se.name) import_check("Audio", "SE", @system.load_se.name) import_check("Audio", "SE", @system.battle_start_se.name) import_check("Audio", "SE", @system.escape_se.name) import_check("Audio", "SE", @system.actor_collapse_se.name) import_check("Audio", "SE", @system.enemy_collapse_se.name) @run_status += 100.0 / @datas # Quere Map Data @maps.each do |m| graphics_log("Checking Map") import_check("Audio", "BGM", m.bgm.name) import_check("Audio", "BGS", m.bgs.name) m.events.each_value do |e| e.pages.each do |p| g = p.graphic import_check("Graphics", "Characters", g.character_name) if g.tile_id == 0 import_quere_event(p) end end @run_status += 100.0 / @datas end graphics_log("") graphics_log("", 1) end #-------------------------------------------------------------------------- # - Import RGSS File #-------------------------------------------------------------------------- def import_file @run_status = 0 if @files != 0 graphics_log("Change Diractory to : %s" % @@rtp_path) Dir.chdir(@@rtp_path) @graphics_import.each do |gi| graphics_dir = "Graphics/%s" % gi[0] gi[1].each do |s| str = graphics_dir + "/" + s + ".*" Dir.mkdir(dir) unless FileTest.directory?(graphics_dir) file_path = Dir[str][0] size = FileTest.size(file_path) graphics_log("Copying : %s" % file_path, 1) file_src = open(file_path, "rb") file_dsc = open(@@origin_path + "/" + file_path, "wb") file_dsc.write(file_src.read) file_dsc.close file_src.close @run_status += 100.0 / @files end end @audio_import.each do |gi| audio_dir = "Audio/%s" % gi[0] gi[1].each do |s| str = audio_dir + "/" + s + ".*" Dir.mkdir(dir) unless FileTest.directory?(audio_dir) file_path = Dir[str][0] size = FileTest.size(file_path) graphics_log("Copying : %s" % file_path, 1) file_src = open(file_path, "rb") file_dsc = open(@@origin_path + "/" + file_path, "wb") file_dsc.write(file_src.read) file_dsc.close file_src.close @run_status += 100.0 / @files end end graphics_log("Change Diractory to : \n" + @@origin_path) Dir.chdir(@@origin_path) end graphics_log("Imported complete! Please press C to continue") time = Time.now + 3 while time >= Time.now t = time - Time.now return if Input.press?(Input::C) graphics_log("or please wait in %d seconds" % t.ceil, 1) @run_status = (3.0 - t) * 100.0 / 3 end end end [/shcode] Demo http://www.mediafire.com/download/evje9a9sd4f5jkj/RTP-Standard_Detect.zip RE: Admannon's RTP Importer - platou18 - 04-29-2013 โอ๊ะ.............. น่าสนนะแบบนี้ ;w; RE: Admannon's RTP Importer - TheMoo2000 - 04-29-2013 เยี่ยมเลยครับ ลองเอาไปปล่อยบอร์ดนอกน่าจะรุ่งนะครับ RE: Admannon's RTP Importer - Shinryu - 04-29-2013 โอ้ ดึงเฉพาะอันที่ใช้เหรอ แจ๋วไปเลย อยากได้แบบ เช็คว่าไฟล์(ที่เราลงเอง)ไหนไม่ได้ใช้ด้วยจริงๆ RE: Admannon's RTP Importer - LuZi - 04-30-2013 เป็นอะไรที่รอคอยมานานมากๆ เพราะเวลานั่งคัดไฟล์มันสับสนจำไม่ได้ว่าอันใหนใช้ อันใหนไม่ใช้ มีแบบนี่แล้วสะดวกขึ้นจมเลย XD |