Product Chat / Taking screenshots for later use - save/loadgame standalone menu.

Author
Message
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 28th Mar 2017 16:58
Hi guys
This time I'm coming with other workaround, take screenshoot while testing/Playing standalone, for later use; save/load game menu.

Firts of all there is not a way to capture screen via plane LUA standard api, without using external libs/modules.

There are different ways we can capture screen via code, anyway we just can use those being handle/compatible, wih LUA.

1- The well know f10 key. whose take shot and saved it into your "GameGuru files" folder.

>CONTS<

a-F10 does not gives us the chance to select where you want to store these shots.
b- You need phisycally hit the f10 key to take shots*

There are many other ways using keystrokes combination, in fact I've got all them working fine via LUA script.

SO, WHAT'S THE PROBLEM?
Well, the problem is as follow:

You need to use some sort of sendkey to send the keystrokes to the system, so windows behave like you are pressing these keys.
And all them takes the shoot as expected, the problem is that ugly/black cmd win appearing on the top of the screenshot, that makes the shot useless to be use as Loadgame shot.

There is not way to avoid that cmd win, I'm using os.execute to run the command line, but as I've readed from the net:



Quote: "The problem with os.execute is that it uses C system function under the hood, which in turn is probably implemented by executing the Windows command shell executable cmd.exe, which is a command line application. Thus every time you use os.execute you are indeed executing cmd.exe. That black box is the console window associated with cmd.exe being executed."


GG does not respond to the f10 keypress event (using sendkey command), does not capture the screen, such as when you press the f10 key.

For those than don't know, sendkey is a command than emulate keys being pressed, so: "sendkey ctrl+alt+del" open the taskmanager, like you has pressed them, phisycally.

But GG does not, when you send key f10. I don't know why, It would be nice if Lee can give me some clue.

Summarizing, all forms that involve sending a combination of keys, also involve the use of comman lines, or what is the same, the cmd window appearing above the screenshot, see pic above.

SO HOW YOU MANAGE TO GET IT WORKING?

i'm using 2 dll files, those files allow me work with command line from GG, via LUA script. And take the screenshot, for later use.

Those 2 dll files should sit on your C:\Windows folder. See below why is better spot to store them.

Bassically I've modified a bit, savegame and loadgame.lua files.

I HAS TO DO SOMETHING?
unfortunatelly YES. Till I got the way to hide/minimize cmd win, so does not distort the screenshot, yes, you has to. Below you'll know what.

There is only one way to get clear screenshot, being able to choose folder where you want store them, without using command line. I've think about store these shot into your "C:\Users\yourProfile\Documents\Game Guru Files\My Games\YourGameName\Files\titlesbank\default" folder, so all is well sorted here.

SO, WHAT SOULD I DO

1- Press printscreen key.
2- Press ESC>Menu>Savegame>and choose free slot as usually.
at this point you'll see a bit moment, the cmd popups and dissapears when you move, and/or mouseclick.

AND WHAT IT DOES EXACTLY?

As you can see in the video below, it takes the screenshot and save it into a file, withing your default folder.
Then once done, you can see these shots in LOADGAME menu, while scrolling thru the visited links, so you can have the idea where this save file is.

ABOUT THOSE 2 DLLS - nircmd

Quote: "This utility is a standalone executable, and it doesn't require any installation process or additional DLLs. just copy the executable to any folder you want, and run it with the desired command-line option, according to your needs.
It's recommended to copy the executable of NirCmd (nircmd.exe) to your windows directory, or to any other folder listed in your PATH environment variable, so you won't need to type the full path of nircmd in each time that you want to use it. "



License

Quote: "This dll is released as freeware. You are allowed to freely distribute this component via floppy disk, CD-ROM, Internet, or in any other way, as long as you don't charge anything for this."



I want to give all credits to the nircmd tool team, they make some great tool, thanks for share it.

Download link

It comes with 3 files: 2 dlls and 1 chm file as help file. I've copy these 2 dlls into my C:\Windows directory.

I must prefer giving you the link so you can download them if you want to, instead of distribute them with my zip, to avoid issues and bad ideas.


WHAT ZIP FILE CONTAIN?

1- 2 scripts: savegame and loadgame.lua files
2- 1 pic named "screenshot" - this is the sprite bachground (what you seen, when in free slot/back button). Keep their name, if you change it so you'll need to change in the script as well.

These 2 LUA files coming to replace the originals, in your default folder (standalone)

Place those 3 files into your "C:\Users\yourProfile\Documents\Game Guru Files\My Games\YourGameName\Files\titlesbank\default" folder.

DON'T FORGET TO PRESS printscreen BEFORE DO NOTTHING!!!

I'll continue to working on get the way to avoid cmd win distorting the screenshot, so you'll just has to press ESC>Menu>Savegame as usually. Meantime please press printscreen and follow the steps as pointed above, and as in the video.



hth

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

Attachments

Login to view attachments
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 31st Mar 2017 20:23 Edited at: 31st Mar 2017 20:30
Now coming with improved system to take screenshots, and use them in menu>loadgame.

Zip file contain the folder named "Default"

HOW TO
1- Unzip file attached below
2- Backup your "Default" folder. (C:\Users\YourProfile\Documents\Game Guru Files\My Games\YourGameName\Files\titlesbank\default)
3- replace your "Default" folder by the zipped one, and you are done.

SAVEGAME
Now you don't have to press any key; just go to menu>savegame as normal.
Once there, you'll be prompted to minimize the ugly/black cmd win, once done just click ok, and you are done.

LOADGAME
Go to menu>loadgame as normal, once there you'll notice all the shots you've take so far. Those shots will help'u to know where these saves are.

WINGAME
you now has the win congrats+victory music.

GAME OVER
You now has the gameover+lose music.

As bonuses

DELETE ALL SAVEGAME FILES, AND START FROM SCRACH
I've never worked with standalone till now, I've to take fast/intensive course LOL, and now than I'm testing once and again, tons of times; I've notice I need some fast way to start from scrach, I've try to figure out the process, for those than don't know.

When you start from scrach you've in SAVEGAME folder files as follow:
1- readme.txt

When you play and save firts time, GG create new files in SAVEGAME folder, as follow:
1- gamenamenumber.dat
2- gameslot1.dat (the more saves you've, the more save files GG create)

FILE gamenamenumber.dat
Store the saveslot number, so firts time you save game, it is=1, after = 2, and so on.

FILE gameslot1.dat
Store all the info about the level you are playing, plus the relevant infor about the save (player pos, items pos, weapons, and a long etc)

SCREENSHOTS
They are stored in DEFAULT folder.

SAVEGAME.LUA - LOADGAME.LUA - DEL_STAND_FILES.LUA - LOSE.LUA - WIN.LUA SCRIPTS
Those are the files I had modified/created, they are in DEFAULT folder

AUDIOBANK/MUSIC FILES
Here you has to store all the audio files you want add, after standalone is done.
I don't share the sounds since they are not mine, most of them are dowloaded from freesounds

WHAT DEL_STAND_FILES.LUA FILE DOES?

1- remove all gameslot files from SAVEGAME folder.
2- Open/edit gamenamenumber.dat file (reset value to 0, to start from scrach)
3- Remove all screenshots from DEFAULT folder, so you can take news.

Most likely you don't has to do, but me, since I have to test a lot of times, and this script is the way to start fastest; you add the script to a barrel in GG, with the standalone file closed, and run the script; go to your standalone>savegame folder, and you'll notice all is like the firts time, ready to start again from scrach, so you don't has to deal with.

ABOUT gametype.txt file
This file stored the type/style of your game - please type here the number of your gametype.

ABOUT gametype_howto.txt file
This file store all the relevant info about the gametypes, (I've covered most of them, if I've missed someone, please let me know)
Here you can to know which the number your gametype is.

ABOUT SPRITES
Script will upload the sprite accordingly with your gametype, and play the accurate music as well.
So if your game is ww2 style, so you'll get ww2 music+ww2 sprite; just type 2 in the gametype.txt file.

Take into account than if your game is ww2 at start, most likely it'll be ww2 till the end; so you'll has to type the style number, just once.

ABAOUT THE BACKGROUND IMAGES
As you already know, GG upload background pics, accordingly with your res. I've edited a couple of them (win and lose).
Notice you will have to make your own, since they should be customized for your game style.
And you'll has to make one background pic for each res. Mine is 1680x1050.

SOME SPRITES - FANTASY AND WW2 GAME TYPE (styles)






VIDEOS - Sorry about the audio, my speakers have broken down, I need new speakers, but my pocket does not want to know anything about extra expenses. LOL

WIN GAME - Congrats + victory music



LOSE GAME - GAME OVER + lose music



SAVE/LOAD GAME + backgroun music



If I've missed something, please let know and well sure I'll give my best.

Thanks to all for watch my videos. Of course all feedbacks are welcome. 9:00 here, I'm going to take my bed (hollyday till monday).

hth

Download Link

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 3rd Apr 2017 17:23
Nice!, I've a thread just for me.
So continue...

LOADING.

Loading.lua file load sprites/pics, and start your game.

ABOUT _INIT PART
Here all the resource sprites + pics are loaded.
This part is handled by LUA.

ABOUT _MAIN PART
This part is out of LUA system.
This part is handled by internal code, all the sprites must be in resource file, in the GG project.
When the code tell:



mate, you lose the control of the code. All code you add to this part is being ignored, since LUA file stop being executed, internal code has taking the control, and there is nothing you can do.
To avoid the code return here, even the trash is cleaned from there.
Noticed, function loading_free() part.

I've done till the code allow me, the rest, just Master Lee can done.

If someone are interested about, i can post here, like so far.



3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 3rd Apr 2017 17:26
ABOUT

About part is hight customizable, I've done something related:



Again, if someone is interested I can post here, it might help you as guide to do your own.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
lotgd
3D Media Maker
14
Years of Service
User Offline
Joined: 2nd Apr 2010
Location: italy
Posted: 29th Apr 2017 18:42
@3com many thanks

My Pc Specs : Win10pro64bit /Msi z97 / i74770k / gtx1070 / 16gb ram / SSD 850Evo
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 30th Apr 2017 13:26
You are welocome

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 30th Mar 2019 16:03
Thread unlocked as it is relevant to today's needs.

Thanks 3Com
RIP
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

New:
Intel(R) Core(TM) i5-8400 CPU @ 2.81GHz, 12GB RAM, Nvidia gtx1050ti 4gb, Windows 10 Home 64bit, Screen resolution 1920 x 1080. System Passmark 3774




granada
Forum Support
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 30th Mar 2019 18:09
Just spotted this ,cool work

Dave
Windows 10 Pro 64 bit
GeForce GTX 1050 Ti
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
1920x1080,60 Hz
PM
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 28th Apr 2019 06:12
Hey. Interesting. Just not clear.
Does this play video while loading?
PM
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 28th Apr 2019 17:12 Edited at: 28th Apr 2019 17:12
I always use the prtsc button, but that is obviously limited to one use at a time. So this sounds useful to make multiple screenshots. It's a pity GG doesn't have a capture screen area command, although it is an extra I would like rather than actually getting the engine solid - which is more important.
SPECS: Ryzen 1700 CPU. Nvidia 970GTX. 16 Gig Memory. Win 10.
GubbyBlips
5
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 11th Jul 2019 02:54
Cool! This is the type of work that should be pinned to the top.
And/ or implemented in core GG. Was that the use of the standard
Text in lua and was it a Sprite for images?
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 11th Jul 2019 16:50
Quote: " Was that the use of the standard
Text in lua and was it a Sprite for images"

Yes, is something like that, nor video here. Revise lua files might help to get more info about.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM

Login to post a reply

Server time is: 2024-11-24 00:52:16
Your offset time is: 2024-11-24 00:52:16