Author Topic: [XP] Snapshot  (Read 13358 times)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
[XP] Snapshot
« on: June 13, 2010, 01:45:24 AM »
Snapshot
Authors: game_guy
Version: 1.0
Type: Picture Taking Script
Key Term: Misc Add-on

Introduction

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

Screenshots

Here's how well the pictures come out. No windows borders or anything.
(click to show/hide)

Demo

Download

Script

You'll also need the screenshot.dll for this script to function correctly.
(click to show/hide)

Instructions

In the script. Its recommended to place this above main but below everything else. It shouldn't cause issues with anything.

Compatibility

Not 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 Notes

Enjoy!
« Last Edit: June 13, 2010, 04:18:38 PM by game_guy »

Offline Spaceman McConaughey

  • Legit Poo Poo Man
  • Lexima Warrior
  • *******
  • Posts: 2002
  • LV: 46
  • Gender: Male
  • muh murph
    • View Profile
    • Titties, titties, and more titties!
Re: [XP] Snapshot
« Reply #1 on: June 13, 2010, 01:56:12 AM »
Epic script is epic. <3

*lvls up*

Offline WhiteRose

  • Trying to code in Ruby
  • Moderator
  • Lexima Warrior
  • ***
  • Posts: 2339
  • LV: 127
  • Gender: Female
  • <3
    • View Profile
Re: [XP] Snapshot
« Reply #2 on: June 13, 2010, 01:58:13 AM »
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....

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] Snapshot
« Reply #3 on: June 13, 2010, 02:04:22 AM »
Lawl! Hahaha thanks!

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20013
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Snapshot
« Reply #4 on: June 13, 2010, 10:16:59 AM »
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.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] Snapshot
« Reply #5 on: June 13, 2010, 04:19:04 PM »
Scripters may have made one, but I never seen one release one D:

Updated credits

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20013
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Snapshot
« Reply #6 on: June 13, 2010, 05:27:34 PM »
I think I actually posted one a long time ago.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] Snapshot
« Reply #7 on: June 13, 2010, 05:35:33 PM »
.___. why is it most of my scripts are of utter uselessness or have already been made

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20013
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Snapshot
« Reply #8 on: June 13, 2010, 07:19:55 PM »
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.
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] Snapshot
« Reply #9 on: June 13, 2010, 07:27:14 PM »
Where is your screenshot script? Is it in the dev pack?

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20013
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Snapshot
« Reply #10 on: June 13, 2010, 07:46:26 PM »
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. >.<

Code: [Select]
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# 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;
« Last Edit: June 13, 2010, 07:48:43 PM by Blizzard »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] Snapshot
« Reply #11 on: June 13, 2010, 07:54:49 PM »
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

Offline Blizzard

  • This sexy
  • Administrator
  • has over 9000 posts
  • *****
  • Posts: 20013
  • LV: 651
  • Gender: Male
  • Magic midgets.
    • View Profile
    • You're already on it. (-_-')
Re: [XP] Snapshot
« Reply #12 on: June 13, 2010, 09:53:03 PM »
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.)
« Last Edit: June 13, 2010, 09:55:24 PM by Blizzard »
Check out Daygames and our games:

King of Booze      King of Booze: Never Ever      Pet Bots
Drinking Game for Android      Never have I ever for Android      Pet Bots for Android
Drinking Game for iOS      Never have I ever for iOS      Pet Bots for iOS
Drinking Game on Steam


Quote from: winkio
I do not speak to bricks, either as individuals or in wall form.

Quote from: Barney Stinson
When I get sad, I stop being sad and be awesome instead. True story.

Offline lonely_cubone

  • Transcended Spirit
  • ***
  • Posts: 227
  • LV: 6
  • Gender: Male
  • OMG IT'S A CUBONE
    • View Profile
Re: [XP] Snapshot
« Reply #13 on: June 13, 2010, 10:04:46 PM »
This is really useful, even if Blizz apparently made it already! Way faster, easier, and more efficient than Print Screen :D. *lvls*

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] Snapshot
« Reply #14 on: June 13, 2010, 11:03:19 PM »
thanks!

@blizz: I understand. I think you've also said this to me a few other times in the past xD

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5135
  • LV: 198
  • Gender: Female
  • Wants to write a compiler for fun
    • View Profile
Re: [XP] Snapshot
« Reply #15 on: June 14, 2010, 01:52:53 AM »
now G_G take this script and make a save game menu with screen shotsshots script
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline Jragyn

  • Ethereal Devastator
  • ****
  • Posts: 311
  • LV: 20
  • Gender: Male
  • A prodigy... maybe? Hoo hah.
    • View Profile
    • facenbooken.
Re: [XP] Snapshot
« Reply #16 on: June 14, 2010, 02:22:00 AM »
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
A bright light can either illuminate or blind, but how will you know which until you open your eyes?

Offline earthnite

  • Transcended Spirit
  • ***
  • Posts: 194
  • LV: -53
  • Gender: Male
    • View Profile
Re: [XP] Snapshot
« Reply #17 on: June 14, 2010, 02:22:52 AM »
i hope he does
i ran to the shimmering light in the darkness--only to find a freight train coming my way

Offline lonely_cubone

  • Transcended Spirit
  • ***
  • Posts: 227
  • LV: 6
  • Gender: Male
  • OMG IT'S A CUBONE
    • View Profile
Re: [XP] Snapshot
« Reply #18 on: June 14, 2010, 03:50:42 AM »
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.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: [XP] Snapshot
« Reply #19 on: June 14, 2010, 05:52:35 AM »
stop giving me script ideas D:

I might do something like that. Who knows.