Simba Code:
Program ObjectDTMGenerationTool;
//{$DEFINE SMART} //Comment this line out if you don't want to use the tool with SMART
{$i SRL\SRL.simba}
{$i ObjectDTM\ObjDTMInclude.simba}
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
CurrentPlayer := 0;
SetLength(Players, HowManyPlayers);
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Member := False;
Players[0].Active := True;
end;
var
CleanMap, CurrentMap, CurrentNode, I, X, Y: Integer;
ForcePage: Integer;
ToolForm: TForm;
SubPoints: TPointArray;
Objects: MMObjArray;
ObjectDTM: ObjDTM;
SinglePath: TStringArray;
Done, PathFinish: Boolean;
TabPageControl: TPageControl;
TabSheet: Array [0..3] of TTabSheet;
PropertiesControl: TPageControl;
PropertySheet: Array [0..2] of TTabSheet;
PropertyPanel: TPanel;
AreaSetPanel: TPanel;
MMap: TImage;
ObjectsList: TListBox;
Instructions: TMemo;
Output: TMemo;
PrintFull: TCheckBox;
MainPointResetButton: TButton;
MouseCoords: TLabel;
MainPointTabLabels: Array [0..1] of TLabel;
SinglePathButtons: Array [0..1] of TButton;
SingleTabButtons: Array [0..3] of TButton;
SubPointButtons: Array [0..3] of TButton;
AreaButtons: Array [0..1] of TButton;
procedure DrawDotsEx(pixels: TPointArray; color: Integer);
{:: Author: Sir R. Magician ::}
var
i : integer;
begin
MMap.Canvas.Pen.Color := color;
for i:= 0 to high(pixels) do
begin
MMap.canvas.moveto(pixels[i].x,pixels[i].y);
MMap.canvas.LineTo(pixels[i].x+1,pixels[i].y);
end;
end;
procedure DrawLine(TP1, TP2: TPoint; Color: TColor);
{:: Author: mormonman ::}
begin
MMap.canvas.Pen.Color := Color;
MMap.canvas.moveto(TP1.x,TP1.y);
MMap.canvas.LineTo(TP2.x,TP2.y);
end;
procedure DrawCircle(Center: TPoint; Radius: Integer; Fill: Boolean; Color: TColor);
{:: Author: mormonman ::}
var
TPA: TPointArray;
begin
TPA := TPAFromBox(IntToBox(Center.X - Radius, Center.Y - Radius, Center.X + Radius, Center.Y + Radius));
FilterPointsPie(TPA, 0, 360, -1, Radius, Center.X, Center.Y);
if (not Fill) then
FilterPointsDist(TPA, Radius-1, Radius, Center.X, Center.Y);
if (Length(TPA) >= 1) then
DrawDotsEx(TPA, Color);
end;
procedure DrawPolygons(Polygons: T2DPointArray; color: TColor);
{:: Author: mormonman ::}
var
i, h, Hi: Integer;
begin
if (Length(Polygons) < 1) then
Exit;
for h := 0 to High(Polygons) do
begin
Hi := High(Polygons[h]);
if (Hi < 2) then Exit;
for i := 0 to Hi - 1 do
DrawLine(Polygons[h][i], Polygons[h][i+1], color);
DrawLine(Polygons[h][Hi], Polygons[h][0], color);
end;
end;
procedure GatherMiniMap;
var
TIA: TIntegerArray;
TPA: TPointArray;
begin
UnFreeze;
Freeze;
TPA := TPAFromBox(IntToBox(MMX1 - 3, MMY1 - 3, MMX2 + 3, MMY2 + 3));
FilterPointsPie(TPA, 0, 360, 0, 80, MMCX, MMCY);
TIA := GetColors(TPA);
OffsetTPA(TPA, IntToPoint(-(MMX1 - 3), -(MMY1 - 3)));
FastSetPixels(CleanMap, TPA, TIA);
FastSetPixels(CurrentMap, TPA, TIA);
end;
procedure DrawMiniMap;
begin
DrawBitmap(CleanMap, MMap.Canvas, 0, 0);
end;
procedure DrawObjectDTM(Level: Integer);
begin
if (Level < 1) then
Exit;
if (Level > 0) then
for I := High(SubPoints) downto 0 do
DrawCircle(SubPoints[i], 7, False, clLime);
if (Level > 2) then
begin
if (Length(ObjectDTM.Area) > 0) then
begin
DrawCircle(ObjectDTM.Area[0], 2, True, clRed);
DrawCircle(ObjectDTM.Area[0], 4, False, clRed);
end;
if (Length(ObjectDTM.Area) > 1) then
begin
DrawLine(ObjectDTM.Area[0], ObjectDTM.Area[1], clRed);
for I := 0 to (High(ObjectDTM.Area) - 1) do
DrawLine(ObjectDTM.Area[i], ObjectDTM.Area[i + 1], clRed);
if (Length(ObjectDTM.Area) > 2) then
DrawLine(ObjectDTM.Area[0], ObjectDTM.Area[ObjectDTM.NumOfAreaPoints - 1], clRed);
end;
end;
if (Level > 1) then
for I := High(SubPoints) downto 0 do
DrawLine(ObjectDTM.MainPoint, SubPoints[i], clWhite);
end;
procedure GatherObject;
var
I: Integer;
ObjectsTPA: TPointArray;
begin
if (ObjectsList.ItemIndex = -1) then
begin
WriteLn('You have passed an invalid index to the finding function, please select an object first.');
Exit;
end;
ObjectsTPA := FindMiniMapObj(MMObjRecords[ObjectsList.ItemIndex]);
SetLength(Objects, Length(ObjectsTPA));
OffsetTPA(ObjectsTPA, IntToPoint(-(MMX1 - 3), -(MMY1 - 3)));
DrawMiniMap;
for I := 0 to (Length(ObjectsTPA) - 1) do
begin
DrawCircle(ObjectsTPA[i], 7, False, clWhite);
Objects[i].Center := ObjectsTPA[i];
Objects[i].ObjType := ObjectsList.ItemIndex;
end;
DrawObjectDTM(1);
end;
procedure SubPointManager;
begin
for I := 0 to High(Objects) do
begin
if InCircle(X, Y, Objects[i].Center.x, Objects[i].Center.y, 7) then
begin
if (not PointInTPA(Objects[i].Center, SubPoints)) then
begin
Inc(ObjectDTM.NumOfPoints);
SetLength(ObjectDTM.SubPoints, ObjectDTM.NumOfPoints);
SetLength(SubPoints, ObjectDTM.NumOfPoints);
ObjectDTM.SubPoints[(ObjectDTM.NumOfPoints) - 1].Base := Objects[i].ObjType;
ObjectDTM.SubPoints[(ObjectDTM.NumOfPoints) - 1].Point := Objects[i].Center;
ObjectDTM.SubPoints[(ObjectDTM.NumOfPoints) - 1].Drift := 7;
SubPoints[(ObjectDTM.NumOfPoints) - 1] := Objects[i].Center;
DrawCircle(SubPoints[(ObjectDTM.NumOfPoints) - 1], 7, False, clLime);
Exit;
end else
Continue;
end;
end;
for I := 0 to (ObjectDTM.NumOfPoints - 1) do
begin
if (not InCircle(X, Y, SubPoints[i].x, SubPoints[i].y, 7)) then
Continue;
DrawCircle(SubPoints[i], 7, False, clRed);
ObjectDTM.SubPoints[i].Base := ObjectDTM.SubPoints[(ObjectDTM.NumOfPoints) - 1].Base;
ObjectDTM.SubPoints[i].Point := ObjectDTM.SubPoints[(ObjectDTM.NumOfPoints) - 1].Point;
ObjectDTM.SubPoints[i].Drift := ObjectDTM.SubPoints[(ObjectDTM.NumOfPoints) - 1].Drift;
SubPoints[i] := SubPoints[(ObjectDTM.NumOfPoints) - 1];
Dec(ObjectDTM.NumOfPoints);
SetLength(SubPoints, ObjectDTM.NumOfPoints);
SetLength(ObjectDTM.SubPoints, ObjectDTM.NumOfPoints);
Exit;
end;
end;
procedure AreaManager;
begin
DrawMiniMap;
DrawObjectDTM(3);
if (not PointInTPA(IntToPoint(X, Y), ObjectDTM.Area)) then
begin
Inc(ObjectDTM.NumOfAreaPoints);
SetLength(ObjectDTM.Area, ObjectDTM.NumOfAreaPoints);
ObjectDTM.Area[(ObjectDTM.NumOfAreaPoints) - 1] := IntToPoint(X, Y);
end;
DrawMiniMap;
DrawObjectDTM(3);
end;
procedure MainPointManager(Click: Boolean);
begin
DrawBitmap(CleanMap, MMap.Canvas, 0, 0);
if Click then
begin
ObjectDTM.MainPoint := IntToPoint(X, Y);
MainPointTabLabels[0].Caption := IntToStr(ObjectDTM.MainPoint.x) + ', ' + IntToStr(ObjectDTM.MainPoint.y);
end;
for I := 0 to High(SubPoints) do
begin
DrawCircle(SubPoints[i], 7, False, clLime);
DrawLine(ObjectDTM.MainPoint, SubPoints[i], clWhite);
end;
for I := 0 to High(SubPoints) do
DrawLine(IntToPoint(X, Y), SubPoints[i], clYellow);
end;
procedure PrintManager;
var
ObjectDTMString: String;
begin
ObjectDTMString := ObjDTMToString(ObjectDTM);
OutPut.LINES.Clear;
OutPut.LINES.Add(#39 + ObjectDTMString + #39);
if PrintFull.Checked then
begin
ObjDTM_PrintToRec(ObjectDTMString);
Writeln('');
end;
WriteLn(#39 + ObjectDTMString + #39);
end;
procedure MoveComponents(WhatTab: Integer);
begin
if ((WhatTab = 1) or (WhatTab = 3)) then
Exit;
AreaSetPanel.Parent := TabSheet[WhatTab];
PropertyPanel.Parent := TabSheet[WhatTab];
for I := 0 to 3 do
SingleTabButtons[i].Parent := TabSheet[WhatTab];
Instructions.Parent := TabSheet[WhatTab];
OutPut.Parent := TabSheet[WhatTab];
if (WhatTab = 2) then
for I := 0 to 1 do
SinglePathButtons[i].Show
else
for I := 0 to 1 do
SinglePathButtons[i].Hide;
end;
procedure InstructionsHandler;
begin
Instructions.Lines.Clear;
case TabPageControl.ActivePageIndex of
0:
begin
case PropertiesControl.ActivePageIndex of
0:
begin
Instructions.Lines.Add('Instructions: Select an object from the list and click ' + #39 + 'gather object' + #39 + ' to display all instances of that object on the minimap. ' + 'Click within circles to add or remove sub-points.');
Instructions.SelStart := 1;
DrawMiniMap;
DrawObjectDTM(1);
end;
1:
begin
Instructions.Lines.Add('Instructions: Displays current main-point of the Object DTM. ' + 'Mouse over a position and click to change the main-point. ' + 'Click ' + #39 + 'Reset main-point' + #39 + ' to set the main-point to center.');
Instructions.SelStart := 1;
DrawMiniMap;
DrawObjectDTM(2);
end;
2:
begin
Instructions.Lines.Add('Instructions: Displays current area polygon of the Object DTM. ' + 'Mouse over a point to add a vertex. ' + 'Click ' + #39 + 'Delete Area' + #39 + ' to remove the polygon. ' + 'Click ' + #39 + 'Undo Last Point' + #39 + ' to remove last set vertex.');
Instructions.SelStart := 1;
MainPointTabLabels[0].Caption := IntToStr(ObjectDTM.MainPoint.x) + ', ' + IntToStr(ObjectDTM.MainPoint.y);
DrawMiniMap;
DrawObjectDTM(3);
end;
end;
end;
1:
begin
case PropertiesControl.ActivePageIndex of
0:
begin
end;
1:
begin
end;
2:
begin
end;
end;
end;
2:
begin
case PropertiesControl.ActivePageIndex of
0:
begin
Instructions.Lines.Add('Instructions: Path Recorder: Follow instructions to complete the node. When finished creating node, click ' + #39 + 'Add Path Node' + #39 + '. The form will close, the code will walk to the node, and the form will open back up. Continue until path is complete. When finished, click ' + #39 + 'Finish Path' + #39 + '. This will stop the tool, and print the path in Simba' + #39 + 's debug box. Select an object from the list and click ' + #39 + 'gather object' + #39 + ' to display all instances of that object on the minimap. ' + 'Click within circles to add or remove sub-points.');
Instructions.SelStart := 1;
DrawMiniMap;
DrawObjectDTM(1);
end;
1:
begin
Instructions.Lines.Add('Instructions: Displays current main-point of the Object DTM. ' + 'Mouse over a position and click to change the main-point. ' + 'Click ' + #39 + 'Reset main-point' + #39 + ' to set the main-point to center.');
Instructions.SelStart := 1;
DrawMiniMap;
DrawObjectDTM(2);
end;
2:
begin
Instructions.Lines.Add('Instructions: Displays current area polygon of the Object DTM. ' + 'Mouse over a point to add a vertex. ' + 'Click ' + #39 + 'Delete Area' + #39 + ' to remove the polygon. ' + 'Click ' + #39 + 'Undo Last Point' + #39 + ' to remove last set vertex.');
Instructions.SelStart := 1;
MainPointTabLabels[0].Caption := IntToStr(ObjectDTM.MainPoint.x) + ', ' + IntToStr(ObjectDTM.MainPoint.y);
DrawMiniMap;
DrawObjectDTM(3);
end;
end;
end;
3:
begin
case PropertiesControl.ActivePageIndex of
0:
begin
end;
1:
begin
end;
2:
begin
end;
end;
end;
end;
end;
procedure MouseMove(Sender: TObject; S: TShiftState; mX, mY: Integer);
begin
X := mX;
Y := mY;
MouseCoords.Caption := IntToStr(X) + '. ' + IntToStr(Y);
case Sender of
AreaSetPanel:
begin
case PropertiesControl.ActivePageIndex of
1:
begin
DrawMiniMap;
DrawObjectDTM(2);
end;
2:
begin
DrawMiniMap;
DrawObjectDTM(3);
end;
end;
end;
MMap:
begin
if (PropertiesControl.ActivePageIndex = 1) then
MainPointManager(False);
if (PropertiesControl.ActivePageIndex = 2) then
begin
if (Length(ObjectDTM.Area) = 0) then
Exit;
DrawMinimap;
DrawObjectDTM(2);
if (Length(ObjectDTM.Area) > 0) then
begin
DrawCircle(ObjectDTM.Area[0], 2, True, clRed);
DrawCircle(ObjectDTM.Area[0], 4, False, clRed);
end;
if (Length(ObjectDTM.Area) = 1) then
begin
DrawLine(ObjectDTM.Area[0], IntToPoint(X, Y), clRed);
Exit;
end;
if (Length(ObjectDTM.Area) > 1) then
begin
DrawLine(ObjectDTM.Area[0], IntToPoint(X, Y), clRed);
DrawLine(ObjectDTM.Area[ObjectDTM.NumOfAreaPoints - 1], IntToPoint(X, Y), clRed);
for I := 0 to (High(ObjectDTM.Area) - 1) do
DrawLine(ObjectDTM.Area[i], ObjectDTM.Area[i + 1], clRed);
end;
end;
end;
end;
end;
procedure MouseClick(Sender: TObject);
begin
case Sender of
TabPageControl:
begin
MoveComponents(TabPageControl.ActivePageIndex);
InstructionsHandler;
end;
MMap:
begin
case PropertiesControl.ActivePageIndex of
0: SubPointManager;
1: MainPointManager(True);
2: AreaManager;
end;
end;
SingleTabButtons[0]:
begin
GatherMiniMap;
DrawMiniMap;
DrawObjectDTM(1);
end;
SingleTabButtons[1]: DrawMiniMap;
SingleTabButtons[2]:
begin
ObjectDTM.MainPoint := IntToPoint(80, 80);
ObjectDTM.NumOfPoints := 0;
ObjectDTM.NumOfAreaPoints := 0;
SetLength(ObjectDTM.SubPoints, ObjectDTM.NumOfPoints);
SetLength(ObjectDTM.Area, ObjectDTM.NumOfAreaPoints);
SetLength(SubPoints, ObjectDTM.NumOfAreaPoints);
DrawMiniMap;
end;
SingleTabButtons[3]: PrintManager;
SubPointButtons[0]: GatherObject;
SinglePathButtons[0]:
begin
Done := False;
ForcePage := 2;
Inc(CurrentNode);
SetLength(SinglePath, CurrentNode);
SinglePath[CurrentNode - 1] := ObjDTMToString(ObjectDTM);
PrintManager;
ObjectDTM.MainPoint := IntToPoint(80, 80);
ObjectDTM.NumOfPoints := 0;
ObjectDTM.NumOfAreaPoints := 0;
SetLength(ObjectDTM.SubPoints, ObjectDTM.NumOfPoints);
SetLength(ObjectDTM.Area, ObjectDTM.NumOfAreaPoints);
ToolForm.Close;
end;
SinglePathButtons[1]:
begin
Done := True;
PathFinish := True;
ToolForm.Close;
end;
PropertiesControl:
begin
InstructionsHandler;
end;
MainPointResetButton:
begin
ObjectDTM.MainPoint := IntToPoint(80, 80);
MainPointTabLabels[0].Caption := '80, 80';
DrawMiniMap;
DrawObjectDTM(2);
end;
AreaButtons[0]:
begin
ObjectDTM.NumOfAreaPoints := 0;
SetLength(ObjectDTM.Area, 0);
DrawMiniMap;
DrawObjectDTM(3);
end;
AreaButtons[1]:
begin
Dec(ObjectDTM.NumOfAreaPoints);
SetLength(ObjectDTM.Area, ObjectDTM.NumOfAreaPoints);
DrawMiniMap;
DrawObjectDTM(3);
end;
end;
end;
procedure ToolForm_Init;
begin
Done := True;
ToolForm := TForm.Create(nil);
TabPageControl := TPageControl.Create(ToolForm);
TabPageControl.Parent := ToolForm;
TabPageControl.Width := 510;
TabPageControl.Height := 330;
TabPageControl.Caption := 'TabPageControl';
TabPageControl.OnPageChanged := @MouseClick;
PrintFull := TCheckBox.Create(ToolForm);
ObjectsList := TListBox.Create(ToolForm);
Instructions := TMemo.Create(ToolForm);
Output := TMemo.Create(ToolForm);
PropertyPanel := TPanel.Create(ToolForm);
MMap := TImage.Create(ToolForm);
PropertiesControl := TPageControl.Create(ToolForm);
PropertiesControl.Parent := PropertyPanel;
PropertiesControl.Width := 210;
PropertiesControl.Height := 160;
PropertiesControl.Caption := 'PropertyPageControl';
PropertiesControl.OnPageChanged := @MouseClick;
for I := 0 to 3 do
begin
TabSheet[I] := TTabSheet.Create(ToolForm);
TabSheet[I].Parent := TabPageControl;
TabSheet[I].PageControl := TabPageControl;
end;
TabSheet[0].Caption := 'Single';
TabSheet[1].Caption := 'Multi';
TabSheet[2].Caption := 'Path';
TabSheet[3].Caption := 'Multi-path';
AreaSetPanel := TPanel.Create(ToolForm);
AreaSetPanel.Parent := TabSheet[0];
AreaSetPanel.OnMouseMove := @MouseMove;
AreaSetPanel.Width := 510;
AreaSetPanel.Height := 330;
AreaSetPanel.Top := 0;
AreaSetPanel.Left := 0;
AreaSetPanel.Color := 16777215;
for I := 0 to 2 do
begin
PropertySheet[I] := TTabSheet.Create(ToolForm);
PropertySheet[I].Parent := PropertyPanel;
PropertySheet[I].PageControl := PropertiesControl;
end;
PropertySheet[0].Caption := 'Sub-points';
PropertySheet[1].Caption := 'Main-point';
PropertySheet[2].Caption := 'Area';
with PropertyPanel do
begin
Parent := TabSheet[0];
Left := 282;
Top := 10;
Caption := 'Object DTM Generation Tool - by euphemism';
Width := 210;
Height := 160;
end;
for I := 0 to 1 do
begin
SingleTabButtons[i] := TButton.Create(ToolForm);
SingleTabButtons[i].Parent := TabSheet[0];
SingleTabButtons[i].Width := 100;
SingleTabButtons[i].Height := 20;
SingleTabButtons[i].Top := 35 + (i * 20);
SingleTabButtons[i].Left := 176;
end;
for I := 2 to 3 do
begin
SingleTabButtons[i] := TButton.Create(ToolForm);
SingleTabButtons[i].Parent := TabSheet[0];
SingleTabButtons[i].Width := 100;
SingleTabButtons[i].Height := 20;
SingleTabButtons[i].Top := 35 + (i * 20);
SingleTabButtons[i].Left := 176;
end;
with SingleTabButtons[0] do
begin
Caption := 'Grab Minimap';
OnClick := @MouseClick;
end;
with SingleTabButtons[1] do
begin
Caption := 'Clear Minimap';
OnClick := @MouseClick;
end;
with SingleTabButtons[2] do
begin
Caption := 'Delete ODTM';
OnClick := @MouseClick;
end;
with SingleTabButtons[3] do
begin
Caption := 'Print Object DTM';
OnClick := @MouseClick;
end;
with PrintFull do
begin
Parent := AreaSetPanel;
Left := 184;
Top := 155;
Width := 8;
Height := 11;
Caption := 'Print Record';
end;
with SubPointButtons[0] do
begin
SubPointButtons[0] := TButton.Create(ToolForm);
Parent := PropertySheet[0];
Left := 102;
Top := 4;
Height := 30;
Width := 100;
Caption := 'Gather Object';
OnClick := @MouseClick;
end;
for I := 0 to 1 do
begin
MainPointTabLabels[i] := TLabel.Create(ToolForm);
MainPointTabLabels[i].Parent := PropertySheet[1];
MainPointTabLabels[i].Width := 20;
MainPointTabLabels[i].Height := 30;
MainPointTabLabels[i].Left := 15;
end;
MainPointTabLabels[0].Top := 17;
MainPointTabLabels[0].Caption := '80, 80';
MainPointTabLabels[1].Top := 5;
MainPointTabLabels[1].Caption := 'Main-point:';
MouseCoords := TLabel.Create(ToolForm);
MouseCoords.Parent := AreaSetPanel;
MouseCoords.Width := 20;
MouseCoords.Height := 30;
MouseCoords.Top := 290;
MouseCoords.Left := 10;
MouseCoords.Caption := '0. 0';
with MainPointResetButton do
begin
MainPointResetButton := TButton.Create(ToolForm);
Parent := PropertySheet[1];
Left := 102;
Top := 4;
Height := 30;
Width := 100;
Caption := 'Reset Main-point'
OnClick := @MouseClick;
end;
for I := 0 to 1 do
begin
AreaButtons[i] := TButton.Create(ToolForm);
AreaButtons[i].Parent := PropertySheet[2];
AreaButtons[i].Left := 102;
AreaButtons[i].Top := 4 + (i * 30);
AreaButtons[i].Height := 30;
AreaButtons[i].Width := 100;
end;
AreaButtons[0].Caption := 'Delete Area'
AreaButtons[0].OnClick := @MouseClick;
AreaButtons[1].Caption := 'Undo Last Point'
AreaButtons[1].OnClick := @MouseClick;
for I := 0 to 1 do
begin
SinglePathButtons[i] := TButton.Create(ToolForm);
SinglePathButtons[i].Parent := AreaSetPanel;
SinglePathButtons[i].Width := 100;
SinglePathButtons[i].Height := 20;
SinglePathButtons[i].Top := 115 + (i * 20);
SinglePathButtons[i].Left := 176;
SinglePathButtons[i].Hide;
end;
SinglePathButtons[0].Caption := 'Add Path Node';
SinglePathButtons[1].Caption := 'Finish Path';
SinglePathButtons[0].OnClick := @MouseClick;
SinglePathButtons[1].OnClick := @MouseClick;
with ToolForm do
begin
Left := 430;
Top := 174;
Caption := 'Object DTM Generation Tool - by euphemism';
ClientWidth := 510;
ClientHeight := 330;
Color := 15984606;
end;
with MMap do
begin
Parent := AreaSetPanel;
Left := 5;
Top := 10;
Width := 160;
Height := 160;
OnClick := @MouseClick;
OnMouseMove := @MouseMove;
end;
with ObjectsList do
begin
Parent := PropertySheet[0];
Left := 0;
Top := 4;
Width := 100;
Height := 127;
ItemHeight := 13;
Items.Add('Ladders');
Items.Add('Trees');
Items.Add('Dead Trees');
Items.Add('Plants');
Items.Add('Flax');
Items.Add('Boulders');
Items.Add('Henges');
Items.Add('Cacti');
Items.Add('Maple Trees');
Items.Add('Rocks');
Items.Add('NPC Dots');
end;
with Instructions do
begin
Parent := TabSheet[0];
Left := 10;
Top := 180;
Width := 480;
Height := 50;
ReadOnly := True;
ScrollBars := ssVertical;
Instructions.Lines.Add('Instructions: Select an object from the list and click ' + #39 + 'gather object' + #39 + ' to display all instances of that object on the minimap. ' + 'Click within circles to add or remove sub-points.');
SelStart := 1;
end;
with Output do
begin
Parent := TabSheet[0];
Color := 16777215;
Left := 10;
Top := 235;
Width := 480;
Height := 55;
end;
CleanMap := BitmapFromString(160, 160, '');
CurrentMap := BitmapFromString(160, 160, '');
FloodFillBitmap(CleanMap, IntToPoint(0, 0), 0, 16777215);
FloodFillBitmap(CurrentMap, IntToPoint(0, 0), 0, 16777215);
SetBitmapName(CleanMap, 'Clean');
SetBitmapName(CurrentMap, 'Current');
DrawBitmap(CleanMap, MMap.Canvas, 0, 0);
SubPoints := LoadTextTPA('Click ' + #39 + 'Grab Minimap' + #39, 'SmallChars', I);
OffSetTPA(SubPoints, IntToPoint(28, 62));
DrawDotsEx(SubPoints, 000000001);
SubPoints := LoadTextTPA('to get client image', 'SmallChars', I);
OffSetTPA(SubPoints, IntToPoint(31, 79));
DrawDotsEx(SubPoints, 000000001);
SetLength(SubPoints, 0);
Freeze;
TabPageControl.Pages[ForcePage].Show;
if (ForcePage = 2) then
begin
GatherMiniMap;
DrawMiniMap;
end;
ToolForm.SHOWMODAL;
TabPageControl.Free;
ToolForm.Free;
end;
procedure ToolForm_SafeInit;
var
v: TVariantArray;
begin
SetLength(v, 0);
ThreadSafeCall('ToolForm_Init', v);
end;
procedure FormLoad;
begin
ToolForm_SafeInit;
Unfreeze;
FreeBitmap(CleanMap);
FreeBitmap(CurrentMap);
end;
begin
{$IFDEF SMART}
{$IFDEF SIMBAMAJOR980}
SMART_Server := 10;
SMART_Members := True;
SMART_Signed := True;
{$ELSE}
SMART_FixSpeed := True;
{$ENDIF}
{$ENDIF}
CurrentNode := 0;
ForcePage := 0;
SetupSRL;
ObjDTM_Setup;
ObjectDTM.MainPoint := IntToPoint(80, 80);
ObjectDTM.NumOfPoints := 0;
ObjectDTM.NumOfAreaPoints := 0;
SetLength(ObjectDTM.SubPoints, ObjectDTM.NumOfPoints);
SetLength(ObjectDTM.Area, ObjectDTM.NumOfAreaPoints);
SetLength(SinglePath, 0);
// if (not LoggedIn) then
// begin
// if (LobbyScreen) then
// begin
// MouseBox(270, 500, 490, 520, mouse_left);
// while (not LoggedIn) do
// Wait(500);
// end else
// begin
// WriteLn('');
// WriteLn('Object DTM Generation Tool: WARNING! You are not logged in. Please login your character and run the tool again.');
// WriteLn('');
// TerminateScript;
// end;
//end;
ObjDTM_Debug := True;
ClickNorth(SRL_ANGLE_NONE);
Wait(400);
repeat
FormLoad;
if PathFinish then
begin
WriteLn('');
WriteLn('Object DTM Generation Tool: Generated path:');
WriteLn('');
WriteLn(SinglePath);
Exit;
end;
if (ForcePage = 2) then
begin
ObjDTM_Walk(SinglePath[CurrentNode - 1], 0, 100, 80, GroundLevelCheck);
while IsMoving do
Wait(100);
end;
until Done;
end.