SRL Archive - SRL Suggestions

More useful TakeScreenshot


Harry

2011-11-26 04:30:46

{*******************************************************************************
procedure TakeScreen(reason: String);
by: Mutant Squirrle edit yakman
Description: Takes a screenshot if the global Screenshots is true,
Adds +TimeRunning+ to the path, so no screenshots will overwrite each other.
Adds '.bmp' to the end, will not crash the script if it goes wrong.
Todo: Make PNG when Simba supports it properly.
*******************************************************************************}

procedure TakeScreen(Reason: string);
begin
if(not Screenshots)then Exit;
try

if FileExists(SRLSavePath + reason + ' ' + Players[CurrentPlayer].Name + '.bmp') then
SaveScreenshot(SRLSavePath + reason + ' ' + Players[CurrentPlayer].Name + ' ' + TimeRunning + '.bmp')
else
SaveScreenshot(SRLSavePath + reason + ' ' + Players[CurrentPlayer].Name + '.bmp');

WriteLn('Screenshot of: ' + reason + ' ' + TimeRunning);
except
Writeln('Failed to save screenshot of: ' + reason);
end
end;

I spiced it up a bit. Before it was sorta useless.

Now it appends your login username onto the bitmap, and only adds TimeRunning if a file with same filename exists.

Todo: make it save as lossless pngs, using a lot less space than bitmaps. Simba "should" be able to save as pngs, but it appears to be broken to me as it saves as a corrupt 1kb png.

Gu3st...

2011-11-26 09:47:49

File a bug report about the .png problem :)

Harry

2011-11-26 22:06:00

Sure but this should be committed in the meantime.

Also, Maze antirandom is using SaveScreenshot instead of TakeScreen, so please change that as well when this is committed. And some of the other antirandoms don't save screenshots at all. :|

Harry

2011-11-28 01:05:42

Bump.

Maze savescreenshot is near line
If DetectedPath = TurquoisePath Then

Change the SaveScreenshot to TakeScreen('Maze'); and it should be useful.

Coh3n

2011-11-28 21:20:02

Saving as a .png works sometimes for me, but other times it's a corrupt file, like you said.

Anyway, committed this. Thanks, Harry.