Log in

View Full Version : Weird Problem



shnk
01-01-2012, 06:42 AM
my script completes one full loop and when it's done it waits around 7 seconds to start again. and when it's started, it goes to the top right corner, right clicks and then clicks cancel. i've checked my script ten times now and no where did i tell it to wait 7 seconds between loops or go to the top right corner...

[edit]

here's my code, i know it's pretty bad but it's my first.

program sVialFiller;

//{$DEFINE SMART}
{$i SRL\SRL.scar}

const
//World = 0; //Leave it 0 for a random world
//Members = false; //F2P = false, P2P = true
Version = '1.0';

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name :=''; //RuneScape username
Players[0].Pass :=''; //RuneScape password
Players[0].Nick :='';
Players[0].Active:=True;
end;

function Banking: boolean;
var VialFull, ex, ey, ix, iy : integer;
begin
VialFull := BitmapFromString(10, 9, 'meJzb21q7F4a2NVYuLclbUJg9Oze' +
'9JSa8KMBnT0stHG2tr1hemg+UnZOX0ZEQVRbsjyy7ubZseVn+ oqIc' +
'oGxfSlxNeNDulho42giWXVycOy8/Y1J6YkNUKLLsuuqSleUFQNkFB' +
'ZkzslOBVu9sroYjoOyqikKQwwoygQ4DWo0su6GmFCgLcRhQti cpdk' +
'dTFRwB7V1TWQSUhThsYloCmuzaqmKIs4EOm5qZDADCJ40S');
if FindBitmapToleranceIn (VialFull, ex, ey, 560, 215, 590, 245, 25) then
begin
FindColorTolerance (ix, iy, 3106426, 110, 125, 365, 150, 20)
Mouse (ix, iy, 5, 5, false);
WaitOption ('uickly', 500);
Wait (750);
Mouse (ex, ey, 5, 5, false);
Wait (500);
WaitOption ('it-All V', 500);
end else
OpenBank ('veb', false, false);
Writeln ('Could not find BITMAP');
end;

function FindVials: boolean;
var Bitmap, x, y : integer;
begin
Bitmap:= BitmapFromString(13, 9, 'meJxN0FcOg0AMRdFFIVIg9A6hD70' +
'OafvfQR6aZIR0P48s25/H9jn0WOahabqKVEUe+b6hqvL1ehKE90ZZ' +
'jG3zPLYtWF0WSRhauq7I0lkUOWPRadxZXYFl8d21TF1VpMvlR Snib' +
'B2HqdtZU5ZlmvqOwwYyxmOsr2swkueh5zmmqSm317ruHVnfgb WEgM' +
'Vh4Dm2qWk/9g+7geFYMBybRFHgurZhPNcFHdnc9/wneRLfA9+zLTw' +
'KMYzoNC3DwI8lWYZp2O0LwDN21A==');
if FindBitmapToleranceIn (Bitmap, x, y, 32, 88, 80, 130, 10) then
begin
Writeln ('Bitmap found');
Mouse (x, y, 5, 5, false);
WaitOption ('w-All V', 500);
Wait (500);
CloseBank;
Wait (500);
end else
Writeln ('Unable to find bitmap');
end;

function CheckRunStatus: boolean;
begin
SetRun (true);
end;
function CheckGameTab: boolean;
begin
GameTab (25);
end;

function WalkToWaterSource: boolean;
var sx, sy, mx, my : integer;
begin
if FindColorTolerance (sx, sy, 1712165, 655, 135, 675, 150, 20) then
begin
MouseSpeed:= 10;
Mouse (sx, sy, 5, 5, true);
Wait (5000);
FindColorTolerance (mx, my, 16213284, 570, 30, 680, 140, 20);
Mouse (mx, my, 5, 5, true);
end;
end;

function WalkToBank: boolean;
var qx, qy, ex, ey : integer;
begin
if FindColorTolerance (qx, qy, 11844284, 560, 50, 580, 60, 20) then
begin
MouseSpeed:= 10;
Mouse (qx, qy, 5, 5, true);
Wait (5000);
FindBank ('veb');
end;
end;

function VialToPump: boolean;
var bx, by, dx, dy, Vial : integer;
begin
bx:= MSCX;
by:= MSCY;
Vial:= BitmapFromString(13, 9, 'meJxN0FcOg0AMRdFFIVIg9A6hD70' +
'OafvfQR6aZIR0P48s25/H9jn0WOahabqKVEUe+b6hqvL1ehKE90ZZ' +
'jG3zPLYtWF0WSRhauq7I0lkUOWPRadxZXYFl8d21TF1VpMvlR Snib' +
'B2HqdtZU5ZlmvqOwwYyxmOsr2swkueh5zmmqSm317ruHVnfgb WEgM' +
'Vh4Dm2qWk/9g+7geFYMBybRFHgurZhPNcFHdnc9/wneRLfA9+zLTw' +
'KMYzoNC3DwI8lWYZp2O0LwDN21A==');
if FindBitmapToleranceIn(Vial, dx, dy, 565, 210, 590, 245, 10) then
begin
Mouse (dx, dy, 5, 5, true);
Wait (500);
FindObj (bx, by, 'ountain', 16430217, 10);
Mouse (bx, by, 5, 5, false);
WaitOption ('se Vial', 500);
Wait (500);
end else
Writeln ('Unable to find bitmap');
end;

function DoRest: Boolean; //Credits to ggzz for this
var
S: String;
RunE: Integer;
begin
RunE:= GetMMLevels('run', S);
if (RunE < 30) then
begin
SetRest;
while (RunE < 98) do
wait(1);
end;
Result:= (RunE = 100);
end;

procedure SetUp;
begin
SetUpSRL;
//ActivateClient;
DeclarePlayers;
//LoginPlayer;
//CheckGameTab;
end;

procedure Loop;
begin
repeat
DoRest;
Banking;
Wait (500);
FindVials;
CheckRunStatus;
WalkToWaterSource;
Flag;
Wait (500);
VialToPump;
Wait (18000);
WalkToBank;
Flag;
Wait (5000);
until (false);
end;


begin
SetUp;
Loop;
end.

Harry
01-01-2012, 06:43 AM
Why don't you post the code or what script you're running

shnk
01-01-2012, 06:45 AM
alright just give me a second.

Harry
01-01-2012, 07:04 AM
Your end-else in banking doesn't have a begin/end. You never check if findobj worked properly - if it doesn't find the object it returns 0,0 which is top left screen, and thats probably your issue.

shnk
01-01-2012, 07:12 AM
Your end-else in banking doesn't have a begin/end. You never check if findobj worked properly - if it doesn't find the object it returns 0,0 which is top left screen, and thats probably your issue.

but it moves to 0,0 when it's done 1 full loop and the 2nd loops "Banking;"
that not near when it starts to findobj doesn't come until it walks near the fountain and stuff

Brandon
01-01-2012, 07:23 AM
but it moves to 0,0 when it's done 1 full loop and the 2nd loops "Banking;"
that not near when it starts to findobj doesn't come until it walks near the fountain and stuff

Harry missed this by accident I believe.


Wait (18000);
WalkToBank;
Flag;
Wait (5000);



//In your banking you HAVE:

end else
OpenBank ('veb', false, false);
Writeln ('Could not find BITMAP');
end;

//Harry meant to change it to:

end else
begin
OpenBank ('veb', false, false);
Writeln ('Could not find BITMAP');
end;
end;


Right there.. at the end of your loop.. it waits 5 seconds.. Not 7.. Next is that big 18 second wait.. you might want to replace that with a finding function to find if your vials are full or what not THEN walk to the bank.. because if you lag for even 1 second every time, it will throw your script off drastically.