设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 110|回复: 0

[转载发布] PrintScreen Screenshot

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-3 12:56:04 | 显示全部楼层 |阅读模式
    PrintScreen Screenshot+2012/06/10

    Creator name: Ru/むっくRu (Rutan) | (English Translation by tale)​


    Introduction
    A script that lets you save a screenshot of the game screen by pressing PrintScreen.

    Features
    - Press PrintScreen to save the screenshot inside the project folder of RPGVXAce
    - Adds a function to save a screenshot of the game screen
    - Screens are located inside screenshot folder

    For more details, see the item settings in the script.

    Screen




    I didn't create a new folder and rename it "screenshot" and go on paint to make these two screens.
    That's the script doing the work with the convenience of the PrintScreen key.

    How to Use
    Paste this script above Main.

    Script link
    https://raw.githubusercontent.com/ovate/torigoya-rgss3/main/torigoya_PrintScreen.rb

                    Code:       
    1. # coding: utf-8
    2. #===============================================================================
    3. # ■ PrintScreen Screenshot for RGSS3
    4. #-------------------------------------------------------------------------------
    5. # 2012/06/10 Ru/むっくRu (Rutan) | English translation by tale 2017/02/12
    6. # License - Public Domain, allows commercial use and credit is not necessary
    7. #-------------------------------------------------------------------------------
    8. #  Press PrintScreen to save the screenshot inside the project folder "screenshot"
    9. #  Adds a function to save a screenshot of the game screen
    10. #  (Countermeasures against lag, screens are created after several seconds)
    11. #-------------------------------------------------------------------------------
    12. # 【Issues】
    13. #  Game frame rate drops a bit during saving
    14. #-------------------------------------------------------------------------------
    15. # 【Changelogs】
    16. # 2012/06/10 Fixed an issue that causes force quit when pressing F12 during save.
    17. # 2012/01/07 Fixed a bug where it doesn't work well during battle?
    18. # 2011/12/27 Release
    19. #-------------------------------------------------------------------------------
    20. # 【Reference:PNG file processing】
    21. #  http://d.hatena.ne.jp/ku-ma-me/20091003/p1
    22. #-------------------------------------------------------------------------------
    23. #===============================================================================
    24. # ● Item settings
    25. #===============================================================================
    26. module HZM_VXA
    27.   module ScreenShot
    28.     # Name of the folder
    29.     DIRNAME = 'screenshot'
    30.     # File name to be saved.No extension(.png)required
    31.     #  %Y …… Year
    32.     #  %m …… Month(01-12)
    33.     #  %d …… Day(01-31)
    34.     #  %H …… Hour(00-23)
    35.     #  %M …… Minute(00-59)
    36.     #  %S …… Second(00-59)
    37.     FILENAME = "%Y%m%d_%H%M%S"
    38.    
    39.     # Display texts on the screenshot
    40.     #   true  …… On
    41.     #   false …… Off
    42.     USE_COPYRIGHT = false
    43.     # Texts shown in the screen
    44.     COPYRIGHT_TEXT = '(C) birdhouse.txt'
    45.     # Text's color
    46.     COPYRIGHT_COLOR = Color.new(255, 255, 255)
    47.     # Text's size
    48.     COPYRIGHT_SIZE  = 16
    49.     # Text's position (0: Left, 1: Center, 2: Right)
    50.     COPYRIGHT_ALIGN = 2
    51.    
    52.     # Number of times to process 1 frame
    53.     # ※Increasing the value will shorten the process of generating the file,
    54.     #   Amount of load time increases when the processing dramatically drops
    55.     RUN_SPEED = 3
    56.   end
    57. end
    58. #===============================================================================
    59. # ↑    Setup goes here    ↑
    60. # ↓ for less, script there ↓
    61. #===============================================================================
    62. module HZM_VXA
    63.   module ScreenShot
    64.     VK_SNAPSHOT = 0x2c
    65.     GetKeyState = Win32API.new('user32', 'GetKeyState', %w(l), 'i')
    66.     #---------------------------------------------------------------------------
    67.     # ● Startup
    68.     #---------------------------------------------------------------------------
    69.     def self.init
    70.       @pressed = false
    71.       @list = []
    72.     end
    73.     #---------------------------------------------------------------------------
    74.     # ● Update
    75.     #---------------------------------------------------------------------------
    76.     def self.update
    77.       add  if press?
    78.       RUN_SPEED.times { develop }
    79.     end
    80.     #---------------------------------------------------------------------------
    81.     # ● PrintScreen monitor
    82.     #---------------------------------------------------------------------------
    83.     def self.press?
    84.       if @pressed
    85.         @pressed = (GetKeyState.call(VK_SNAPSHOT) < 0)
    86.         false
    87.       else
    88.         @pressed = (GetKeyState.call(VK_SNAPSHOT) < 0)
    89.       end
    90.     end
    91.     #---------------------------------------------------------------------------
    92.     # ● Addition to development waiting
    93.     #---------------------------------------------------------------------------
    94.     def self.add
    95.       bitmap = Graphics.snap_to_bitmap
    96.       if USE_COPYRIGHT
    97.         bitmap.font.size  = COPYRIGHT_SIZE
    98.         bitmap.font.color = COPYRIGHT_COLOR
    99.         bitmap.draw_text(0, bitmap.height - COPYRIGHT_SIZE, bitmap.width, COPYRIGHT_SIZE, COPYRIGHT_TEXT, COPYRIGHT_ALIGN)
    100.       end
    101.       filename = "#{Time.now.getlocal.strftime(FILENAME)}"
    102.       @list.push({
    103.         :bitmap => bitmap,
    104.         :filename => filename
    105.       })
    106.     end
    107.     #---------------------------------------------------------------------------
    108.     # ● Development
    109.     #---------------------------------------------------------------------------
    110.     def self.develop
    111.       return if @list.empty?
    112.       data = @list.first
    113.       if data[:line] == nil  # Unconditional
    114.         data[:line] = 0
    115.         data[:img] = []
    116.       elsif data[:line] < data[:bitmap].height # Analyzing
    117.         data[:img].push 0
    118.         for i in 0...data[:bitmap].width
    119.           c = data[:bitmap].get_pixel(i, data[:line])
    120.           data[:img].push(c.red, c.green, c.blue)
    121.         end
    122.         data[:line] += 1
    123.       else  # Saving
    124.         Dir.mkdir(DIRNAME) unless File.exist?(DIRNAME)
    125.         cnt = Dir.glob("#{DIRNAME}/#{data[:filename]}*.png").size
    126.         footer = cnt > 0 ? "_#{cnt}" : ""
    127.         File.open("#{DIRNAME}/#{data[:filename]}#{footer}.png", 'wb') do |file|
    128.           file.write "\x89PNG\r\n\x1a\n"
    129.           file.write createChunk('IHDR', [data[:bitmap].width, data[:bitmap].height, 8, 2, 0, 0, 0].pack('N2C5'))
    130.           file.write createChunk('IDAT', Zlib::Deflate.deflate(data[:img].pack('C*')))
    131.           file.write createChunk('IEND', '')
    132.         end
    133.         data[:bitmap].dispose
    134.         @list.shift
    135.       end
    136.     end
    137.     #---------------------------------------------------------------------------
    138.     # ● Create PNG chunk data
    139.     #---------------------------------------------------------------------------
    140.     def self.createChunk(type, data)
    141.       [data.bytesize, type, data, Zlib.crc32(type + data)].pack('NA4A*N')
    142.     end
    143.   end
    144. end
    145. class Scene_Base
    146.   #-----------------------------------------------------------------------------
    147.   # ● Screenshot update
    148.   #-----------------------------------------------------------------------------
    149.   alias hzm_vxa_screenshot_update_basic update_basic
    150.   def update_basic
    151.     hzm_vxa_screenshot_update_basic
    152.     HZM_VXA::ScreenShot.update
    153.   end
    154. end
    155. class << SceneManager
    156.   #-----------------------------------------------------------------------------
    157.   # ● Execution
    158.   #-----------------------------------------------------------------------------
    159.   alias hzm_vxa_screenshot_run run
    160.   def run
    161.     HZM_VXA::ScreenShot.init
    162.     hzm_vxa_screenshot_run
    163.   end
    164. end
    复制代码


    Credit and Thanks
    - Original Author: Rutan
    - English translation: tale

    License - Public Domain, this means commercial use is allow and credit is not necessary

    Source
    https://torigoya.hatenadiary.jp/entry/20111221/rgss3


    本贴来自国际rpgmaker官方论坛作者:ovate处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/printscreen-screenshot.74832/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 06:15 , Processed in 0.131226 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表