SRL Archive - Discussions and Debates

Problems with Certer.scar & Box.scar


Special Ed

2007-11-06 17:33:09

Well I was running Tara's chicken killer overnight one night and I woke up with an error with Box.scar, the next day I ran it again overnight, this time I got a problem with certer.scar.

Take a look at the code and what-not I've got some ideas on how to fix but I'm not sure….

******** SOLVED BOX RANDOM ********
Found a box, solving...
Question is:
What number is the Triangle
[Runtime Error] : Exception: Access violation at address 02093B0C in module 'BoxPlugin.dll'. Write of address 6FD6A14C in line 200 in script C:\Program Files\SCAR 3.12\includes\SRL/SRL/Core/AntiRandoms/Box.scar

{*******************************************************************************
function SolveBox: Boolean;
by: pups
Description: Solves the Box!
*******************************************************************************}

function SolveBox: Boolean;
var
side, st2: Integer;
shapeQ, shape, ans: string;
numQ, num: Integer;
x, y: Integer;
c: TCanvas;
begin
while OpenBox do
begin
WriteLn('Found a box, solving...');
Wait(1000);
GetQuestion(numQ, shapeQ);
if (shapeQ = '') and (numQ = 10) then
continue;
WriteLn('Question is:');
if shapeQ = '' then
WriteLn('Which shape has number ' + IntToStr(numQ))
else
WriteLn('What number is the ' + shapeQ);
st2 := GetSystemTime;
repeat
side := GetBoxSide;
c := GetBitmapCanvas(side);
if (ScreenShots) then
SaveBitmap(side, ScriptPath + 'box_debug.bmp');
ProcessPicture(c, shape, num, 0); //Line 200
FreeBitmap(side);
if (num = numQ) or (shape = shapeQ) then
begin
if num = numQ then
ans := shape
else
ans := IntToStr(num);
WriteLn('Answer is ' + ans);
TakeScreen('Solved box answer - '+Ans);
if FindText(x, y, ans, upchars, 116, 286, 183, 311) then
Mouse(120, 290, 30, 10, True);
if FindText(x, y, ans, upchars, 235, 286, 302, 311) then
Mouse(240, 290, 30, 10, True);
if FindText(x, y, ans, upchars, 350, 286, 417, 311) then
Mouse(355, 290, 30, 10, True);
NewBoxes := NewBoxes + 1;
WriteLn('******** SOLVED BOX RANDOM ********');
WriteFileString(TheFile, '******** SOLVED BOX RANDOM ********' +
Chr(13));
Result := True;
Break;
end;
until GetSystemTime > st2 + 12000;
Wait(1500 + Random(1000));
end;
end;


******** FOUND TALKING RANDOM TEXT********: Talk-to Giles
1. sword
2. axe
3. ring
[Runtime Error] : Out Of Range in line 49 in script C:\Program Files\SCAR 3.12\includes\SRL/SRL/Core/AntiRandoms/Certer.scar

{*******************************************************************************
function FindCerterPixels : TPointArray;
by: SKy Scripter
Description: Returns All Certer Object Pixels.
*******************************************************************************}

function FindCerterPixels : TPointArray;
var
P : TPointArray;
ColorData : TIntegerArray;
i, a, BackGround : Integer;
begin
if (not(CerterScreen)) then Exit;
BackGround := GetColor(151, 151);
FindColorsTolerance(P, BackGround, 151, 151, 376, 294, 255 * 3);
ColorData := GetColors(P);
SetArrayLength(Result, 30800); // 30800 >> as many point possible
for i := 0 to Length(P)-1 do
if (ColorData[i] <> BackGround) then
begin // Line 49
Result[a] := P[i];
inc(a);
end;
SetArrayLength(Result, a);
end;

For the second of the two, maybe their can be for points than 30,800… I'm not sure but its a though. As for the first one, I don't know what process picture is and it wasn't in Certer.scar so I haven't seen it yet.

Timer

2007-11-06 17:41:23

I was having this too, i'm guessing its something to do with screen shots, disable them, then i never had problems again..

EDIT: opps that not possible then it wouldn't solve lol, well i meant the ones to save the awnser

Special Ed

2007-11-06 17:44:15

Maybe for Box Solving but the Certer has nothing to do with saving screen shots so I don't think that's the ultimate solution.

Timer

2007-11-06 17:46:12

Hmm, lets look hard at the nerby coding of the error

XcanadamanX

2007-11-06 17:47:27

the box solving one is in the plugin for the box solver(process picture is in the plugin) and i have no clue about the certer.

Timer

2007-11-06 17:50:56

Someting To Do With
ColorData[i]
? I Think…

Special Ed

2007-11-06 18:02:20

Thats what I was thinking seeing as it said "[Runtime Error] : Out Of Range" I'm assuming its referring to ColorData is has more values that it does length.

I think if we did SetArrayLength(ColorData, GetArrayLength(P)) that would fix it although I don't know how much lag that would cause.

P.S. This ruined a perfectly good 14 Character (Possibly 24 hour) Progress report… It was at 21+ hours when it stopped.

SKy Scripter

2007-11-06 18:06:50

Listen It cant be the Certer, it would have to be SCAR.

those points SetArrayLength(Result, 30800); // 30800 >> as many point possible

are the most you can get. its must be somthing with SCAR. because iv'e ran CERTER several times and this ERROR has never Showed up.

i guess you could always do SetArrayLength(Result, length(P));
but it shouldnt matter..

Special Ed

2007-11-06 18:11:19

Because you are infallible, right Sky?

{
by: SKy Scripter
}

Either way, I assumed you would have tested it multiple times and used some test to make sure that those where to maximum amount of points, I'm just saying it could be a possibility.

If it is something with SCAR or even with the code, any ideas on how to fix it?

EDIT: Ya it works all the time normally, I've had it solve it before so I don't know where the problem lies.

SKy Scripter

2007-11-06 18:59:56

Because you are infallible, right Sky?


Of Course im the best :)

376 - 151 = 225;

376 - 294 = 82;

255 * 82 = 20910

its not even possible.. its SCAR choice not Mine XD

Special Ed

2007-11-06 19:10:54

From: SKy Scripter
Of Course im the best :)

376 - 151 = 225;

376 - 294 = 82;

255 * 82 = 20910

its not even possible.. its SCAR choice not Mine XD


What are those coordinates and what do they mean to me? They're not the main screen coordinates I know…

The Claw

2007-11-07 03:14:12

At a guess, the co-ords of the area the certer solver searches in?

SKy Scripter

2007-11-07 09:03:33

From: The Claw
At a guess, the co-ords of the area the certer solver searches in?


exactly, and if i dont remember i set them like 30800 which is more.

So I Scan about 20, 000 pixels
and i Set about 30, 000 pixels..

in other words it just woudnt make sense to have got a ERROR in less SCAR was a Crack.

the scar noob

2007-11-07 09:52:23

I don't have this problem :/
I'm autoing right now with wizzy's VEM , which already has solved a certer.

-Tsn.

nielsie95

2007-11-07 11:02:48


FindColorsTolerance(P, BackGround, 151, 151, 376, 294, 255 * 3);

w := 376 - 151 = 225
h := 294 - 151 = 143
maxPoints := w * h = 32175

32175 > 30800
Am I missing something?

SKy Scripter

2007-11-07 13:46:52

From: nielsie95

FindColorsTolerance(P, BackGround, 151, 151, 376, 294, 255 * 3);

w := 376 - 151 = 225
h := 294 - 151 = 143
maxPoints := w * h = 32175

32175 > 30800
Am I missing something?


Lmfao, My bad… I must have messed up twice…

thats weird.. Even then It wouldnt be possible to have the hole box filled with CERTER pixels…

also because the answers were..

1. sword
2. axe
3. ring

the axe is the biggest… but its not that big XD

Special Ed

2007-11-08 23:12:59

Hey, it just happened and I wanted to bring it to your attention. Also I can't multiple / add after 6:00 and before 7:00 its just not physically possible :p