Log in

View Full Version : Unknown identifier 'x' at line 76



DiN
06-30-2012, 08:50 AM
Hey, I keep getting this error while trying to make the bot go up stairs.

[Error] (77:12): Unknown identifier 'x' at line 76
Compiling failed.

Here is my code:
procedure GetToBank;
begin
if FindObj(x, y, 'in', 2836822, 35) then
WriteLn('Stairs Found...');
Mouse(x,y, 0, 0, true);
ChooseOption('limb-up');
end;

Caotom
06-30-2012, 08:54 AM
You have not declared x as an integer variable either globally or inside the procedure.
Check out some of the beginners tutorials and their variables section if you don't know what I mean.

~Caotom

P1ng
06-30-2012, 08:55 AM
You haven't told the procedure what x and y are, in this case they are integers which will hold the x and y co-ordinate of the objects position.
You can either call x and y as global variables at the beginning of your script, but it is common-place and good practice to call them within your procedure as shown below -
procedure GetToBank;
var
x,y: integer;
begin
if FindObj(x, y, 'in', 2836822, 35) then
WriteLn('Stairs Found...');
Mouse(x,y, 0, 0, true);
ChooseOption('limb-up');
end;

DiN
06-30-2012, 09:34 AM
You haven't told the procedure what x and y are, in this case they are integers which will hold the x and y co-ordinate of the objects position.
You can either call x and y as global variables at the beginning of your script, but it is common-place and good practice to call them within your procedure as shown below -
procedure GetToBank;
var
x,y: integer;
begin
if FindObj(x, y, 'in', 2836822, 35) then
WriteLn('Stairs Found...');
Mouse(x,y, 0, 0, true);
ChooseOption('limb-up');
end;

Thank you! That solved the issue!