Snapshot
Authors: game_guy
Version: 1.0
Type: Picture Taking Script
Key Term: Misc Add-on
IntroductionEver wanted to take screenies or snapshots ingame? While there are other methods of doing that, this one is by far the easiest. With a simple button press or script call, it'll take a screenshot of the game for you and save it in a folder.
Also useful for beta testing. Your testers can snapshot bugs or errors in mapping or stuff like that.
Features
- Take picture with button press or script call
- Customizable Button to press
ScreenshotsHere's how well the pictures come out. No windows borders or anything.
(http://i678.photobucket.com/albums/vv143/GameGuysProjects/snap_5.png)
DemoDownload (http://decisive-games.com/ggp/scripts/Snapshot.exe)
ScriptYou'll also need the screenshot.dll (http://decisive-games.com/ggp/scripts/screenshot.dll) for this script to function correctly.
#===============================================================================
# Snapshot
# Author game_guy
# Version 1.0
#-------------------------------------------------------------------------------
# Intro:
# Ever wanted to take screenies or snapshots ingame? While there are other
# methods of doing that, this one is by far the easiest. With a simple button
# press or script call, it'll take a screenshot of the game for you and
# save it in a folder.
# Also useful for beta testing. Your testers can snapshot bugs or errors in
# mapping or stuff like that.
#
# Features:
# Take picture with button press or script call
# Customizable Button to press
#
# Instructions:
# Place screenshot.dll in your projects folder.
# Get the dll here if you need it
# http://decisive-games.com/ggp/scripts/screenshot.dll
# Make a folder in your projects folder called Snapshots
#
# Go down to the line where it says SnapShot_Key = Input::A
# You can change Input::A to any of the following
# Input::A - Usually the Shift Key
# Input::B - Usually the X or Escape key
# Input::C - Usually C, Enter, or Space
# Input::X - Usually the A Key
# Input::Y - Usually the S Key
# Input::Z - Usually the D Key
# Input::L - Usually the Q Key
# Input::R - Usually the W Key
# Input::SHIFT
# Input::CTRL
# Input::ALT
# Input::F5
# Input::F6
# Input::F7
# Input::F8
# Input::F9
#
# To take a snapshot with a script call use this
# GameGuy.snap thats it!
#
# Compatibility:
# Not tested with SDK. (Should work though)
# Will work with anything.
#
# Credits:
# game_guy ~ For making it
# Google ~ Searching up Win32Api tutorials
# Screenshot.dll ~ Whoever made this, made this script possible
#===============================================================================
module GameGuy
SnapShot_Key = Input::A # Shift Key
def self.snap
snp = Win32API.new('screenshot.dll', 'Screenshot', %w(l l l l p l l), '')
window = Win32API.new('user32', 'FindWindowA', %w(p p), 'l')
ini = (Win32API.new 'kernel32', 'GetPrivateProfileStringA', %w(p p p p l p),
'l')
game_name = "\0" * 256
ini.call('Game', 'Title', '', game_name, 255, '.\Game.ini')
game_name.delete!('\0')
win = window.call('RGSS Player', game_name)
dir = Dir.new("Snapshots/")
count = 0
dir.entries.each {|i| count += 1}
file_name = "Snapshots/snap_#{count}.png"
snp.call(0, 0, 640, 480, file_name, win, 2)
end
end
module Input
class << self
alias gg_update_input_snapshot_lat update
end
def self.update
if Input.trigger?(GameGuy::SnapShot_Key)
GameGuy.snap
end
gg_update_input_snapshot_lat
end
end
InstructionsIn the script. Its recommended to place this above main but below everything else. It shouldn't cause issues with anything.
CompatibilityNot tested with SDK. (Should work anyways)
Should work with everything.
Credits and Thanks
- game_guy ~ For making it
- Google ~ Searching up Win32Api tutorials
- Andreas21 ~ Making screenshot.dll
Author's NotesEnjoy!
Epic script is epic. <3
*lvls up*
G_G, do you know what this means? No more walking through people on how to use the Print Screen button. Good times... goooooooood times....
Lawl! Hahaha thanks!
Lol, been there, done that. xD I think 50% of the more experienced scripters made a script using the Screenshot.dll. xD
BTW, Andreas21 made the DLL.
Scripters may have made one, but I never seen one release one D:
Updated credits
I think I actually posted one a long time ago.
.___. why is it most of my scripts are of utter uselessness or have already been made
Bullshit. It's not useless. And plenty of scripts I made were already made as well. My Party Switcher, my Stat Distribution System, the screenshot script (yeah, there were some around before my time), ABS, online system, etc.
What I'm trying to say is that you should take a look at my code. You might learn something or get an idea how to improve your code. Or not if my code sucks.
Where is your screenshot script? Is it in the dev pack?
No. And I actually can't find it posted here anywhere. O_o
I found this in an old backup, though. The main thing to do would be to change the script so it aliases module Input rather than having to edit every possible scene. >.<
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Screenshot Kit
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Credits:
#
# screenshot.dll - Andreas21
# calling script and instructions - Blizzard
#
#
# Instructions:
#
# Place the screenshot.dll in your game's main folder. To make a screenshot
# system adding a code line in every Scene_SOMETHING script. Usually
# part of the script looks like this:
#
# class Scene_SOMETHING
# def main
# ...
# loop do
# Graphics.update
# Input.update
# ### HERE COMES THE EXTRA LINE!
# update
# if $scene != self
# break
# end
# end
# ...
# end
# end
#
# The extra line that you need to add has to look like this:
#
# Screen.shot if Input.trigger?(Input::KEY)
#
# KEY - the key that is being pressed to take a screenshot
#
# Keep in mind that you can only use RMXP's predefined keys (like A, X, Y, Z,
# F5, F6, etc.). If you are using Blizz-ABS or Custom Game Controls from Tons
# of Add-ons, you can use any key (Key['Arrow Up'], Key['U'], etc.). If you
# have another custom controls script, you can use on of its keys instead.
#
#
# Note:
#
# Your files will be saved as:
#
# "PATH" + "FILENAME" + "DD.MM.YYYY HH-MM-SS" + "EXTENSION"
#
# DD.MM.YYYY - date
# HH-MM-SS - time
#
# Keep in mind that making two screenshots in one second will result the
# previous screenshot to be deleted.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module Screen
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# folder where screenshots are placed, leave empty for main folder
PATH = 'Screenshots/'
# basic filenames
FILENAME = 'My Game @ '
# file extension/format (0 = BMP, 1 = JPG, 2 = PNG)
EXTENSION = 2
# sound effect to be played (leave FILENAME empty for none)
# template: RPG::AudioFile.new('FILENAME', VOLUME, PITCH)
SOUND = RPG::AudioFile.new('snap', 80, 100)
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# module RPG::Cache
#==============================================================================
@screen = Win32API.new 'screenshot.dll', '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'
def self.shot
game_name = "\0" * 256
@readini.call('Game', 'Title', '', game_name, 255, './Game.ini')
game_name.delete!("\0")
window = @findwindow.call('RGSS Player', game_name)
time = Time.new
extension = case EXTENSION
when 0 then '.bmp'
when 1 then '.jpg'
when 2 then '.png'
end
@screen.call(0, 0, 640, 480, time.strftime(
PATH + FILENAME + '%d.%m.%Y %H-%M-%S' + extension), window, EXTENSION)
if SOUND.name != ''
Audio.se_play('Audio/SE/' + SOUND.name, SOUND.volume, SOUND.pitch)
end
end
end
I hope it's not buggy. O.o;
In a sense, mines more efficient, but yours has a few more features mine didn't. On top of that, if you were to code this from scratch now you would have already new to alias Input.update. Believe me, if I saw this here already, I wouldn't have made it. Well maybe I would have who knows xD
I really can't remember where it was posted. I probably just put it in the middle of a topic or something. xD
As I said, there's nothing wrong with you posting this. :)
EDIT: BTW, getting the window handler ID with @findwindow should be done only once at the initialization of the game. Best you put it in a constant and use it later when you make the screenshot. This speeds things up because two API calls don't need to be done each time. (I'm referring to my code, not yours.)
This is really useful, even if Blizz apparently made it already! Way faster, easier, and more efficient than Print Screen :D. *lvls*
thanks!
@blizz: I understand. I think you've also said this to me a few other times in the past xD
now G_G take this script and make a save game menu with screen shotsshots script
I've seen one for VX that did the savescreen screenshot thing, minus characters o.O
It doesn't have the screenshot.dll tho, how does that work?
--J
Quote from: Ryexander on June 13, 2010, 07:52:53 pm
now G_G take this script and make a save game menu with screen shotsshots script
That would be really helpful. I don't think it'd be too hard, although I have no clue how to do it :n00b:
Seriously though, that would be a great script.
stop giving me script ideas D:
I might do something like that. Who knows.
Would you permit me to use this script in a camera-script I am making for my game? Credit will be given of course.
Sure no problem!
Quote from: jragyn00 on June 13, 2010, 08:22:00 pm
I've seen one for VX that did the savescreen screenshot thing, minus characters o.O
It doesn't have the screenshot.dll tho, how does that work?
--J
VX already has a built in snapshot thing I think.
Demo and dl for the .dll are missing. Would like an reupload please :3
I have the dll for reason unknown... But i don't have the demo...
Sorry to necropost but the demo and .dll links are missing. :???:
Here.
http://www.sendspace.com/file/aiirus