Timothegreat
07-23-2011, 05:44 PM
I get an access violation right after running this procedure. I am wondering if anyone has any insight into what may cause this
This is inside one of my personal reflection scripts that is properly setup and has all includes declared
procedure RightClickHuman;
var
Humans: TPlayerArray;
HumanTile: TTile;
HumanPos: TPoint;
ChooseOne: integer;
begin
if not LoggedIn then exit;
Humans:= GetAllPlayers;
Humans:= SortPlayers(Humans);
if (Humans[0] = NULL_PLAYER)then exit;
for ChooseOne:= 0 to High(Humans)do
begin
HumanTile:= Humans[ChooseOne].Tile;
if TileOnMS(HumanTile,0)then break;
end;
HumanPos:= TileToMS(HumanTile,0);
if not(Distance(HumanPos.X,HumanPos.Y,0,0) < 10)then
begin
Mouse(HumanPos.X,HumanPos.Y,4,4,False);
wait(500+random(500));
end;
if (Random(1) = 0) then
begin
SleepAndMoveMouse(500+random(500));
end;
end;
Thanks!
Edit: Got new info about it... only happens when run at the beginning of a script it seems
This is inside one of my personal reflection scripts that is properly setup and has all includes declared
procedure RightClickHuman;
var
Humans: TPlayerArray;
HumanTile: TTile;
HumanPos: TPoint;
ChooseOne: integer;
begin
if not LoggedIn then exit;
Humans:= GetAllPlayers;
Humans:= SortPlayers(Humans);
if (Humans[0] = NULL_PLAYER)then exit;
for ChooseOne:= 0 to High(Humans)do
begin
HumanTile:= Humans[ChooseOne].Tile;
if TileOnMS(HumanTile,0)then break;
end;
HumanPos:= TileToMS(HumanTile,0);
if not(Distance(HumanPos.X,HumanPos.Y,0,0) < 10)then
begin
Mouse(HumanPos.X,HumanPos.Y,4,4,False);
wait(500+random(500));
end;
if (Random(1) = 0) then
begin
SleepAndMoveMouse(500+random(500));
end;
end;
Thanks!
Edit: Got new info about it... only happens when run at the beginning of a script it seems