Advertisement
Vlue

Version/Build Number

Aug 5th, 2012
2,395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.37 KB | None | 0 0
  1. #Version/Build Number
  2. #----------#
  3. #Features: Allows you to display what version your game is on and for purely
  4. #       special purposes what build as well (not fancy, just how many times
  5. #       game hs been started in unreleased)
  6. #
  7. #Usage: Plug and play and customize
  8. #
  9. #Customization: Set below, in comments.
  10. #----------#
  11. #-- Script by: V.M of D.T
  12. #
  13. #- Questions or comments can be:
  14. #    given by email: sumptuaryspade@live.ca
  15. #    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
  16. #   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
  17. #
  18. #--- Free to use in any project, commercial or non-commercial, with credit given
  19. # - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
  20.  
  21. #FLAVORTEXT: Just any text before version number, not neccesary
  22. FLAVORTEXT   = "Game Name "
  23. #VERSION: The Version, however you want to display it
  24. VERSION   = "v1.0 "
  25. #VERSION_ONLY: Whether you want to show build number or not
  26. VERSION_ONLY = false
  27. #RELEASE: Set to true to prevent build from rising each time game is started
  28. RELEASE   = false
  29. #VFONT_SIZE, VWINDOW_X, VWINDOW_Y, the font size, x, and y position of window
  30. VFONT_SIZE   = 14
  31. VWINDOW_X = -12
  32. VWINDOW_Y = 384
  33.  
  34. #NO TOUCHY!
  35. $build_number = 0
  36.  
  37. module Version
  38.   def self.init
  39.     if File.exist?("System/Version.vmdt") then else Version.run_new end
  40.       File.open("System/Version.vmdt", "rb") do |file|
  41.       $build_number = Marshal.load(file)
  42.         end
  43.       $build_number += 1 if !RELEASE
  44.       File.open("System/Version.vmdt", "wb") do |file|
  45.       Marshal.dump($build_number, file)
  46.     end
  47.   end
  48.   def self.run_new
  49.     file = File.new("System/Version.vmdt", "wb")
  50.     Marshal.dump($build_number, file)
  51.     file.close
  52.   end
  53. end
  54.  
  55. class Scene_Title
  56.   alias version_initialize start
  57.   def start
  58.     version_initialize
  59.     @version_window = Window_Version.new
  60.   end
  61. end
  62.  
  63. class Window_Version < Window_Base
  64.   def initialize
  65.     super(VWINDOW_X, VWINDOW_Y, 200, fitting_height(1))
  66.     self.opacity = 0
  67.     refresh
  68.   end
  69.   def refresh
  70.     self.contents.clear
  71.     self.contents.font.size = VFONT_SIZE
  72.     self.contents.draw_text(0,0,200,line_height,version)
  73.   end
  74.   def version
  75.     return FLAVORTEXT + VERSION if VERSION_ONLY
  76.     return FLAVORTEXT + VERSION + "Build: " + $build_number.to_s
  77.   end
  78. end
  79.  
  80. Version::init
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement