TheoAllen

RGSS3 Texts Exporter

Aug 17th, 2014
611
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.89 KB | None | 0 0
  1. # load all maps
  2. load_data("Data/MapInfos.rvdata2").each do |map_id, map|
  3.   map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
  4.   puts "Loading map ID #{map_id}"
  5.   Graphics.update
  6.  
  7.   # Load all events
  8.   map.events.each do |evid, event|
  9.     # Load all pages
  10.     event.pages.each_with_index do |page, page_index|
  11.       # Load all event list
  12.       texts = []
  13.       page.list.each_with_index do |list, index|
  14.         if list.code == 401
  15.           texts << "#{index};#{list.parameters[0]}"
  16.         elsif list.code == 102
  17.           texts << "#{index};#{list.parameters}"
  18.         end
  19.       end
  20.       unless texts.empty?
  21.         result = texts.join("\n")
  22.         name = "Texts/#{map_id}-#{evid}-#{page_index}.csv"
  23.         File.open(name, 'w') do |f|
  24.           f.print(result)
  25.         end
  26.         puts "file created : #{name}"
  27.         Graphics.update
  28.       end
  29.     end
  30.   end
  31.  
  32. end
  33. exit
Advertisement
Add Comment
Please, Sign In to add comment