Taking screenshots in game

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Taking screenshots in game

Postby Taretia » Thu Jan 03, 2008 9:28 pm

Hi!

Could anyone help me, please?
I'd like to know, if it's possible to take screenshots/photos in a game, I create with AM.
I want to use it, as this: the player would be able to take pictures and then see them in game. My gameidea involves taking pictures of other characters ingame and then using them for other things, so they should become a part of an album or something, where the player can click on them, see them and act on them.
Is this possible? I hope I explained well... :lol:
Thanks,
Taretia
Taretia
Taretia
Active Member
 
Posts: 97
Joined: Fri Jul 22, 2005 4:23 pm
Location: Ireland

Postby GM-Support » Fri Jan 04, 2008 2:20 am

Hi,

Yes, this is possible.

1) Create a PictureBox. To do so, use this code:
Code: Select all
LoadControl PictureBoxObject(1)
PictureBoxObject(1).Width = 640 * 15
PictureBoxObject(1).Height = 480 * 15



2) Capture the current frame and display the captured frame inside the PictureBox created before. To do so, use this code:
Code: Select all
Action.CaptureFrame PictureBoxObject(1)



3) Do what you want with the captured frame.

For example, you can save the picture with the following code (use the "GetPath" function to save it to the game folder, read here for more info):
Code: Select all
PictureBoxObject(1).Picture = PictureBoxObject(1).Image
Action.SaveAPicture PictureBoxObject(1), "c:\temp.bmp"


You can display the PictureBox with the following code:
Code: Select all
PictureBoxObject(1).Left = 0 * 15
PictureBoxObject(1).Top = 0 * 15
PictureBoxObject(1).Visible = True


Etc.

4) To remove the PictureBox, use this code:
Code: Select all
UnloadControl PictureBoxObject(1)



Be sure to read the VBScript section of the online Help Document to better understand the code above.

Regards,
GM-Support
Last edited by GM-Support on Sun Jan 13, 2008 7:08 pm, edited 3 times in total.
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Postby Taretia » Fri Jan 04, 2008 9:46 am

Great! Thanks a lot! :D
Taretia
Taretia
Active Member
 
Posts: 97
Joined: Fri Jul 22, 2005 4:23 pm
Location: Ireland

Postby Softstar » Sat Jan 05, 2008 11:39 pm

I don't believe the SavePicture function works, because I keep receiving an error from the scripting engine when I have it in there, about the SavePicture command.

Would it be possible to implement the SavePicture command in an upcoming version of Adventure Maker? I made up a program with visual basic that prints any file that is specified in the arguments when it starts, so I had a BAT file that launched that exe with the command. What I was going to do is have the player be able to print out a certificate at the end of the game, by having the certificate.bmp be saved to the External folder, where the EXE and bat file were.

Anyway, it would be very much appreciated. Maybe even just making a function for Adventure Maker that you can execute in VBScript that prints what is on the screen, would be easier.
Softstar
Junior Member
 
Posts: 11
Joined: Wed Dec 26, 2007 11:46 pm

Postby Mystery » Sun Jan 06, 2008 2:43 am

Have you already tried with

Action.SaveAPicture CONTROLNAME,"FILENAME"

(that is with an "a" between save and picture?)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Softstar » Sun Jan 06, 2008 7:13 am

I tried that...

My code looks like:

Code: Select all
LoadControl PictureBoxObject(1)
PictureBoxObject(1).Width = 640
PictureBoxObject(1).Height = 480
Action.CaptureFrame PictureBoxObject(1)
PictureBoxObject(1).Picture = PictureBoxObject(1).Image
Action.SaveAPicture PictureBoxObject(1).Picture, GetPath(2) + "image.bmp"


And returns a message like this at runtime:
Image

So does this mean it is without a chance impossible in this version of AM? Because if it is possible somehow, I'm willing to try.
Softstar
Junior Member
 
Posts: 11
Joined: Wed Dec 26, 2007 11:46 pm

Postby GM-Support » Sun Jan 13, 2008 8:17 pm

Thanks Mystery, you are right.

My first post contained several errors (I have fixed them on the first post itself, so that the new people who come to this topic are not misled).

What I changed was:
- Instead of "SavePicture", use "Action.SaveAPicture", as Mystery said.
- Multiply the pixel coordinates (position and size) by 15 because the value is in "twips", not in pixels. So, instead of "640", it should be "640 x 15", and instead of "480", it should be "480 x 15".


I have just tried the following code and it works fine on my computer (it saves the picture onto the "External" sub-folder of the project folder):

Code: Select all
LoadControl PictureBoxObject(1)
PictureBoxObject(1).Width = 640 * 15
PictureBoxObject(1).Height = 480 * 15
Action.CaptureFrame PictureBoxObject(1)
PictureBoxObject(1).Picture = PictureBoxObject(1).Image
Action.SaveAPicture PictureBoxObject(1), GetPath(2) + "image.bmp"



Regards,
GM-Support
GM-Support
Forum Admin and Games Page admin
 
Posts: 2221
Joined: Thu Jun 05, 2003 7:52 pm

Postby chickens1127 » Sat Oct 04, 2008 11:37 pm

Sorry for necroposting, but just hit PrntScrn and paste it in Paint and save.
Hi... It's Chickens1127...
CHINCHILLAS ROCK!

RIP Crazygamemaker
User avatar
chickens1127
AM Magazine Moderator
 
Posts: 898
Joined: Thu Nov 22, 2007 12:49 am
Location: Awsomeville, USA

Postby mercedes » Sun Oct 05, 2008 3:33 am

Hi chickens...This method here i beleive is so u don't even have to leave AM to do it..It captures the frame and puts it in the External folder --and loads it in a Pictureboxobject..for you and you see it in Runtime..:)--I'm really happy to see this here..I have been wanting to know how to do this for a looong time..:D Good stuff!..:)

Peace
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby chickens1127 » Sun Oct 12, 2008 8:40 pm

yea, just how i do it
Hi... It's Chickens1127...
CHINCHILLAS ROCK!

RIP Crazygamemaker
User avatar
chickens1127
AM Magazine Moderator
 
Posts: 898
Joined: Thu Nov 22, 2007 12:49 am
Location: Awsomeville, USA

Postby mercedes » Sun Oct 12, 2008 8:56 pm

Hi Chickens...its done like the code u see further up here..only make sure u have the picture in your External Folder and put this code into the Advanced of the Frame u wish to show it in. Also make sure its the right size.

Code: Select all
LoadControl PictureBoxObject(1)
PictureBoxObject(1).Width = 640 * 15
PictureBoxObject(1).Height = 480 * 15
Action.CaptureFrame PictureBoxObject(1)
PictureBoxObject(1).Picture = PictureBoxObject(1).Image
Action.SaveAPicture PictureBoxObject(1), GetPath(2) + "image.bmp"


Replacing "Image.bmp" with the image of your choice..:)

Let me know if this works for u...it should..

Peace
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby chickens1127 » Mon Oct 13, 2008 12:53 pm

no, i don't need it

just was saying how i do it
Hi... It's Chickens1127...
CHINCHILLAS ROCK!

RIP Crazygamemaker
User avatar
chickens1127
AM Magazine Moderator
 
Posts: 898
Joined: Thu Nov 22, 2007 12:49 am
Location: Awsomeville, USA

Postby Lyberodoggy » Sat Jun 27, 2009 3:14 pm

Can I move the pictureboxobject? I mean can I modify its Left and Top coordinates? Because it seems like I can't
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby cpkspikyhair » Sat Jun 27, 2009 3:43 pm

Can't you just use this code?

Code: Select all
PictureBoxObject(1).Move LEFT*15,TOP*15,WIDTH*15,HEIGHT*15
PSPPC GameMaker!! Where you can find PSP and PC games up for download!
User avatar
cpkspikyhair
Games Page Administrator
 
Posts: 425
Joined: Thu Jun 28, 2007 1:49 pm
Location: On Mars (Yes There Is Water :) )

Postby Lyberodoggy » Sat Jun 27, 2009 3:54 pm

No. If you use this you still get the same result. I tried to take a screenshot of the contents of a hotspot (move the hotspot where I want, then move the picturebox on the hotspot's coordinates and take the screenshot), but It kept taking screenshots with the width and height specified, but starting from 0,0
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby mercedes » Sun Jun 28, 2009 7:15 pm

I don't know what it is u are trying to do...I didn't bother putting in left or top..just coordinates..would this work for what u are doing....? I gather that is what u have attempted and it's not working ..What is it u are trying to do again..This moves it..but sounds like u want something else..?

LoadControl PictureBoxObject(1)
PictureBoxObject(1).move 357 * 15, 2 * 15, 423 * 15, 351 * 15
PictureBoxObject(1).Visible = True
Action.CaptureFrame PictureBoxObject(1)
PictureBoxObject(1).Picture = PictureBoxObject(1).Image
Action.SaveAPicture PictureBoxObject(1), GetPath(4) + "Picture.jpg"
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Lyberodoggy » Mon Jun 29, 2009 10:05 am

The code you posted won't move the picture box to 357,2. It 'll leave it in 0,0
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby mercedes » Tue Jun 30, 2009 4:31 am

Ok, What am i not getting here.. lol..I'm not sure I understand..I see it move to those coordinates..[I make a hotspot first]--to judge where i want it to go...Que passa..? :P
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Lyberodoggy » Tue Jun 30, 2009 10:50 am

Try to capture a screenshot inside those coordinates. It WON'T be captured there, it will capture the area ranging from the start of the screen to the height and width you specified.

That's really wierd because a picturebox can be moved normally in VB 6
User avatar
Lyberodoggy
Administrator
 
Posts: 2519
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron