Log in

View Full Version : Help getting this procedure to compile...



Archaic
03-02-2012, 02:36 AM
I've really been having a problem recently with getting this procedure to compile and its starting to get to me:

procedure ObstaclePipe;
Var
x, y:integer;

begin

if ObjDTM_InArea('79:81:5:2:7:73:61:2:7:101:34:5:7:22 :87:5:7:26:79:10:7:78:102:4:70:72:90:71:91:88:71:8 8', True) then
begin
if FindObstaclePipe(x, y) then
begin
GetMousePos(x, y);
Mouse(x, y, 4, 4, 1);
While(Wait(5000+random(4000))) do
Antiban;
end;
end;
end;

where FindObstaclePipe(x, y) is a function in the script with the form of:

function FindObstaclePipe(Var X, Y : Integer): Boolean;

There are probably other things wrong in the procedure because it's more of an example than anything, and those problems are generally easy to fix. But the problem I'm having has to do with that function I have in the procedure. The debug keeps saying that 'FindObstaclePipe' is a unknown identifier no matter what I do. If I try to declare the 'FindObstaclePipe' function as a boolean/integer/both it gets even more angry at me and I get type mismatch errors.

Probably a simple mistake, I've looked over tuts on functions with multiple parameters and such and I can get most to work, this one is just alluding me it seems though.

Please help?:)

Flight
03-02-2012, 02:50 AM
procedure ObstaclePipe;
Var
x,y: integer;
begin
if ObjDTM_InArea('79:81:5:2:7:73:61:2:7:101:34:5:7:22 :87:5:7:26:79:10:7:78:102:4:70:72:90:71:91:88:71:8 8', True) then
begin
if FindObstaclePipe(x, y) then //This will return the X/Y coordinate of where the object was found
begin
//GetMousePos(x, y); //This is not needed
Mouse(x, y, 4, 4, mouse_left); //Change "1" to "mouse_left"
While(Wait(5000+random(4000))) do
Antiban;
end;
end;
end;


Ok so... where you have this: "if FindObstaclePipe(x, y) then" that means that the FindObstaclePipe function must be returning a boolean (true or false). Also that functions must be declared before your ObstaclePipe procedure. I think that's where you're going wrong.

Archaic
03-02-2012, 06:25 AM
ohhhhhhhhhh:duh: thank you so much Flight! That makes so much sense now. I have been trying to figure this out for forever--crazy that it all comes down to having the function before the procedure.

Thank you so much:)

Flight
03-02-2012, 10:37 AM
Aw 'tis no biggie, to this day I make similar simple mistakes. ;)