Extracht
11-16-2007, 06:17 PM
Hello, Im getting the following error:
[Runtime Error] : Exception: Access violation at address 00721CA1 in module 'scar.exe'. Read of address 00000034 in line 176 in script C:\Users\Laurens\Desktop\Scar Scripts\Autocutter and banker by Extracht!.scar
what to do to fix it?? :(
EDIT: I changed my code! still getting the same error.. but now with something else..
This is the code Im using:
program Walker;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/Woodcutting.Scar}
const
RunDir = 'N'; //Direction to run: 'N','S','E','W'
RunFar = False; // Set true to run far
UseMapWalk = True; //Try Expermental Map Walk.
TreeMMColor = 864078; //Experemental Mapwalking
TalkEvery = 25; // Talk Every in minutes. Random 10 added.
var
cp: string;
ARCount, axemask, CKCount, timemark, talkcount, randomCount, walkcount, logmask: integer;
procedure LoadInfo;
begin
LogMask := BitmapFromString(19, 16, 'beNpjYCAe/AcDBnIB2XqHvUY6' +
'WPcfFRCvmCTDSXUMwyhAAwAK8ke5');
AxeMask := BitmapFromString(9, 8, 'beNpjYMAK/v//z8CAT+o/GODShV' +
'U7LllcXFyG4HEbAgAAvvom2g==');
end;
procedure FreeInfo;
begin
FreeBitmap(LogMask);
FreeBitmap(AxeMask);
end;
procedure Loc(where: string);
begin
Players[CurrentPlayer].Loc:= where;
end;
procedure DoChats;
begin
if (not(LoggedIn)) then
Exit;
SetChat('on', 1);
SetChat('friends', 2);
SetChat('on', 3);
SetChat('on', 4);
end;
function TimeOver(TimeBase, TimeCheck, TimeModifier: integer): boolean;
begin
result:= TimeFromMark(TimeBase) >= TimeCheck * TimeModifier;
end;
procedure getPlaceOfLetter(letter: char; var x, y: integer; var shift: boolean);
var
keyboard: array of string;
begin
keyboard := ['`1234567890-=', 'qwertyuiop[]\', 'asdfghjkl;''', 'zxcvbnm,./', ' '];
for x := 0 to length(keyboard) - 1 do
for y := 1 to length(keyboard[x]) do
if(getKeyCode(keyboard[x][y]) = getKeyCode(letter)) then
begin
//writeln(letter + ', ' + keyboard[x][y]);
if(keyboard[x][y] <> letter) then
shift := true
else
shift := false;
exit;
end;
end;
function mistake(letter: char; chance: integer; var shift: boolean): char;
var
x, y: integer;
keyboard: array of string;
begin
keyboard := ['`1234567890-=', 'qwertyuiop[]\', 'asdfghjkl;''', 'zxcvbnm,./', ' '];
if(random(chance) <> 0) then
begin
getPlaceOfLetter(letter, x, y, shift);
result := letter;
exit;
end;
getPlaceOfLetter(letter, x, y, shift);
if(random(2) = 0) then
begin
if(x = 0) then
y := y - 1;
if(random(2) = 1) then
x := x + random(2)
else
x := x - random(2)
end else
if(random(2) = 1) then
y := y + random(2)
else
y := y - random(2)
if(x < 0) then
x := 0;
if(x > length(keyboard) - 1) then
x := length(keyboard) - 1;
if(y > length(keyboard[x])) then
y := length(keyboard[x]);
if(y < 1) then
y := 1;
result := keyboard[x][y];
end;
procedure typeMistake(s: string; chance: integer);
var
i: integer;
shift: boolean;
begin
cp:= s;
for i := 1 to length(s) do
begin
s[i] := mistake(s[i], chance, shift);
if (Shift) then
begin
KeyDown(VK_Shift);
Wait(5 + Random(20));
end;
TypeByte(GetKeyCode(s[i]));
if (Shift) then
begin
KeyUp(VK_Shift);
Wait(5 + Random(20));
end;
Wait(50 + Random(120));
end;
Wait(200 + Random(500));
TypeByte(13);
end;
procedure MyAutoTalk;
var
i, ms: integer;
begin
begin
ms:= randomrange(7, 10);
Inc(TalkCount); Inc(ReportVars[4]);
case i of
0: typeMistake('Hey', ms);
1: typeMistake('Be nice to noobs', ms);
2: typeMistake('tree chopping is fun!', ms);
3: typeMistake('i hate this skill', ms);
4: typeMistake('im not a noob', ms);
5: typeMistake('get lost noob', ms);
6: typeMistake('everyone, ramba!', ms);
7: typeMistake('dont be dumb', ms);
8: typeMistake('your a nub', ms);
9: typeMistake('wc levels?', ms);
10: typeMistake('woodcut lvls?', ms);
11: typeMistake('this is good money', ms);
12: typeMistake('dumb autoers...', ms);
13: typeMistake('noobs be gone', ms);
14: typeMistake('a random will be coming soon...', ms);
15: typeMistake('i love this game', ms);
16: typeMistake('i love noobs!', ms);
17: typeMistake('all add me', ms);
18: typeMistake('everyone dance!', ms);
19: typeMistake('stop!', ms);
end;
Writeln('Talk Count '+IntToStr(TalkCount)+' = "'+cp+'"');
end;
MarkTime(TimeMark);
end;
function FindAxe2: boolean;
var
ax, ay, i: integer;
begin
if not Loggedin then exit;
for i:= 4 to 5 do
begin
Gametab(i);
Sleep(600);
if FindBitmapMaskTolerance(AxeMask, ax, ay, 546, 203, 737, 466, 5, 5)then
begin
result:= true;
Gametab(4);
exit;
end;
end;
result:= false;
Writeln('Could not find axe!');
end;
function EXPMapWalk: boolean; forward;
function EXPMapWalk: boolean;
var
Cols: TIntegerArray;
x, y, i: integer;
begin
x:= MMCX; y:= MMCY;
if FindColorSpiral(x, y, TreeMMColor, MMX1, MMY1, MMX2, MMY2) then
if rs_OnMiniMap(x, y) then
begin
Mouse(x, y , 0, 0, true);
FFlag(0);
result:= true;
Inc(ReportVars[3]);
Inc(WalkCount);
exit;
end;
Cols:= rs_FindMMColors(TreeMMColor);
for i:= 0 to length(Cols) - 1 do
if FindColorSpiral(x, y, Cols[i], MMX1, MMY1, MMX2, MMY2) then
if rs_OnMiniMap(x, y) then
begin
MFNF(x, y, 0, 0);
FFlag(0);
result:= true;
Inc(ReportVars[3]);
Inc(WalkCount);
break;
end;
end;
function FindFastRandoms: boolean;
var
I, mk, lx, ly: integer;
begin
result:= false;
GetMousePos(lx, ly);
Inc(ARCount);
MarkTime(MK);
for i:= 0 to 8 do
begin
case I of
0: if not FindAxe2 then result:= true;
1: if (Floor(TimeFromMark(CKCount) div 60000) >= 10)then
GetAllLevels;
3, 4: if FindFight then
begin
RunTo(RunDir, RunFar);
FTWait(15000);
RunBack;
if RunFar then RunBack;
if UseMapWalk then EXPMapwalk;
end;
5: if FindInventoryRandoms then result:= true;
7: if TimeOver(TimeMark, TalkEvery, 60000)then
MyAutoTalk;
8: if InvFull then result:= true;
9: if FindEnt(lx, ly, true)then result:= true;
end;
if result then
begin
Inc(RandomCount);
break;
end;
end;
Writeln('FindFastRandoms took '+IntToStr(TimeFromMark(MK))+' msec.');
end;
Procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:= 0;
Players[0].Name := ''; //UserName
Players[0].Pass := ''; //Password
Players[0].Nick := ''; //2-4 letters of username
Players[0].Integers[1] := 10; //Number of loads before switching
Players[0].Booleans[1] := True; //Is the axe wielded?
Players[0].Active := True; //Active
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
end;
procedure GoToNextPlayer(IsPlayerActive: boolean);
var
i: integer;
begin
NextPlayerOrder(IsPlayerActive);
Loc('Chopping');
if not loggedin then LoginPlayer;
SetBar('brightness', 4);
SetRun(False);
if not FindAxe2 then
begin
Loc('Player has no axe');
GoToNextPlayer(false);
end;
GetAllLevels;
for i:= 0 to 2 do
ArrangeInv;
end;
procedure StartUpScript;
var
I: integer;
begin
SetupSRL;
ClearDebug;
SetupSRL; LoadInfo; DeclarePlayers;
if not FindRS then
begin
writeln('Could not find Runescape');
TerminateScript;
end else
begin
ActivateClient;
wait(1000);
end;
MarkTime(TimeMark); MarkTime(CKCount);
if not LoggedIn then LoginPlayer;
Loc('Chopping');
if not loggedin then LoginPlayer;
SetBar('brightness', 4);
SetRun(False);
if not FindAxe2 then
begin
Loc('Player has no axe');
GoToNextPlayer(false);
end;
findfastrandoms;
GetAllLevels;
for i:= 0 to 2 do
ArrangeInv;
end;
procedure BankIt;
var
TotalWillows, willow, banked, Tries: Integer;
begin
if (not(LoggedIn)) then
Exit;
repeat
MakeCompass('N');
HighestAngle;
OpenBankQuiet('db');
Findfastrandoms;
Flag;
Wait(500 + random(500));
FixBank;
Tries := Tries + 1;
if (Tries = 25) then
begin
NextPlayer(False);
Exit;
end;
until (BankScreen)
begin
DepositAll;
CloseBank;
MakeCompass('N');
TotalWillows:= TotalWillows + Willow;
Banked := Banked + 1
Writeln('Chopped:' + IntToStr(TotalWillows) + ' Logs');
Writeln('Banked: ' + IntToStr(Banked) + ' Loads Of Willows');
end;
end;
procedure Walk;
var
x, y: Integer;
begin
MakeCompass('N');
HighestAngle;
if(Findcolor(x,y,16744728,546,93,640,163)) then
begin
Mouse(x,y,1,1,true)
findfastrandoms;
flag;
MakeCompass('N');
HighestAngle;
if(Findcolor(x,y,3040089,8,8,512,334)) then
repeat
Findcolor(x,y,3040089,8,8,512,334)
Mouse(x,y,1,1,true)
findfastrandoms;
flag;
wait(3000+random(1000));
until(InvFull);
end else
Writeln('Tree lost');
Findcolor(x,y,3040089,8,8,512,334)
wait (3000+random(1000))
Mouse(x,y,1,1,true)
findfastrandoms;
flag;
MakeCompass('N');
HighestAngle;
if(Findcolor(x,y,5812924,551,4,734,164)) then
begin
Mouse(x,y,1,1,true)
findfastrandoms;
flag;
end;
end;
begin
StartUpScript;
FreeInfo;
Cleardebug;
activateclient;
dochats;
repeat
Walk;
bankit;
until (not LoggedIn)
end.
[Runtime Error] : Exception: Access violation at address 00721CA1 in module 'scar.exe'. Read of address 00000034 in line 176 in script C:\Users\Laurens\Desktop\Scar Scripts\Autocutter and banker by Extracht!.scar
what to do to fix it?? :(
EDIT: I changed my code! still getting the same error.. but now with something else..
This is the code Im using:
program Walker;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/Woodcutting.Scar}
const
RunDir = 'N'; //Direction to run: 'N','S','E','W'
RunFar = False; // Set true to run far
UseMapWalk = True; //Try Expermental Map Walk.
TreeMMColor = 864078; //Experemental Mapwalking
TalkEvery = 25; // Talk Every in minutes. Random 10 added.
var
cp: string;
ARCount, axemask, CKCount, timemark, talkcount, randomCount, walkcount, logmask: integer;
procedure LoadInfo;
begin
LogMask := BitmapFromString(19, 16, 'beNpjYCAe/AcDBnIB2XqHvUY6' +
'WPcfFRCvmCTDSXUMwyhAAwAK8ke5');
AxeMask := BitmapFromString(9, 8, 'beNpjYMAK/v//z8CAT+o/GODShV' +
'U7LllcXFyG4HEbAgAAvvom2g==');
end;
procedure FreeInfo;
begin
FreeBitmap(LogMask);
FreeBitmap(AxeMask);
end;
procedure Loc(where: string);
begin
Players[CurrentPlayer].Loc:= where;
end;
procedure DoChats;
begin
if (not(LoggedIn)) then
Exit;
SetChat('on', 1);
SetChat('friends', 2);
SetChat('on', 3);
SetChat('on', 4);
end;
function TimeOver(TimeBase, TimeCheck, TimeModifier: integer): boolean;
begin
result:= TimeFromMark(TimeBase) >= TimeCheck * TimeModifier;
end;
procedure getPlaceOfLetter(letter: char; var x, y: integer; var shift: boolean);
var
keyboard: array of string;
begin
keyboard := ['`1234567890-=', 'qwertyuiop[]\', 'asdfghjkl;''', 'zxcvbnm,./', ' '];
for x := 0 to length(keyboard) - 1 do
for y := 1 to length(keyboard[x]) do
if(getKeyCode(keyboard[x][y]) = getKeyCode(letter)) then
begin
//writeln(letter + ', ' + keyboard[x][y]);
if(keyboard[x][y] <> letter) then
shift := true
else
shift := false;
exit;
end;
end;
function mistake(letter: char; chance: integer; var shift: boolean): char;
var
x, y: integer;
keyboard: array of string;
begin
keyboard := ['`1234567890-=', 'qwertyuiop[]\', 'asdfghjkl;''', 'zxcvbnm,./', ' '];
if(random(chance) <> 0) then
begin
getPlaceOfLetter(letter, x, y, shift);
result := letter;
exit;
end;
getPlaceOfLetter(letter, x, y, shift);
if(random(2) = 0) then
begin
if(x = 0) then
y := y - 1;
if(random(2) = 1) then
x := x + random(2)
else
x := x - random(2)
end else
if(random(2) = 1) then
y := y + random(2)
else
y := y - random(2)
if(x < 0) then
x := 0;
if(x > length(keyboard) - 1) then
x := length(keyboard) - 1;
if(y > length(keyboard[x])) then
y := length(keyboard[x]);
if(y < 1) then
y := 1;
result := keyboard[x][y];
end;
procedure typeMistake(s: string; chance: integer);
var
i: integer;
shift: boolean;
begin
cp:= s;
for i := 1 to length(s) do
begin
s[i] := mistake(s[i], chance, shift);
if (Shift) then
begin
KeyDown(VK_Shift);
Wait(5 + Random(20));
end;
TypeByte(GetKeyCode(s[i]));
if (Shift) then
begin
KeyUp(VK_Shift);
Wait(5 + Random(20));
end;
Wait(50 + Random(120));
end;
Wait(200 + Random(500));
TypeByte(13);
end;
procedure MyAutoTalk;
var
i, ms: integer;
begin
begin
ms:= randomrange(7, 10);
Inc(TalkCount); Inc(ReportVars[4]);
case i of
0: typeMistake('Hey', ms);
1: typeMistake('Be nice to noobs', ms);
2: typeMistake('tree chopping is fun!', ms);
3: typeMistake('i hate this skill', ms);
4: typeMistake('im not a noob', ms);
5: typeMistake('get lost noob', ms);
6: typeMistake('everyone, ramba!', ms);
7: typeMistake('dont be dumb', ms);
8: typeMistake('your a nub', ms);
9: typeMistake('wc levels?', ms);
10: typeMistake('woodcut lvls?', ms);
11: typeMistake('this is good money', ms);
12: typeMistake('dumb autoers...', ms);
13: typeMistake('noobs be gone', ms);
14: typeMistake('a random will be coming soon...', ms);
15: typeMistake('i love this game', ms);
16: typeMistake('i love noobs!', ms);
17: typeMistake('all add me', ms);
18: typeMistake('everyone dance!', ms);
19: typeMistake('stop!', ms);
end;
Writeln('Talk Count '+IntToStr(TalkCount)+' = "'+cp+'"');
end;
MarkTime(TimeMark);
end;
function FindAxe2: boolean;
var
ax, ay, i: integer;
begin
if not Loggedin then exit;
for i:= 4 to 5 do
begin
Gametab(i);
Sleep(600);
if FindBitmapMaskTolerance(AxeMask, ax, ay, 546, 203, 737, 466, 5, 5)then
begin
result:= true;
Gametab(4);
exit;
end;
end;
result:= false;
Writeln('Could not find axe!');
end;
function EXPMapWalk: boolean; forward;
function EXPMapWalk: boolean;
var
Cols: TIntegerArray;
x, y, i: integer;
begin
x:= MMCX; y:= MMCY;
if FindColorSpiral(x, y, TreeMMColor, MMX1, MMY1, MMX2, MMY2) then
if rs_OnMiniMap(x, y) then
begin
Mouse(x, y , 0, 0, true);
FFlag(0);
result:= true;
Inc(ReportVars[3]);
Inc(WalkCount);
exit;
end;
Cols:= rs_FindMMColors(TreeMMColor);
for i:= 0 to length(Cols) - 1 do
if FindColorSpiral(x, y, Cols[i], MMX1, MMY1, MMX2, MMY2) then
if rs_OnMiniMap(x, y) then
begin
MFNF(x, y, 0, 0);
FFlag(0);
result:= true;
Inc(ReportVars[3]);
Inc(WalkCount);
break;
end;
end;
function FindFastRandoms: boolean;
var
I, mk, lx, ly: integer;
begin
result:= false;
GetMousePos(lx, ly);
Inc(ARCount);
MarkTime(MK);
for i:= 0 to 8 do
begin
case I of
0: if not FindAxe2 then result:= true;
1: if (Floor(TimeFromMark(CKCount) div 60000) >= 10)then
GetAllLevels;
3, 4: if FindFight then
begin
RunTo(RunDir, RunFar);
FTWait(15000);
RunBack;
if RunFar then RunBack;
if UseMapWalk then EXPMapwalk;
end;
5: if FindInventoryRandoms then result:= true;
7: if TimeOver(TimeMark, TalkEvery, 60000)then
MyAutoTalk;
8: if InvFull then result:= true;
9: if FindEnt(lx, ly, true)then result:= true;
end;
if result then
begin
Inc(RandomCount);
break;
end;
end;
Writeln('FindFastRandoms took '+IntToStr(TimeFromMark(MK))+' msec.');
end;
Procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer:= 0;
Players[0].Name := ''; //UserName
Players[0].Pass := ''; //Password
Players[0].Nick := ''; //2-4 letters of username
Players[0].Integers[1] := 10; //Number of loads before switching
Players[0].Booleans[1] := True; //Is the axe wielded?
Players[0].Active := True; //Active
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
end;
procedure GoToNextPlayer(IsPlayerActive: boolean);
var
i: integer;
begin
NextPlayerOrder(IsPlayerActive);
Loc('Chopping');
if not loggedin then LoginPlayer;
SetBar('brightness', 4);
SetRun(False);
if not FindAxe2 then
begin
Loc('Player has no axe');
GoToNextPlayer(false);
end;
GetAllLevels;
for i:= 0 to 2 do
ArrangeInv;
end;
procedure StartUpScript;
var
I: integer;
begin
SetupSRL;
ClearDebug;
SetupSRL; LoadInfo; DeclarePlayers;
if not FindRS then
begin
writeln('Could not find Runescape');
TerminateScript;
end else
begin
ActivateClient;
wait(1000);
end;
MarkTime(TimeMark); MarkTime(CKCount);
if not LoggedIn then LoginPlayer;
Loc('Chopping');
if not loggedin then LoginPlayer;
SetBar('brightness', 4);
SetRun(False);
if not FindAxe2 then
begin
Loc('Player has no axe');
GoToNextPlayer(false);
end;
findfastrandoms;
GetAllLevels;
for i:= 0 to 2 do
ArrangeInv;
end;
procedure BankIt;
var
TotalWillows, willow, banked, Tries: Integer;
begin
if (not(LoggedIn)) then
Exit;
repeat
MakeCompass('N');
HighestAngle;
OpenBankQuiet('db');
Findfastrandoms;
Flag;
Wait(500 + random(500));
FixBank;
Tries := Tries + 1;
if (Tries = 25) then
begin
NextPlayer(False);
Exit;
end;
until (BankScreen)
begin
DepositAll;
CloseBank;
MakeCompass('N');
TotalWillows:= TotalWillows + Willow;
Banked := Banked + 1
Writeln('Chopped:' + IntToStr(TotalWillows) + ' Logs');
Writeln('Banked: ' + IntToStr(Banked) + ' Loads Of Willows');
end;
end;
procedure Walk;
var
x, y: Integer;
begin
MakeCompass('N');
HighestAngle;
if(Findcolor(x,y,16744728,546,93,640,163)) then
begin
Mouse(x,y,1,1,true)
findfastrandoms;
flag;
MakeCompass('N');
HighestAngle;
if(Findcolor(x,y,3040089,8,8,512,334)) then
repeat
Findcolor(x,y,3040089,8,8,512,334)
Mouse(x,y,1,1,true)
findfastrandoms;
flag;
wait(3000+random(1000));
until(InvFull);
end else
Writeln('Tree lost');
Findcolor(x,y,3040089,8,8,512,334)
wait (3000+random(1000))
Mouse(x,y,1,1,true)
findfastrandoms;
flag;
MakeCompass('N');
HighestAngle;
if(Findcolor(x,y,5812924,551,4,734,164)) then
begin
Mouse(x,y,1,1,true)
findfastrandoms;
flag;
end;
end;
begin
StartUpScript;
FreeInfo;
Cleardebug;
activateclient;
dochats;
repeat
Walk;
bankit;
until (not LoggedIn)
end.