Completely deleted my MSI folder and reloaded it at Rev 245
WriteFileString: Invalid Internal Handle of File: 1
[0:00:36]: [ Nick ] ---- Scanning for randoms...
[0:00:38]: [ Nick ] -- MSI_BestTool
[0:00:39]: [ Nick ] ---- CurrentSkill level: 73
[0:00:39]: [ Nick ] -- MSI_BestTool: Rune Hatchet
[0:00:39]: [ Nick ] -- MSI_FindTool - GameTab: 26
[0:00:40]: [ Nick ] ---- Found DTM: Rune Hatchet
[0:00:40]: [ Nick ] -- MSI_FindTool: True
Error: Invalid Opcode at line 64
The following DTMs were not freed: [SRL - Lamp bitmap, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
File[C:\Users\Name\Simba\Includes\SRL\Logs\SRL Log 03-09-10 0.txt] has not been freed in the script, freeing it now.
This is my entire Debug.simba
{==============================================================================\
| MSI Group Scripting Include |
| Debug.scar |
|==============================================================================|
| For all debugging and progress report routines |
| |
| * procedure MSI_Debug(); * by Rasta Magician |
| * procedure MSI_AddHeader(); * by Rasta Magician |
| * procedure MSI_CloseHeader(); * by Rasta Magician |
| * procedure MSI_SubDebug(); * by Rasta Magician |
| * procedure MSI_SetRev; * by RM & Shuttleu |
| * function MSI_MirrorTPA(): TPointArray; * by RM |
| * procedure MSI_AddToProggy(); * by The MSI Team |
| * procedure MSI_GetReportInfo(); * by Coh3n |
| * function MSI_PrintSave; * by Naum |
| * procedure MSI_ProgressReport(); * by Coh3n |
\_____________________________________________________________________________}
var
CurrDebugLevel: integer;
{******************************************************************************}
{ procedure MSI_Debug(); }
{ By: Rasta Magician }
{ Date: 8 Aug 2010 }
{ Description: Debugs }
{******************************************************************************}
procedure MSI_Debug(debug: string);
var
DebugMSG, path, str: string;
begin
//Status(debug);
//player name
try
DebugMSG := DebugMSG + '[ ' + Capitalize(Players[CurrentPlayer].Nick)+' ] ';
except end;
//structure
DebugMSG := DebugMSG + Replicate('-', CurrDebugLevel * 2) + ' ';
//debug message
DebugMSG := DebugMSG + debug;
//save to file
if (SaveDebug) then
try
path := AppPath + 'Includes\SRL\SRL\msi\MSI Logs\';
if FileExists(path + scriptStart + '.txt') then
begin
theFile := OpenFile(path + scriptStart + '.txt', False);
ReadFileString(theFile, str, FileSize(theFile));
CloseFile(theFile);
end;
theFile := RewriteFile(path + scriptStart + '.txt', False);
WriteFileString(theFile, str + #13 + #10 + DebugMSG);
CloseFile(theFile);
except
//Writeln('Debug saving - error occurred');
end;
if CurrDebugLevel <= LevelToDebug then
writeln(DebugMSG)
else
Debugln(DebugMSG);
end;
{******************************************************************************}
{ procedure MSI_AddHeader(); }
{ By: Rasta Magician }
{ Date: 8 Aug 2010 }
{ Description: creates a new header, }
{ meaning all following debugs will go a level below this one }
{******************************************************************************}
procedure MSI_AddHeader(header: string);
begin
MSI_Debug(header);
inc(CurrDebugLevel);
end;
{******************************************************************************}
{ procedure MSI_CloseHeader(); }
{ By: Rasta Magician }
{ Date: 8 Aug 2010 }
{ Description: Closes header, debugs result }
{******************************************************************************}
procedure MSI_CloseHeader(closer: string);
begin
Dec(CurrDebugLevel);
MSI_Debug(closer);
end;
{******************************************************************************}
{ procedure MSI_SubDebug(); }
{ By: Rasta Magician }
{ Date: 8 Aug 2010 }
{ Description: allows for a one-time-only sub-debug }
{******************************************************************************}
procedure MSI_SubDebug(debug: string);
begin
Inc(CurrDebugLevel);
MSI_Debug(debug);
Dec(CurrDebugLevel);
end;
{******************************************************************************}
{ procedure MSI_SetRev; }
{ By: Rasta Magician & Shuttleu }
{ Date: 27 July 2010 }
{ Description: Retrieves the user rev of MSI and sets it to var MSIRev }
{******************************************************************************}
procedure MSI_SetRev;
var
i: Integer;
s: string;
begin
try
i:= OpenFile(IncludePath + 'SRL/SRL/MSI/.svn/entries', True)
ReadFileString(i, s, 20);
CloseFile(i);
MSIRev:= Trim(Between('dir', 'http', s));
except
MSI_SubDebug('Error setting revision number');
finally
end;
end;
{******************************************************************************}
{ function MirrorTPA(TPA: TPointArray): TPointArray; }
{ By: Rasta Magician }
{ Date: 28 July 2010 }
{ Description: Mirrors the TPA (reverses the order); used mainly in reverting }
{ the reflection paths }
{******************************************************************************}
function MSI_MirrorTPA(TPA: TPointArray): TPointArray;
var
i, h: integer;
begin
h := 0;
SetLength(Result, Length(TPA));
for i:= High(TPA) DownTo 0 do
begin
Result[h] := TPA[i];
Inc(h);
end;
end;
{******************************************************************************}
{ procedure MSI_AddToProggy(whatToAdd, wObject, wItem, quantity: Integer); }
{ By: The MSI Team }
{ Date: 04 August 2010 }
{ Description: Adds specified element to the progress report - if parameter }
{ is unused, set to -1 }
{******************************************************************************}
procedure MSI_AddToProggy(whatToAdd, wObject, wItem, quantity: Integer);
begin
if (quantity = 0) then
Exit;
with ProgressReportArray[CurrentPlayer].ScriptInfo[CurrentScript] do
case whatToAdd of
PROG_ADD_EXP:
begin
IncEx(PlayerGainedExp, quantity);
IncEx(Stats_CustomVars[STATS_EXP], quantity);
end;
PROG_ADD_ITEMS:
begin
IncEx(PlayerItemAmounts[wObject][wItem], quantity);
case MSI_Scripts[MSI_Players[CurrentPlayer].Scripts[CurrentScript]].SkillConstant of
SKILL_WOODCUTTING:
IncEx(Stats_CustomVars[STATS_LOGS], quantity);
SKILL_MINING:
IncEx(Stats_CustomVars[STATS_ORES], quantity);
SKILL_FISHING:
IncEx(Stats_CustomVars[STATS_FISH], quantity);
else
MSI_SubDebug('MSI_AddToProggy: Invalid skill!');
end;
end;
PROG_ADD_LOADS:
begin
Inc(PlayerLoads);
Inc(Stats_CustomVars[STATS_LOADS]);
Inc(ProgressReportArray[CurrentPlayer].LoadsDone);
end;
else
MSI_Debug('MSI_AddToProggy: Invalid addition choice to progress report!');
end;
MSI_SendStats;
end;
{******************************************************************************}
{ procedure MSI_GetReportInfo; }
{ By: Coh3n & Shuttleu }
{ Date: 22 July 2010 }
{ Description: Gets the necessary proggy info that isn't automatically reset }
{ during runtime }
{******************************************************************************}
procedure MSI_GetReportInfo;
var
level, skill, i: Integer;
begin
for i := 0 to High(MSI_Players) do
with ProgressReportArray[i] do
begin
if (i = CurrentPlayer) then
begin
skill := MSI_Scripts[MSI_Players[i].Scripts[CurrentScript]].SkillConstant;
level := GetSkillLevel(skill);
if (level > ScriptInfo[CurrentScript].PlayerSkillLevel) then
ScriptInfo[CurrentScript].PlayerSkillLevel := level;
end;
PlayerLoc := MSI_Players[i].Location;
PlayerStatus := MSI_Players[i].Active;
end;
end;
{******************************************************************************}
{ procedure MSI_PrintSave(theFile: integer; s: string); }
{ By: Naum }
{ Date: 30 August 2010 }
{ Description: Prints the string in the debug box also saves the report }
{******************************************************************************}
Procedure MSI_PrintSave(theFile: Integer; s: string);
Begin
Writeln(s);
if (saveDebug) then
WriteFileString(theFile, s + #13 + #10);
End;
{******************************************************************************}
{ procedure MSI_ProgressReport; }
{ By: Coh3n }
{ Date: 12 August 2010 }
{ Description: Prints the progress report of each player }
{******************************************************************************}
procedure MSI_ProgressReport;
var
i, j, k, l, theFile: Integer;
path: String;
begin
try
if (StrToInt(MSIRev) < 100) then
MSIRev := '000';
if (saveDebug) then
begin
path := AppPath + 'Includes\SRL\SRL\MSI\MSI Progress Reports\';
theFile := ReWriteFile(path + scriptStart + '.txt', False);
WriteFileString(theFile, 'Progress Report Saved:' + #13 + #10);
WriteFileString(theFile, #13 + #10 + 'This proggie was written ' + TheDate(Date_Formal )+ ' at ' + TheTime + #13 + #10);
end;
ClearDebug;
MSI_GetReportInfo;
MSI_PrintSave(theFile, '{----------------------------------------------------------------}'); //64 from '{' to '}'
MSI_PrintSave(theFile, '{ MSI Phoenix Player Report }');
MSI_PrintSave(theFile, '{------------------------- Revision ' + MSIRev + ' -------------------------}');
MSI_PrintSave(theFile, '{ ' + PadR('Time Running: ' + TimeRunning, 59) + '}');
MSI_PrintSave(theFile, '{----------------------------------------------------------------}');
for i := 0 to (HowManyPlayers - 1) do
begin
with ProgressReportArray[i] do
begin
MSI_PrintSave(theFile, '{ }');
MSI_PrintSave(theFile, '{ ' + PadR('Player ' + IntToStr(i) + ': ' + Capitalize(playerName), 59) + '}'); //playerName
MSI_PrintSave(theFile, '{ ' + PadR('Location: ' + MSI_Locations[playerLoc].Name, 59) + '}'); //playerLoc
MSI_PrintSave(theFile, '{ ' + PadR('Time: ' + MsToTime(playerTime, Time_Short), 59) + '}'); //playerTime
MSI_PrintSave(theFile, '{ ' + PadR('Total Loads: ' + IntToStr(LoadsDone), 59) + '}'); //playerLoads
MSI_PrintSave(theFile, '{ ' + PadR('Active: ' + Capitalize(BoolToStr(playerStatus)), 59) + '}'); //playerStatus
if (not PlayerStatus) then //falseReason
MSI_PrintSave(theFile, '{ ' + PadR('Reason: ' + FalseReason, 57) + '}');
MSI_PrintSave(theFile, '{ }');
for j := 0 to High(ScriptInfo) do //scriptInfo
with ScriptInfo[j] do
begin
MSI_PrintSave(theFile, '{ ' + PadR('Script: ' + Name, 59) + '}'); //scriptName
MSI_PrintSave(theFile, '{ ' + PadR('Time: ' + MsToTime(Runtime, Time_Short), 57) + '}'); //scriptRuntime
MSI_PrintSave(theFile, '{ ' + PadR('Skill: ' + skillName, 57) + '}'); //skillName
MSI_PrintSave(theFile, '{ ' + PadR('Loads: ' + IntToStr(playerLoads), 57) + '}'); //playerLoads
MSI_PrintSave(theFile, '{ ' + PadR('Exp: ' + GroupDigits(playerGainedExp, ','), 57) + '}'); //playerGainedExp
if (playerSkillLevel < 1) then
MSI_PrintSave(theFile, '{ ' + PadR('Level: Not yet defined', 57) + '}')
else
MSI_PrintSave(theFile, '{ ' + PadR('Level: ' + IntToStr(playerSkillLevel), 57) + '}'); //playerSkillLevel
for k := 0 to High(MSI_Players[i].Items[j]) do
for l := 0 to High(MSI_Players[i].Items[j][k]) do //itemConstants
begin
MSI_PrintSave(theFile, '{ ' + PadR('Item: ' + MSI_Players[i].ItemNames[j][k][l], 55) + '}');
MSI_PrintSave(theFile, '{ ' + PadR('Amount: ' + GroupDigits(PlayerItemAmounts[k][l], ','), 55) + '}'); //playerItemAmounts
end;
MSI_PrintSave(theFile, '{ }');
end;
end;
MSI_PrintSave(theFile, '{----------------------------------------------------------------}');
end;
MSI_PrintSave(theFile, '{----------------------------------------------------------------}');
if (saveDebug) then
CloseFile(theFile);
except
MSI_SubDebug('Error in printing report!');
end;
end;