To start, my script terminate function:
SCAR Code:
procedure ScriptTerminate;
var
MT : Array of String;
MessageF, PlayerString, EmailF : String;
TP, I, W : Integer;
begin
Debug('Final Proggy');
Proggy;
TP := (ProfitB * BSmith);
{W := HowManyPlayers - 1;
repeat
MT[i] := IntToStr(i) + ': ' + Players[i].Nick + ' | ' + Left(BoolToStr(Players[i].active), 1) + ' | ' + IntToStr(Players[i].Integers[1]) + ' Loads | ' + IntToStr(Players[i].Integers[2]) + ' Bars | ' + IntToStr(Players[i].Integers[3]) + ' Profit | ' + Players[i].Loc;
Inc(i);
if i >= W then break;
until I >= W
PlayerString := Implode(#13, MT); }
Debug('Creating Message');
if YourEmail = '' Then EmailF := 'Garrettsemail' else EmailF := YourEmail;
MessageF := ' ' +
'3Garrett3s Baby Melter ' + VersionN + ' Progress Report' + #13 +
'*********************************************' + #13 +
'Ran for: ' + TimeRunning + #13 +
'Loads: ' + IntToStr(LD) + #13 +
'Bars: ' + IntToStr(BSmith) + #13 +
'Profit: ' + IntToStr(TP) + 'gp' + #13 +
'Leveled: ' + IntToStr(Levels) + ' Times' + #13 +
'Rested: ' + IntToStr(RAmount) + ' Times' + #13 +
'Rested for: ' + MsToTime(RTTime, 0) + #13 +
'Slept: ' + IntToStr(Sleeped) + ' Times' + #13 +
'Slept for: ' + MsToTime(SleepT, 0) + #13 +
'*********************************************' + #13 +
//PlayerString + #13 +
' ';
SendEmail('', '', MessageF, '', '', '');
Debug('Sent Email');
end;
And yeah, I have the email thing set up right, I just removed all of my information until I release the script.
Anyway. To the real problem. As you can see, parts of the script are commented out. IMO, the important part of the procedure is to tell me what the players did. This is the part that will not work.
I have tried a simple For To Do loop, and also tried using this repeat loop, but the result is the same.
If I comment out the parts that are commented, the script will terminate right and will send an email (minus the important parts) but when it is uncommented, the script will simply die after writing the progress report (first thing) and will not make it to creating the message and sending the email before it dies.
The thing I would like to know is:
- Can this be done somehow to stop the script from prematurely stopping?
Edit: Wording might have been bad.
"Can I rewrite this so that it doesn't stop the script before it reaches the end of the procedure, and why does it do that?"