Log in

View Full Version : wont compile



weezy
11-26-2010, 08:28 AM
procedure MoveToBox(box:TBox);
var tpt:TPoint;
ttl:TTile;
begin
repeat
ttl := Tile(RandomRange(box.x1, box.x2),RandomRange(box.y1, box.y2));
sleep(500+random(300));
until TileOnMM(ttl);
tpt := TileToMM(ttl);
Mouse(tpt.x, tpt.y, 3, 3, true);
FindNormalRandoms;
end;

procedure fWalkPath(tta:TPointArray;reverse:boolean);
var i:integer;
begin
if reverse then
begin
for i := high(tta) downto 0 do
begin
if TileOnMM(PointToTile(tta[i]) then
break;
end;

for i := i to high(tta) do
begin
MoveToBox(PointToBox(tta[i]),4);
end;
end else
begin
for i := 0 to high(tta) do
begin
if TileOnMM(PointToTile(tta)) then
break;
end;

for i := i downto 0 do
begin
MoveToBox(PointToBox(tta[i]),4);
end;
end;

R_Flag;

end;

can anyone help me find whats wrong here?

i luffs yeww
11-26-2010, 08:30 AM
You need a 'main loop,' for one. ;)


procedure MoveToBox(box:TBox);
var tpt:TPoint;
ttl:TTile;
begin
repeat
ttl := Tile(RandomRange(box.x1, box.x2),RandomRange(box.y1, box.y2));
sleep(500+random(300));
until TileOnMM(ttl);
tpt := TileToMM(ttl);
Mouse(tpt.x, tpt.y, 3, 3, true);
FindNormalRandoms;
end;

procedure fWalkPath(tta:TPointArray;reverse:boolean);
var i:integer;
begin
if reverse then
begin
for i := high(tta) downto 0 do
begin
if TileOnMM(PointToTile(tta[i]) then
break;
end;

for i := i to high(tta) do
begin
MoveToBox(PointToBox(tta[i]),4);
end;
end else
begin
for i := 0 to high(tta) do
begin
if TileOnMM(PointToTile(tta)) then
break;
end;

for i := i downto 0 do
begin
MoveToBox(PointToBox(tta[i]),4);
end;
end;

R_Flag;

end;

begin //THIS IS THE MAIN LOOP, WHICH EVERY SCRIPT NEEDS.
//dowhatever
end.

weezy
11-26-2010, 07:57 PM
It's a mini-include I was making for myself to keep my scripts organized as I usually re-use many functions from my code since I make functions generalized that can be usually used in any scripts.

I just can't figure out why this one won't compile... :(

NCDS
11-26-2010, 08:03 PM
It's a mini-include I was making for myself to keep my scripts organized as I usually re-use many functions from my code since I make functions generalized that can be usually used in any scripts.

I just can't figure out why this one won't compile... :(

What error does it give?

weezy
11-26-2010, 09:10 PM
I fixed it now thanks if you tried, here's the code if anyone was interested in what was wrong or in using the code.

function PtToBox(tile:TPoint;size:integer):TBox;
begin
Result.X1 := Round(tile.x - size/2);
Result.X2 := Round(tile.x + size/2);
Result.Y1 := Round(tile.y - size/2);
Result.Y2 := Round(tile.y + size/2);
end;

procedure MoveToBox(box:TBox);
var tpt:TPoint;
ttl:TTile;
begin
repeat
ttl := Tile(RandomRange(box.x1, box.x2),RandomRange(box.y1, box.y2));
sleep(500+random(300));
until TileOnMM(ttl);
tpt := TileToMM(ttl);
Mouse(tpt.x, tpt.y, 3, 3, true);
FindNormalRandoms;
end;

procedure fWalkPath(tpa:TPointArray;reverse:boolean);
var i:integer;
begin
if not reverse then
begin

for i := high(tpa) downto 0 do
begin
if TileOnMM(PointToTile(tpa[i])) then
break;
end;

for i := i to high(tpa) do
begin
MoveToBox(PtToBox(tpa[i],4));
end;

end else
begin

for i := 0 to high(tpa) do
begin
if TileOnMM(PointToTile(tpa[i])) then
break;
end;

for i := i downto 0 do
begin
MoveToBox(PtToBox(tpa[i],4));
end;

end;

R_FFlag(0);

end;