ezmash

Lazy Tilesets - Exporter (VX Ace)

Jan 28th, 2015
247
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. =begin
  2.  
  3. Lazy Tilesets - Exporter
  4. Version 1.0
  5. by Shaz, for RPG Maker Web
  6.  
  7. Use this script to export your tileset data (tile slots, passage, ladder,
  8. counter, bush, damage, terrain tags) to an external file that can be shipped
  9. with the resource pack.
  10.  
  11. Buyers can then use the companion script to load the tileset data into their
  12. game, and avoid having to set everything up themselves.
  13.  
  14. On the tabs for tilesets you want to export, add the following in the note box:
  15.   <export tilesetname>
  16.  
  17. This will create a tilesetname.VXATileset file in your Graphics/Tilesets folder
  18. for each tileset with the note.
  19.  
  20. tilesetname can be any combination of letters and numbers - any other characters
  21. will be stripped out.  Take care not to use the same name in multiple slots -
  22. there will be one .VXATileset created per tileset slot, and there is no check
  23. to see if that file name has already been used - if it has, the existing one
  24. will be overwritten.
  25.  
  26. If you have multiple tilesets in a pack, give each one individual names.  
  27. Eg:
  28.   <export WildWestInside>
  29.   <export WildWestOutside>
  30.   <export WildWestDungeon>
  31.  
  32. =end
  33.  
  34.  
  35. module RMWeb
  36.   module LazyTilesets
  37.     def self.export_tileset_data
  38.       tilesets = load_data("Data/Tilesets.rvdata2")
  39.       tilesets.compact.each { |tileset|
  40.         if tileset.note =~ /<export (.*)>/i
  41.           filename = $1.gsub(/[^a-zA-Z0-9]/){''} + '.VXATileset'
  42.           File.open("Graphics/Tilesets/#{filename}", "wb") { |file|
  43.             Marshal.dump(tileset, file)
  44.           }
  45.         end
  46.       }
  47.     end
  48.   end
  49. end
  50.  
  51. RMWeb::LazyTilesets.export_tileset_data
RAW Paste Data