SRL Archive - Help

Unknown identifier 'x' at line 76


DiN

2012-06-30 04:50:53

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

2012-06-30 04:54:39

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

2012-06-30 04:55:42

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

2012-06-30 05:34:57

From: p1ng
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!