Ok heres a little addon that n3ss3s has allowed me to add
Ex.1 Copying the proggie into a textfile
This is useful for scripters who want to prevent script users from accidently forgetting to save the proggie.
SCAR Code:
procedure SaveDebugToFile;
var
DebugText: string; DebugFile: Integer;
begin
DebugFile := RewriteFile(ScriptPath + 'Zephyr''s Rune Mysteries Quest Runner Progress Report' + '.txt', False);
DebugText := GetDebugText;
WriteFileString(DebugFile, DebugText);
WriteLn('Saved debug to file: ' + ScriptPath + 'Zephyr''s Rune Mysteries Quest Runner Progress Report' + '.txt');
CloseFile(DebugFile);
end;
As you can see, the debug is stored in the DebugText variable which is then written to the file using WriteFileString.
Ex.2 A countdown
Well the usefulness of this is questionable but I use it my shutdown function to make it look cool (if that is the right word).
SCAR Code:
procedure Shutdown;
var
Timer, Temp2, Temp1: string;
Spaces: Integer;
begin
WriteLn('[------------------------------------------------------------------------------]');
WriteLn('[ ]');
WriteLn('[ ]');
WriteLn('[ ]');
WriteLn('[------------------------------------------------------------------------------]');
for i := 30 downto 0 do
begin
if (i = 0) then
Timer := 'Shutting down...'
else
Timer := '[Shutting down in ' + IntToStr(i) + ' seconds... Press Ctrl-Alt-S to stop.]';
Spaces := 78 - Length(Timer);
Temp1 := Timer;
for j := 0 to Ceil(Spaces / 2) do
Insert(' ', Temp1, 2);
Temp2 := Temp1;
for j := 0 to Floor(Spaces / 2) do
Insert(' ', Temp2, Length(Temp1));
ReplaceDebugLine(GetDebugLineCount - 3, Temp2);
Wait(1000);
end;
Thats the first part of it where it writes stuff in the debug box. Most of it is just so it looks nice but just ignore that. You just have to know that it looks something like this:
SCAR Code:
[------------------------------------------------------------------------------]
[ ]
[ Shutting down in 30 seconds... Press Ctrl-Alt-S to stop. ]
[ ]
[------------------------------------------------------------------------------]
The important part is this line:
SCAR Code:
ReplaceDebugLine(GetDebugLineCount - 3, Temp2);
It uses GetDebugLineCount to get the last line of the debug then takes 3 to get the third last line of the debug. It then replaces this line with a new line. This effectively counts down from 30 all the wait to 0. Of course you could also go ClearDebug but this clears the whole debug which I do not want.