I'm trying to make a procedure where when I mouse click a little red cross paints on smart to let me know where I clicked. As far as I can tell my code is all right. I've went over it like 50 times and can't seem to find the bug. Maybe an out side viewer can see what I can't seem to.
Also if you know of a shorter more neat why of doing this please let me know.
This is the error I keep getting: 'Error: Out Of Range at line 111'
Simba Code:
program new;
{$DEFINE SMART}
{$i srl/srl.scar}
{$i SRL/SRL/misc/paintsmart.scar}
var x,y:integer;
procedure MousePaint(mousex, mousey, ranx, rany: Integer; left: Boolean);
var
CTPA :integer;
TP:Tpoint;
TPA:TPointArray;
begin
MMouse(mousex, mousey, ranx, rany);
GetMousePos(x,y)
TP := Point(x,y);
SetLength(TPA,103)
/////////////////////////////////////////////
/////////////////////////////////////////////
//Draw right
for CTPA:= 0 to 9 do
begin
TPA[CTPA]:= TP;
TP := point(TP.x+1,TP.y);
end;
///////////////////////
TP := Point(x,y-1);
for CTPA:= 10 to 17 do
begin
TPA[CTPA]:= TP;
TP := point(TP.x+1,TP.y);
end;;
///////////////////////
TP := Point(x,y+1);
for CTPA:= 18 to 25 do
begin
TPA[CTPA]:= TP;
TP := point(TP.x+1,TP.y);
end;
/////////////////////////////////////////////
/////////////////////////////////////////////
TP := Point(x,y);
//Draw down
for CTPA:= 26 to 35 do
begin
TPA[CTPA]:= TP;
TP := point(TP.x,TP.y+1);
end;
///////////////////////
TP := Point(x+1,y);
for CTPA:= 36 to 43 do
begin
TPA[CTPA]:= TP;
TP := point(TP.x,TP.y+1);
end;
///////////////////////
TP := Point(x-1,y);
for CTPA:= 44 to 51 do
begin
TPA[CTPA]:= TP;
TP := point(TP.x,TP.y+1);
end;
/////////////////////////////////////////////
/////////////////////////////////////////////
TP := Point(x,y);
//Draw left
for CTPA:= 52 to 61 do
begin
TPA[CTPA]:= TP;
TP := point(TP.x-1,TP.y);
end;
///////////////////////
TP := Point(x,y+1);
for CTPA:= 62 to 69 do
begin
TPA[CTPA]:= TP;
TP := point(TP.x-1,TP.y);
end;
///////////////////////
TP := Point(x,y-1);
for CTPA:= 70 to 77 do
begin
TPA[CTPA]:= TP;
TP := point(TP.x-1,TP.y);
end;
/////////////////////////////////////////////
/////////////////////////////////////////////
TP := Point(x,y);
//Draw up
for CTPA:= 78 to 87 do
begin
TPA[CTPA]:= TP;
TP := point(TP.x,TP.y-1);
end;
///////////////////////
TP := Point(x+1,y);
for CTPA:= 88 to 95 do
begin
TPA[CTPA]:= TP;
TP := point(TP.x,TP.y-1);
end;
///////////////////////
TP := Point(x-1,y);
for CTPA:= 96 to 103 do
begin
TPA[CTPA]:= TP;
TP := point(TP.x,TP.y-1);
end;
Wait(60 + Random(30));
SMART_DrawDotsEx(false,TPA,clRed);
ClickMouse2(left);
end;
begin
Smart_Server := 44;
SetupSRL();
MousePaint(100,100,0,0,true)
end.