SRL Archive - Help and Support

Error :p


maxzzz

2006-03-19 02:56:18

Error: Variable Expected, can't find out how to solve this.

procedure WaitWhileString;
(global) var
Stringed, StringedReport, Banked, Loops, AverageBows, Made, BsColorInv : Integer;
AverageMultiplier, AverageBowsEx : Extended;
InvString, InvBow, InvStringRe, InvBowRe : Tpoint;

begin
repeat
FindRandoms;
if(FindObjIn('Use Bow', 846, 574, 877, 600, BsColorInv, 5))then //----> Variable Expected.
begin
InvStringRe := ItemCoords(27); // returns coords of string
CMouse(InvStringRe.X, InvStringRe.Y, 4, 6, true); // Moves mouse to string and clicks left
wait(50+random(25)); // wait 10-15 ms
InvBowRe := ItemCoords(28); // returns coords of bow
CMouse(InvBowRe.X, InvBowRe.Y, 4, 6, true); // Moves mouse to pos and clicks left
wait(50+random(25)); // wait 10-15 ms
end;
until(not(ExistsItem(27)))or(not(ExistsItem(28)));
end;

Phlame

2006-03-19 03:04:10

why do you have the "if"? I think i encountered a similar error in my script and just took out the if/then and it ran great. so try this:

procedure WaitWhileString;
(global) var
Stringed, StringedReport, Banked, Loops, AverageBows, Made, BsColorInv : Integer;
AverageMultiplier, AverageBowsEx : Extended;
InvString, InvBow, InvStringRe, InvBowRe : Tpoint;

begin
repeat
FindRandoms;
(FindObjIn('Use Bow', 846, 574, 877, 600, BsColorInv, 5)) //----> Variable Expected.
begin
InvStringRe := ItemCoords(27); // returns coords of string
CMouse(InvStringRe.X, InvStringRe.Y, 4, 6, true); // Moves mouse to string and clicks left
wait(50+random(25)); // wait 10-15 ms
InvBowRe := ItemCoords(28); // returns coords of bow
CMouse(InvBowRe.X, InvBowRe.Y, 4, 6, true); // Moves mouse to pos and clicks left
wait(50+random(25)); // wait 10-15 ms
end;
until(not(ExistsItem(27)))or(not(ExistsItem(28)));
end;

maxzzz

2006-03-19 03:07:34

Offcourse not because I only want the script to do it If! it finds the Object.

Phlame

2006-03-19 03:21:10

then try this if you're wanting to use conditionals

procedure WaitWhileString;
(global) var
Stringed, StringedReport, Banked, Loops, AverageBows, Made, BsColorInv : Integer;
AverageMultiplier, AverageBowsEx : Extended;
InvString, InvBow, InvStringRe, InvBowRe : Tpoint;

begin
repeat
FindRandoms;
If FindObjIn('Use Bow', 846, 574, 877, 600, BsColorInv, 5) then //----> Variable Expected.
begin
InvStringRe := ItemCoords(27); // returns coords of string
CMouse(InvStringRe.X, InvStringRe.Y, 4, 6, true); // Moves mouse to string and clicks left
wait(50+random(25)); // wait 10-15 ms
InvBowRe := ItemCoords(28); // returns coords of bow
CMouse(InvBowRe.X, InvBowRe.Y, 4, 6, true); // Moves mouse to pos and clicks left
wait(50+random(25)); // wait 10-15 ms
end else
begin
break; //if item not found, breaks repeat to end loop
end;
until(not(ExistsItem(27)))or(not(ExistsItem(28))); //still here since if it is found, this will play in.
end;