SRL Archive - OSR Help

Small error, please help out


osmm

2007-10-11 17:34:03

Basicly I'm VERY NEW to scripting…So far all I'm doing is editing scripts for my personal use.

My problem is that I copied and pasted a procedure that turns on prayer…(Masterkill's procedure)

Procedure CastPrayer;
begin
if (Players[CurrentPlayer].Booleans[0] = False) then exit;
GameTab(6);
Wait(100 + random(100));
if (FindColorTolerance(x, y, 15533737, 551, 324, 583, 355, 20)) then
begin
Mouse(567, 340, 3, 3, True);
Mouse(715, 305, 3, 3, True);
end;
end;


So I copied and pasted that into script, and I added the
Players[0].Booleans[0] := True; // Use prayer? (!you need prayer lvl 34+!)
to the player setup.

The error I'm getting now is
Line 118: [Error] (14813:24): Unknown identifier 'x' in script
Failed when compiling


And I'm guessing it will have an error with "identifier 'y' in script"

My question to you is how do I solve this problem???

RAM

2007-10-11 18:55:43

You need to declare x and y as Variables in the top of your script.

§RAM

osmm

2007-10-11 19:34:24

and how exactly do i do that…?

rogeruk

2007-10-11 20:10:14

You can either..

Procedure CastPrayer;
var
x,y:Integer;
begin
if (Players[CurrentPlayer].Booleans[0] = False) then exit;
GameTab(6);
Wait(100 + random(100));
if (FindColorTolerance(x, y, 15533737, 551, 324, 583, 355, 20)) then
begin
Mouse(567, 340, 3, 3, True);
Mouse(715, 305, 3, 3, True);
end;
end;

or at the top where it says..

Program New;

var
x,y:Integer;

osmm

2007-10-11 21:44:31

Rogeruk thanks a lot. But now I got another problem. It never actually clicks prayer… IDK I think I'm just gona learn how to script and do this myself. Ty anyways

Da Der Der

2007-10-11 21:50:42

Go to tutorial island on the SRL Forums. It helps plenty. That's how I learned to script.