Project1

标题: 按键截图的问题 [打印本页]

作者: 星辰天羽    时间: 2008-10-28 20:05
标题: 按键截图的问题
我想问下那个脚本只能全部存为一张图片,新的截图会覆盖原来的,我想要自动保存成日期时间的格式,分开保存在一个文件夹里,该怎么做呢?? [LINE]1,#dddddd[/LINE]版务信息:本贴由楼主自主结贴~
作者: 千落樱·念晓    时间: 2008-10-28 20:08
话说标题不要加上人名………

作者: 雪流星    时间: 2008-10-28 20:13
那个按键截图??
作者: 星辰天羽    时间: 2008-10-28 20:16
以下引用snstar2006于2008-10-28 12:13:38的发言:

那个按键截图??



http://rpg.blue/viewthread.php?tid=96618&ntime=2008%2D10%2D28+12%3A16%3A22
作者: 雪流星    时间: 2008-10-28 20:33
在試試看
其實就是修改了檔案命名方式而已
順便...我另外弄了一個文件夾,要在Pictures裡面建一個ScrnShot
改成了在任何畫面都可以截圖
  1. #===============================================================================
  2. #
  3. # Screenshot V2
  4. #
  5. # Screenshot Script v1 & screenshot.dll v1            created by: Andreas21
  6. # Screenshot Script v2                                created/edit by: cybersam
  7. # the autor is found on a german board...
  8. # the comments are added by me...
  9. # since the autor didnt want to add any comment...
  10. # so thats it from here...
  11. # have fund with it... ^-^
  12. #
  13. # oh yea.. the needed command line is found in "Scene_Map" in "def update"
  14. #
  15. #===============================================================================
  16. module Screen
  17.   ##
  18.   ##
  19.   @screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
  20.   @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
  21.   @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
  22.   module_function
  23.   #-----------------------------------------------------------------------------
  24.   # here comes the stuff...
  25.   # i add here the stuff for automatic change of the number for the screenshot
  26.   # so it wont overrite the old one...
  27.   # if you want to change so stuff change them in this line below
  28.   # or you can change them in your command line... like
  29.   # Screen::shot("screenshot", 2)
  30.   # this change the name and the type of the screenshot
  31.   # (0 = bmp, 1 = jpg and 2 = png)
  32.   # ----------------------------------------------------------------------------
  33.   def shot(file = "screenshot", typ = 2)
  34.     # to add the right extension...
  35.     if typ == 0
  36.       typname = ".bmp"
  37.     elsif typ == 1
  38.       typname = ".jpg"
  39.     elsif typ == 2
  40.       typname = ".png"
  41.     end   
  42.     file_index = 0   
  43.     dir = "Graphics/Pictures/ScrnShot/"
  44.     # make the filename....
  45.     value = Graphics.frame_count / Graphics.frame_rate
  46.     file_name = dir + file.to_s + value.to_s + typname.to_s
  47.     # make the screenshot.... Attention dont change anything from here on....
  48.     @screen.call(0,0,544,416,file_name,handel,typ)
  49.   end
  50.   # find the game window...
  51.   def handel
  52.     game_name = "\0" * 256
  53.     @readini.call('Game','Title','',game_name,255,".\\Game.ini")
  54.     game_name.delete!("\0")
  55.     return @findwindow.call('RGSS Player',game_name)
  56.   end
  57. end

  58. class Scene_Base
  59.   #--------------------------------------------------------------------------
  60.   # ● 开始处理
  61.   #--------------------------------------------------------------------------
  62.   alias scrn_shot_update update
  63.   def update
  64.     scrn_shot_update
  65.     if Input.press?(Input::F5)
  66.       Screen::shot
  67.     end
  68.   end
  69. end  
复制代码
[LINE]1,#dddddd[/LINE]系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者: yangff    时间: 2008-10-28 20:38
#===============================================================================
#
# Screenshot V2
#
# Screenshot Script v1 & screenshot.dll v1            created by: Andreas21
# Screenshot Script v2                                created/edit by: cybersam
# the autor is found on a german board...
# the comments are added by me...
# since the autor didnt want to add any comment...
# so thats it from here...
# have fund with it... ^-^
#
# oh yea.. the needed command line is found in "Scene_Map" in "def update"
#
#===============================================================================
module Screen
  ##
  ##
  @screen = Win32API.new 'screenshot', 'Screenshot', %w(l l l l p l l), ''
  @readini = Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l'
  @findwindow = Win32API.new 'user32', 'FindWindowA', %w(p p), 'l'
  module_function
  #-----------------------------------------------------------------------------
  # here comes the stuff...
  # i add here the stuff for automatic change of the number for the screenshot
  # so it wont overrite the old one...
  # if you want to change so stuff change them in this line below
  # or you can change them in your command line... like
  # Screen::shot("screenshot", 2)
  # this change the name and the type of the screenshot
  # (0 = bmp, 1 = jpg and 2 = png)
  # ----------------------------------------------------------------------------
  def shot(file = "screenshot", typ = 2)
    # to add the right extension...
    if typ == 0
      typname = ".bmp"
    elsif typ == 1
      typname = ".jpg"
    elsif typ == 2
      typname = ".png"
    end   
    file_index = 0   
    dir = "Graphics/Pictures/"     
    # make the filename....
    file_name = dir + file.to_s + typname.to_s
    # make the screenshot.... Attention dont change anything from here on....
    @screen.call(0,0,544,416,file_name,handel,typ)
  end
  # find the game window...
  def handel
    game_name = "\0" * 256
    @readini.call('Game','Title','',game_name,255,".\\Game.ini")
    game_name.delete!("\0")
    return @findwindow.call('RGSS Player',game_name)
  end
end

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● 开始处理
  #--------------------------------------------------------------------------
  def update
    super
    $game_map.interpreter.update      # 更新解释器
    $game_map.update                  # 更新滴入
    $game_player.update               # 更新玩家
    $game_system.update               # 更新计时器
    @spriteset.update                 # 更新活动块元件
    @message_window.update
    # 更新消息窗口
    unless $game_message.visible      # 正在显示消息以外的情况
      update_transfer_player
      update_encounter
      update_call_menu
      update_call_debug
      update_scene_change
    end
    if Input.press?(Input::F5)
      Screen::shot("截图" + (rand(5000)+1000).to_s + Time.now.strftime("%c").to_s
    end
  end
end  





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