Advertisement
Marlingaming

.mtf File Creator

Sep 14th, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. --Music Text Format File Creator
  2. --this program takes the Song File, Song Settings File, and the Reference file and compresses it into a single .mtf file so it can be used by any of my .mtf scripts
  3. --THIS PROGRAM is for Minecraft 1.16.5, CC Tweaked Computers
  4. local tArg = {..}
  5. local SettingsFile = tArg[3]
  6. local ReferenceFile = tArg[2]
  7. local SongFile = tArg[1]
  8. local NewName = tArg[4]
  9. local Song_Length = 0
  10. local SongData = nil
  11. local SettingsEnd = 0
  12. local SettingsData = nil
  13. local ReferenceData = nil
  14.  
  15. local function start()
  16. CompressSong()
  17. CompressSettings()
  18. CompressReferences()
  19. Compress()
  20. end
  21.  
  22. local function Compress()
  23. local file = fs.open("/rom/music/"..NewName..".mtf","w")
  24. file.writeLine(SettingsData.."|")
  25. file.writeLine(SongData)
  26. file.writeLine("end")
  27. file.writeLine(ReferenceData)
  28. file.close()
  29. end
  30.  
  31. local function CompressSong()
  32. local Song = fs.open(SongFile,"r"
  33. Song_Length = Song.bytes()
  34. SongData = Song.readall()
  35. Song.close()
  36. end
  37.  
  38. local function CompressSettings()
  39. local Set = fs.open("Settings_"..SongFile,"r"
  40. SettingsEnd = Set.byte()
  41. SettingsData = Set.readAll()
  42. Set.close()
  43. end
  44.  
  45. local function CompressReferences()
  46. local Set = fs.open("References_"..SongFile,"r"
  47. ReferenceData = Set.readAll()
  48. Set.close()
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement