SRL Archive - OSR Help

Acess violation - Error


NoUserName

2012-04-12 07:52:20

Hey,

i have used the search button for this but still with no luck in fixing so heres my post to try n find out what my problem is.

ive been just playing really getting used to the code and what not and came across the error in the pic


cant seam to find what causing this or a fix anyone know one?
its problem my coding as i am only learning atm

any help is much appreciated.



[SIMBA]
program New;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i sps/sps.simba}
Var
MyPath:TPointArray;

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

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;

procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
FindNormalRandoms;
case Random(8) of
0:
begin
HoverSkill('Woodcutting', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
FindNormalRandoms;
end;
end;
end;

procedure walkto;
begin
SPS_Areas := ['0_0','1_0'];
MyPath := [Point(243, 58), Point(243, 58), Point(258, 86), Point(258, 86),
Point(307, 99), Point(307, 99), Point(357, 111), Point(357, 111),
Point(367, 93), Point(367, 93), Point(399, 82), Point(399, 82)];
end;
procedure ChopTree;
var x, y: integer;
begin
repeat
FindNormalRandoms;
if FindObj(x, y, 'hop', 4150111, 35) then
begin
Mouse(x, y, 0, 0, false);
ChooseOption('Tree');
end;
repeat
wait(400+random(250));
AntiBan;
Until not IsUpText('ew') or (InvFull);
until(InvFull);
end;

begin

Cleardebug;
Smart_Server := 11;
Smart_Members := false;
Smart_Signed := false;
Smart_SuperDetail := false;

SetupSRL;
DeclarePlayers;
LoginPlayer;
SPS_Areas := ['10_9']
SPS_Setup(RUNESCAPE_SURFACE, SPS_Areas);
MouseSpeed := RandomRange(17, 22);

SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
SPS_WalkPath(MyPath);
ChopTree;
end.
[/SIMBA]

Tubs

Abu

2012-04-12 08:45:43

Ok first, could you please tell us which include/script the script opened when you got this error? Because there is no line 96 in your script, meaning it must have opened up a different one.

Also, is paster.sex and security.sex enabled/disabled? Have tried disabling/enabling them?

Sin

2012-04-12 10:29:34

Paster and Security don't give compiling errors..
Here's your problem -
procedure walkto;begin
SPS_Areas := ['0_0','1_0'];
MyPath := [Point(243, 58), Point(243, 58), Point(258, 86), Point(258, 86), Point(307, 99), Point(307, 99), Point(357, 111), Point(357, 111), Point(367, 93), Point(367, 93), Point(399, 82), Point(399, 82)];
end;

You're not declaring ``SPS_Areas" as a variable, and then you're calling it in your MAIN LOOP.

SPS_Setup(RUNESCAPE_SURFACE, SPS_Areas);

See what I mean?
Solution -

Declare ``SPS_Areas" as a TStringArray as a Global Variable and then it'll work.

NoUserName

2012-04-13 16:39:24

cheers for the fix still having problems though have had a look at some other scripts and this is what i have now


program New;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i sps/sps.simba}

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

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;

procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
FindNormalRandoms;
case Random(8) of
0:
begin
HoverSkill('Woodcutting', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
FindNormalRandoms;
end;
end;
end;

procedure WalkTo;
var
MyPath:TPointArray;
begin
SPS_Areas := ['10_9'];
MyPath := [Point(243, 58), Point(243, 58), Point(258, 86), Point(258, 86),
Point(307, 99), Point(307, 99), Point(357, 111), Point(357, 111),
Point(367, 93), Point(367, 93), Point(399, 82), Point(399, 82)];
SPS_WalkPath(MyPath);

end;


procedure ChopTree;
var x, y: integer;
begin
repeat
FindNormalRandoms;
if FindObj(x, y, 'hop', 4150111, 35) then
begin
Mouse(x, y, 0, 0, false);
ChooseOption('Tree');
end;
repeat
wait(400+random(250));
AntiBan;
Until not IsUpText('ew') or (InvFull);
until(InvFull);
end;

begin

Cleardebug;
Smart_Server := 11;
Smart_Members := false;
Smart_Signed := false;
Smart_SuperDetail := false;

SetupSRL;
DeclarePlayers;
LoginPlayer;
MouseSpeed := RandomRange(17, 22);

ActivateClient;
DeclarePlayers;
LoginPlayer;
WalkTo;
ChopTree;
end.

It gives out the error and opens sps file


Error: Exception: Access violation at line 305
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, 3]

could some one give me a fix? really want to try and lean something i did follow the sps tut but im a idiot and still don't get it!

Thanks for replys

Sin

2012-04-13 16:43:38

Line 305 Is?
I'm not gonna open up Simba for that xD

NoUserName

2012-04-13 16:47:17

sorry forgot to add that 305 to 324 there.


FoundMatches := SPS_FindMapInMap(P.x, P.y, SPS_AreaMaps, SmallMap, SPS_Tolerance);
Searches := ((Minimap.Width / SPS_Accuracy) * (Minimap.Height / SPS_Accuracy));
{
writeln('fx: '+toStr(p.x)+' ~ on area: '+toStr(P.X * SPS_Accuracy + (Minimap.Width / 2)));
writeln('fy: '+toStr(p.y)+' ~ on area: '+toStr(P.Y * SPS_Accuracy + (Minimap.Width / 2)));
writeln('matches: '+toStr(foundMatches));
writeln('searches: '+toStr(searches));
writeln('percent: '+toStr(FoundMatches / Searches));
}
if ((FoundMatches / Searches) > SPS_MatchesPercent) then
Result := SPS_LocalToGlobal(SPS_GetTopLeftCoords(SPS_Areas), // the top left of the total area
P.x * SPS_Accuracy + (Minimap.Width / 2),
P.y * SPS_Accuracy + (Minimap.Width / 2));

Minimap.Free;

t := (GetSystemTime - t);
if (SPS_Debug) then
Writeln('SPS_GetMyPos: Finished in '+ToStr(t)+' ms. Result = '+ToStr(Result));
end;

Sin

2012-04-13 16:49:16

Update SPS =]

Bobby Boo

2012-04-13 16:49:16

sorry to interrupt this conversation but I need help with my script



end; <---  line 54
[Error] (55:1): Identifier expected at line 54
Compiling failed.


What did I do wrong?

Bobby Boo

2012-04-13 16:51:15

Assuming you were replying to me sin, I have the latest SPS <3

NoUserName

2012-04-15 15:25:23

anyone wiling to help?

Jakkle

2012-04-15 19:54:21

From: tubs-12
anyone wiling to help?


Here have a look at what I've done. I've tried to show you how you should setup SPS. It's much easier to put new paths in.

program New;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i sps/sps.simba}


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

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;

// Your path is a TPointArray.
// The function is asking which path(Array) do you want to use.
// Example of using it: SPS_Path(WhichPath('ToBank'));
function WhichPath(Which:String): TPointArray;
begin
if (not LoggedIn) then
Exit;

FindNormalRandoms;
case Lowercase(Which) of
'ToTrees' : Result := [Point(243, 58), Point(243, 58), Point(258, 86), Point(258, 86),
Point(307, 99), Point(307, 99), Point(357, 111), Point(357, 111),
Point(367, 93), Point(367, 93), Point(399, 82), Point(399, 82)];
'ToBank' : Result := [Point(3000, 3000), Point(3000, 3000), Point(3000, 3000), Point(3000, 3000), Point(3000, 3000)];
end;
end;

procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
FindNormalRandoms;
case Random(8) of
0:
begin
HoverSkill('Woodcutting', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
FindNormalRandoms;
end;
end;
end;

// Similar to before but its a procedure which does not return anything.
// This is what you will call in your main loop to say where you want to walk to.
// Example: WalkTo('Bank');
procedure WalkTo(Where:String);
begin
if (not LoggedIn) then
Exit;

case Lowercase(Where) of
'trees' :
begin
SPS_WalkPath(WhichPath('ToTrees'));
end;
'bank' :
begin
SPS_WalkPath(WhichPath('ToBank'));
end;
end;
end;

procedure ChopTree;
var x, y: integer;
begin
repeat
FindNormalRandoms;
if FindObj(x, y, 'hop', 4150111, 35) then
begin
Mouse(x, y, 0, 0, false);
ChooseOption('Tree');
end;
repeat
wait(400+random(250));
AntiBan;
until not IsUpText('ew') or (InvFull);
until(InvFull);
end;

procedure TheMainLoop;
begin
if (not LoggedIn) then
Exit;

begin
WalkTo('Trees');
ChopTree;
end;
end;


begin

Cleardebug;
Smart_Server := 11;
Smart_Members := false;
Smart_Signed := false;
Smart_SuperDetail := false;

SetupSRL;
DeclarePlayers;
LoginPlayer;
// SPS_Areas := ['10_9','0_0','1_0'] You don't need this
SPS_Setup(RUNESCAPE_SURFACE, ['10_9','0_0','1_0']); // Put it here instead
MouseSpeed := RandomRange(17, 22);

ActivateClient;
DeclarePlayers;
LoginPlayer;
MakeCompass('N');
SetAngle(0);
TheMainLoop;
TerminateScript;
end.

You need to set the script out right and have things set into functions and procedures properly plus look up about standards.
A function returns something like 'boolean' which is true or false, you can also set what the function is outputting like is it sending and integer, string or TPoint Array in your case.
A procedure is all about do this do that and asking/using functions to find the result.
If you want to find something or click it then you want to KNOW if you have found or clicked it right ? So you make a function to see weather it return true or false.
In the procedure you want to be commanding the functions then saying what should happen if you find it/click it.
If I was you I would put finding and clicking the tree into functions and calling them in a procedure.
You also put SetUpSRL twice when it only has to be called once at the beging with all the other setups.
One more thing, your path co-ords don't look right to me. Make sure you either use the SPS get my position or 'path creator 0.9'.
This is just how I do it, there are prob easier ways but I thought I would try and help you out.

P.S never leave your username or passwords in scripts. You never know who might see ;)

Caotom

2012-04-15 20:32:42

From: Bobby Boo
sorry to interrupt this conversation but I need help with my script



end; <---  line 54
[Error] (55:1): Identifier expected at line 54
Compiling failed.


What did I do wrong?


Please do not hijack people's threads and start with your own issues if they have no relation with the OP's problem.
We would need to see more of the code in order to solve your problem (unless that is the last end in the script, in which case it needs a . not a ; )

~Caotom

~Caotom

NoUserName

2012-04-16 14:58:19

thanks for your reply
im using 'path creator 0.9' and was trying to learn from the nice little easy to get Tutorial SPS Walking Guide (The Basics) By Aligndude followed it a few time but still i dont walk can see what im doing wrong…

ive had a look but im not on my main comp so i set simba up here and i get


A new update of Simba is available!
Current version is 980. Latest version is 984
[Hint] C:\Simba\Includes\SRL/SRL/core/mapwalk.simba(1353:3): Variable 'BOX' never used at line 1352
[Error] C:\Simba\Includes\sps/sps.simba(125:3): Unknown identifier 'sortTPAByX' at line 124
Compiling failed.

not sure if its my set-up though.

From: Jakkle

P.S never leave your username or passwords in scripts. You never know who might see ;)


yea probley shouldn't i forgot it was on the image too.
removed it now thanks

tubs.