PDA

View Full Version : I keep getting "Access violation" error



Nufineek
02-09-2014, 01:04 AM
I keep getting this error:

Exception in Script: Runtime error: "Access violation" at line 352, column 53 in file "C:\Simba\Includes\SRL-6\lib\interfaces\chooseoption.simba"

Before this occurs, my script runs fine for 1 hour or so.

Here are the parts where the error occurs.

procedure openGEbanker;
var
x, y, i, c: integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
if (not bankScreen.isOpen()) then
begin
repeat
if (bankScreen.isOpen()) then
exit;
productionScreen.clickStart;
findColorsSpiralTolerance(x, y, TPA, 818592, mainScreen.getBounds(), 13, colorSetting(2, 0.12, 0.83));
ATPA := TPA.toATPA(30, 30);
atpa.sortFromFirstPoint(point(289, 40));
smartImage.debugATPA(ATPA);

if length(TPA) < 1 then
continue;
mouse(middleTPA(ATPA[0]), MOUSE_MOVE);
inc(c);
writeln(intToStr(c));
if isMouseOverText(['anker'], 500) then
begin
fastClick(MOUSE_RIGHT);
wait(100 + random(100));
chooseOption.select(['ank']);
end;
until (c = 30);
if c = 30 then
begin
Writeln('Failed to find the banker. Shutting down.');
TerminateScript;
end;
end;
end;

procedure withdrawItems;
begin
if not isLoggedIn() then
exit
if (not bankScreen.isOpen()) then
begin
Writeln('We are not at bank');
openGEbank;
end else
if random(75) > 73 then
begin
writeln('Pretending to looking at another website');
mouseOffClient(OFF_CLIENT_RANDOM);
wait(randomRange(5000, 25000));
end;
bankScreen.withdraw(9, 14, ['']);
bankScreen.withdraw(10, 14, ['']);
end;

Sk1nyNerd
02-09-2014, 01:40 AM
try using a boolean expression
function openGEbanker: boolean; //*********
var
x, y, i, c: integer;
TPA: TPointArray;
ATPA: T2DPointArray;

begin
Result := False; //***********
if (not(IsLoggedIn) then //*********
Exit;

if (not bankScreen.isOpen()) then
begin
repeat
productionScreen.clickStart;
findColorsSpiralTolerance(x, y, TPA, 818592, mainScreen.getBounds(), 13, colorSetting(2, 0.12, 0.83));
ATPA := TPA.toATPA(30, 30);
atpa.sortFromFirstPoint(point(289, 40));
smartImage.debugATPA(ATPA);

if length(TPA) < 1 then //******** > 1?
continue;
mouse(middleTPA(ATPA[0]), MOUSE_MOVE);
inc(c);
writeln(intToStr(c));
if isMouseOverText(['anker'], 500) then
begin
fastClick(MOUSE_RIGHT);
wait(100 + random(100));
chooseOption.select(['ank']);
Result := True; //**********
Break; //**** you wana exit the loop or c always goes to 30
end;
until (c = 30);
if c = 30 then
begin
Writeln('Failed to find the banker. Shutting down.');
TerminateScript;
end;
end;
end;

Brotein
02-09-2014, 02:17 AM
What is the code on line352. The only thing I can think of is
mouse(middleTPA(ATPA[0]), MOUSE_MOVE);
Maybe your color isn't found and ATPA[0] is empty

Flight
02-09-2014, 02:18 AM
Which line specifically is #352 (http://villavu.com/forum/usertag.php?do=list&action=hash&hash=352) ?

Nufineek
02-09-2014, 02:42 AM
What is the code on line352. The only thing I can think of is
mouse(middleTPA(ATPA[0]), MOUSE_MOVE);
Maybe your color isn't found and ATPA[0] is empty

well its line in srl6 lib file "chooseoption":
// sort chars from (left..right) and then read the text
sortATPAFromFirstPointX(tmp, [b.x1, atpa[i][0].y]);

Flight
02-09-2014, 03:06 AM
I remember having a similar problem in my personal OSR-fighter script that rapidly right-clicks Big Bones on the ground to check for seeds and I'd also sometimes get this same error due to grabbing all the options in the right-click menu. I did a lot of checks within the getOptions() function and even used a try...except so if the error occurs the function is simply exited out rather than script termination.

Nufineek
02-09-2014, 09:48 AM
I remember having a similar problem in my personal OSR-fighter script that rapidly right-clicks Big Bones on the ground to check for seeds and I'd also sometimes get this same error due to grabbing all the options in the right-click menu. I did a lot of checks within the getOptions() function and even used a try...except so if the error occurs the function is simply exited out rather than script termination.

Oh, and where would you put it in this case? I have never used try..except.

Flight
02-09-2014, 11:16 AM
Oh, and where would you put it in this case? I have never used try..except.

I would suggest bringing this up with one of the SRL-6 developers, it might help them spot a flaw in that function.

Nufineek
02-09-2014, 03:45 PM
I remember having a similar problem in my personal OSR-fighter script that rapidly right-clicks Big Bones on the ground to check for seeds and I'd also sometimes get this same error due to grabbing all the options in the right-click menu. I did a lot of checks within the getOptions() function and even used a try...except so if the error occurs the function is simply exited out rather than script termination.
thanks try..except helped...as a temporary solution at least. Thanks :)