Project1

标题: 【向Dant致敬】简易截图脚本 [打印本页]

作者: LBQ    时间: 2014-2-22 04:39
标题: 【向Dant致敬】简易截图脚本
于是我又去偷大触的革命成果了>_<
好了于是看到Dant大大的bitmap -> PNG果然顺手就写了这个_(:з」∠)_

必须要先安装Dant大大的Bitmap -> PNG:http://rpg.blue/thread-224347-1-1.html
默认是按D键截图,自己可以改嗯


RUBY 代码复制
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ VA - Screenshot by LBQ
  4. #         - based on Bitmap2PNG by Dant
  5. #------------------------------------------------------------------------------
  6. # Bitmap2PNG is Required: http://rpg.blue/thread-224347-1-1.html
  7. #==============================================================================
  8. # Almost all the hard work has been done by Dant.
  9. #------------------------------------------------------------------------------
  10. # Usage: Press Screenshot Key (Default: D) to Take Screenshot
  11. #       - Default saved in Screenshots Directory
  12. #==============================================================================
  13. module LBQ
  14.   module Screenshot
  15.     $imported ||= {}
  16.     $imported[:lbq_screenshot] = '0.9'
  17.  
  18.     #   :Button    Default Keyboard Button
  19.     #      :L        Q
  20.     #      :R        W
  21.     #      :X        A
  22.     #      :Y        S
  23.     #      :Z        D
  24.     KEY     = :Z # Default: Z which is D on keyboard
  25.     MSGBOX  = true # Weather to play a sound or not
  26.     FOLDER  = "Screenshots"
  27.  
  28.  
  29.     #if only time is enabled, the filename will only be composed of the time
  30.     ONLY_TIME = false
  31.     MSG = proc do
  32.       Sound.play_shop
  33.       puts "SCREENSHOT SAVED"
  34.     end # proc
  35.   end
  36. end
  37.  
  38.  
  39.  
  40.  
  41.  
  42. class << LBQ::Screenshot
  43.   def check_screenshot
  44.     if Bitmap.instance_methods.include?(:save_png)
  45.         puts "LBQ - Screenshot: Found :save_png Method"
  46.     else
  47.         msgbox <<-INFO
  48.         LBQ - Screenshot Cannot Find :save_png Method for Bitmap
  49.         Please Make Sure that You Have Bitmap2PNG by Dant
  50.         You can find the download link for Bitmap2PNG in the Comments
  51.         of the scripts
  52.         INFO
  53.     end
  54.   end
  55.  
  56.  
  57.   def take_screenshot
  58.     check_screenshot
  59.     Dir.mkdir(LBQ::Screenshot::FOLDER) unless Dir.exist?(LBQ::Screenshot::FOLDER)
  60.     File.new get_filename, "w"
  61.     Graphics.snap_to_bitmap.save_png(get_filename)
  62.     LBQ::Screenshot::MSG.call if LBQ::Screenshot::MSGBOX
  63.   end # def take_screenshot
  64.  
  65.   def get_filename
  66.     return "#{LBQ::Screenshot::FOLDER}/Screenshot-#{Time.now.strftime("%I_%M_%S")}.png" if LBQ::Screenshot::ONLY_TIME
  67.     if SceneManager.scene_is?(Scene_Map)
  68.       n = "Map - #{$game_map.display_name}"
  69.     elsif SceneManager.scene_is?(Scene_Battle)
  70.       n = "Battle - #{$game_troop.troop.name}"
  71.     elsif SceneManager.scene_is?(Scene_Shop)
  72.       n = "Shop"
  73.     else
  74.       n = SceneManager.scene.class.name
  75.     end # SceneMap
  76.     n.gsub!(/[\x00\/\\:\*\?\"<>\|]/, '_')
  77.     return "#{LBQ::Screenshot::FOLDER}/#{n}-#{Time.now.strftime("%I_%M_%S")}.png"
  78.   end # def get_filename
  79. end
  80.  
  81.  
  82. class Scene_Base
  83.   alias :lbq_screenshot_scene_base_update :update
  84.   def update
  85.     lbq_screenshot_scene_base_update
  86.     LBQ::Screenshot.take_screenshot if Input.trigger?(LBQ::Screenshot::KEY)
  87.   end
  88. end

作者: david_ng223    时间: 2014-2-22 04:57
提示: 作者被禁止或删除 内容自动屏蔽
作者: 0936zz    时间: 2015-7-21 11:49
请问大神,截图的声音怎么修改,看了半天啥也没看懂啊
作者: LBQ    时间: 2015-7-21 13:12
0936zz 发表于 2015-7-21 11:49
请问大神,截图的声音怎么修改,看了半天啥也没看懂啊

第32行:
  1. Sound.play_shop
复制代码
代表了播放SE。
改掉这一行成为Sound的其他方法即可。

删掉这一行就没有音效了。

这个脚本主要用途是给自己用的,所以我当时也没有考虑到要改音效这种问题OTL。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1