SRL Archive - Help and Support

Wierd as error


The Claw

2007-05-28 05:42:18

[Runtime Error] : Exception: Access violation at address 00711D18 in module 'scar.exe'. Read of address 00000034 in line 133 in script C:\Program Files\SCAR 3.01\includes\srl\srl\core\BitMap.scar

I get this in the debug box when I run this piece of code:

procedure FindKarimRepeated;
begin
Writeln('having trouble finding karim..maybe we are on top of him. moving');
MouseBox(666, 81, 675, 111, 1);
if(FindDeformed(x, y, KebabSign, 553, 6, 720, 160)) then
begin
Wait(100+random(10));
Mouse(x, y, 1, 1, true);
FreeBmps;
end else
begin
Writeln('Store Bitmap not found...');
Exit;
end;
end;

procedure KarimTrade;
begin
if(not(LoggedIn)) then exit;
S:=0
if(InStore = true) then
begin
repeat
if(not(LoggedIn)) then exit;
FindRandoms;
Wait(300 + random(100))
Writeln('In Store...attempting to right-click Karim');
S := S+1;
if(FindObj(x, y, 'arim', Karim, 10)) then
begin
MMouse(x, y, 1, 1);
Wait(50 + random(50));
end;
if(IsUpTextMulti('alk','to','arim')) then
begin
Mouse(x, y, 1, 1, false);
Wait(50 + random(25));
end;
if(S = 1) then
FindKarimRepeated;
if(S = 20) then
FindKarimRepeated;
if(S = 30) then
FindKarimRepeated;
if(S = 40) then
FindKarimRepeated;
if(S = 50) then
begin
Writeln('Took too long to find Karim, logging out');
Logout;
if(not(LoggedIn)) then exit;
end;
until(FindColorTolerance(x, y, Talk, 0, 0, 512, 337, 3)) or (S = 50)
S := 0;
end;
begin
ClickOption('alk', 1)
Writeln('Talking to Karim');
Flag;
end;
end;

Im delibrately making it not find karim on the first shot, so S = 1, so I can test out the walking away and coming back procedure i made. But when it walks away, and is meant to find the bitmap again, i get that wierd error which I posted above. I know for sure its nothing to do with the bitmap, seeing as it can find the bitmap perfect earlier on in the script, using this:

if(FindDeformed(x, y, KebabSign, 553, 6, 720, 160)) then

So ive got no clue.

While Im making a new post, I may as well ask about other things im wondering about too I geuss lol

Instead of using

if(S = 1) then
FindKarimRepeated;
if(S = 20) then
FindKarimRepeated;
if(S = 30) then
FindKarimRepeated;
if(S = 40) then
FindKarimRepeated;
if(S = 50) then

is there some way I can put that into an array?

and also, what is the best way to check if a door is open or shut? I was thinking of using a bitmap to find it, move the mouse there, and check up text, but I cant get it to find the right bitmap all the time. DTM is the same. And finding it using colours doesnt work either.

sorry about all the questions, im relatively new to making scripts in this much detail and I want this to be perfect.

any help at all is much appreciated.

omgh4x0rz

2007-05-28 06:33:00

As for your first question. I think the problm has to do with freeing the bitmap. since you never define what the bitmap string is in FindKarimRepeated, then after you call it once and the bitmap gets freed, scar won't know what the bitmap is the next time. Just take out that one line and I think you'll be okay.


For your second question, you can use 'cases'


case S of
1: FindKarimRepeated;
20: FindKarimRepeated;
30: FindKarimRepeated;
40: FindKarimRepeated;
50: FindKarimRepeated;
end;

I've never actually made a script that opens doors, so I can't help you there. But Boreas has a link in his sig to a project he made to help with doors.

The Claw

2007-05-28 07:52:18

cheers heaps for that dude, cant believe i forgot to reload the bitmap lol. and cases is working perfect! :)

im still wondering about how to do the door, ive been wondering ever since i started the script.

if your interested, the script is here:

http://www.srl-forums.com/forum/autokebabber-t11907.html?t=11907

nielsie95

2007-05-28 09:15:22

You can try bitmap-slices or walk in front of the door (Doors by Boreas could be helpfull) and turn the compass, lower the angle and look for the door using colors :)

Boreas

2007-05-28 09:46:27

For doors, use my Doors to click the red on the minimap, get you really close. Then as nielsie said, LowestAngle; and turn the compass, so the door is big as possible and in middle of the screen. Then get a tiny (maybe 1x3) bitmap, with quite a bit of tolerance (as long as there are no wooden chairs etc, you can go pretty high). Since you pretty much know where it will be, you can look in a fairly small box near the middle.


Edit: also some functions using DoorProfiles here http://www.villavu.com/forum/showthread.php?t=9407?t=10617

danrox2004

2007-05-28 10:01:20

You could also do something like
if(((S mod 10) = 0) or (s = 1)) then
FindKarimRepeated;

Although it might be easier to do what omgh4x0rz said…

Also with the doors you could walk to the nearest door with
DoorColor := GetDoorColor;
if(FindClolorSpiral(x, y, DoorColor, MMX1, MMY1, MMX2, MMY2)) then
begin
Mouse(x, y, 0, 0, True);
FFlag(5);
Wait(1000);
end
However I think the best way to actually click the doors will be with a DTM or something, if that doesn't work then maybe split the screen into quarters and look in each quarter for it.

EDIT: Too late