Writing an SRL Member Application | [Updated] Pascal Scripting Statements
My GitHub
Progress Report:13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you have serious physchological problems 13:46 <@BenLand100> HE GETS IT! 13:46 <@BenLand100> HE FINALLY GETS IT!!!!1
Yes, I got it. I was thinking of something else at that time.
This is what I got, but its more less the same. I was thinking of maybe even making a pre-TPA gathering all the valid TBox points and if then for the filter at the end, but thats more time consuming :/
pascal Code:function ReturnPointsNotInTPA(const TotalTPA: TPointArray; Box: TBox): TPointArray;
var
I, II, R, L, W, H: Integer;
B: array of array of Boolean;
begin
W := iAbs(Box.x2 - Box.x1);
H := iAbs(Box.y2 - Box.y1);
if (W = 0) or (H = 0) then
begin
SetLength(Result, 1);
Result[0].x := -1;
Result[0].y := -1;
Exit;
end;
SetLength(B, W + 1, H + 1);
SetLength(Result, (W + 1) * (H + 1));
L := Length(TotalTPA) - 1;
// This could also be, B[][] := PointInBox(TotalTPA[I], Box);
for I := 0 to L do
if (TotalTPA[I].x >= Box.x1) and (TotalTPA[I].x <= Box.x2) and
(TotalTPA[I].y >= Box.y1) and (TotalTPA[I].y <= Box.y2) then
B[TotalTPA[I].x - Box.x1][TotalTPA[I].y - Box.y1] := True;
for I := 0 to W do
for II := 0 to H do
if not B[I][II] then
begin
Result[R].x := I + Box.x1;
Result[R].y := II + Box.y1;
R := R + 1;
end;
SetLength(B, 0, 0);
SetLength(Result, R);
end;
~NS
Remove the -x or add a check if you already set the point when counting x.
Also, see this.
EDIT: Nadeem's code should work too?
Although this is a bit over the top:
SCAR Code:if (W = 0) or (H = 0) then
begin
SetLength(Result, 1);
Result[0].x := -1;
Result[0].y := -1;
Exit;
end;
Last edited by nielsie95; 06-10-2009 at 04:39 AM.
I just redownloaded SRL and both my friend and I get [Runtime Error] : Exception: in line 584 in script C:\Program Files\SCAR 3.20\includes\SRL/SRL/Core/Text.scar
every time ChooseOption is called.
Thanks for working on this guys![]()
Originally Posted by irc
Never happened to me, never. Running Win7 with SCAR 3.20d, portable and non-portable. No problems![]()
You may contact me with any concerns you have.
Are you a victim of harassment? Please notify me or any other staff member.
| SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |
In a function i wrote that handles the gate for the cows south of falador, I use 2 things that in my mind set off the error i get.
error: Access violation at address 00529608 in module 'scar.exe'. Read of address 0000006C
I use "FindColorSpiralTolerance" and "ChooseOption".
heres the function:
SCAR Code:Function HandleGate: boolean;
var
G:TPoint;
begin
G:=Point(3032, 3313);
if not(loggedin) then exit;
MyRandoms;
if FindObjectEx(G, 7050, 5) then
begin
Writeln('Attempting to handle gate.');
if (GetMyPos.x = 3031) then
begin
if FindColorSpiralTolerance(x, y, 5401208, 257, 183, 281, 237, 4) then
begin
MMouse(x, y, 2, 2);
wait(100+Random(75));
if IsUpText('pen') then
begin
Mouse(x, y, 0, 0, false);
wait(100+Random(75));
ChooseOption('pen');
Writeln('Successfully opened gate. =D');
GatesOpened:=GatesOpened+1;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end else
begin
if FindColorSpiralTolerance(x, y, 5401208, 208, 119, 225, 225, 4) then
begin
MMouse(x, y, 2, 2);
wait(100+Random(75));
if IsUpText('pen') then
begin
Mouse(x, y, 0, 0, false);
wait(100+Random(75));
ChooseOption('pen');
Writeln('Successfully opened gate. =D');
GatesOpened:=GatesOpened+1;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end;
end else Writeln('Gate already open, walking in the cow pen now.');
end;
Can anyone help me? I think its a problem with scar, but i have no idea.
Try this my friend, I replaced the ChooseOption with a find text.
SCAR Code:Function HandleGate: boolean;
var
G:TPoint;
begin
G:=Point(3032, 3313);
if not(loggedin) then exit;
MyRandoms;
if FindObjectEx(G, 7050, 5) then
begin
Writeln('Attempting to handle gate.');
if (GetMyPos.x = 3031) then
begin
if FindColorSpiralTolerance(x, y, 5401208, 257, 183, 281, 237, 4) then
begin
MMouse(x, y, 2, 2);
wait(100+Random(75));
if IsUpText('pen') then
begin
Mouse(x, y, 0, 0, false);
wait(100+Random(75));
ChooseOption('pen');
Writeln('Successfully opened gate. =D');
GatesOpened:=GatesOpened+1;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end else
begin
if FindColorSpiralTolerance(x, y, 5401208, 208, 119, 225, 225, 4) then
begin
MMouse(x, y, 2, 2);
wait(100+Random(75));
if FindText(x, y, 'pen', UpChars, x, y, x + 100, y + 100) then
begin
Mouse(x, y, 0, 0, false);
wait(100+Random(75));
ChooseOption('pen');
Writeln('Successfully opened gate. =D');
GatesOpened:=GatesOpened+1;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end;
end else Writeln('Gate already open, walking in the cow pen now.');
end;
I'll try that, although it looks like you changed absolutely nothing. =\
maybe im blind.
EDIT: NVM, lol, i see it now. =]
i hope it works =]
EDIT again >.>: Didn't work, im still getting an access violation error. Im soooo confused. =[
Fine nielsie :P
Here:
pascal Code:function ReturnPointsNotInTPA(const TotalTPA: TPointArray; Box: TBox): TPointArray;
var
I, II, R, L, W, H: Integer;
B: array of array of Boolean;
begin
W := iAbs(Box.x2 - Box.x1);
H := iAbs(Box.y2 - Box.y1);
if (W = 0) or (H = 0) then Exit;
SetLength(B, W + 1, H + 1);
SetLength(Result, (W + 1) * (H + 1));
L := Length(TotalTPA) - 1;
for I := 0 to L do
if (TotalTPA[I].x >= Box.x1) and (TotalTPA[I].x <= Box.x2) and
(TotalTPA[I].y >= Box.y1) and (TotalTPA[I].y <= Box.y2) then
B[TotalTPA[I].x - Box.x1][TotalTPA[I].y - Box.y1] := True;
for I := 0 to W do
for II := 0 to H do
if not B[I][II] then
begin
Result[R].x := I + Box.x1;
Result[R].y := II + Box.y1;
R := R + 1;
end;
SetLength(B, 0, 0);
SetLength(Result, R);
end;
Hey, Try this:
SCAR Code:Function HandleGate: boolean;
var
G:TPoint;
V: TIntegerArray;
begin
G:=Point(3032, 3313);
if not(loggedin) then exit;
MyRandoms;
if FindObjectEx(G, 7050, 5) then
begin
Writeln('Attempting to handle gate.');
V := [257, 183, 281, 237, 4, 208, 119, 225, 225, 4];
if (GetMyPos.x = 3031) then F := 0 else F := 5;
if FindColorSpiralTolerance(x, y, 5401208, V[F], V[F+1], V[F+2], V[F+3], V[F+4]) then
begin
MMouse(x, y, 2, 2);
wait(100+Random(75));
if IsUpText('pen') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, false);
wait(100+Random(75));
ChooseOption('pen');
Writeln('Successfully opened gate. =D');
GatesOpened:=GatesOpened+1;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end else
Writeln('Gate already open, walking in the cow pen now.');
end;
I shortened up the code, and added GetMousePos(); If that doesn't work, try increasing the characters used in ChooseOption? Ex: 'pen gat', 'Open'
~NS
Last edited by Nadeem; 06-11-2009 at 02:44 AM.
get srl dev rev 32
i done it and i havent got one runtime error since
something was changed in wizzyplugin in dev rev 33
~shut
All my scripts are held on Googlecode git, so if you ever see a problem, fork it and send me a pull request
If a script is grey, it doesn't work, if it's colour then it does!
My Tutorials:-
Everything you need to know about setting up Simba, SRL and Reflection!, How to sort out the MSVCR71.dll error
How to set up players for autoing with Simba, SRL/Simba Standards (with examples), Defines
Auto Updater and Git, Using a testing branch for git, Adding SRL Stats to your script
Creating your own font set for Simba, Guide to Cups, How to make 1.45M (RSGP) a day (not really my tut)
Download a image and set it as your Desktop Wallpaper in C#, How to make your first PHP file uploader
<Coh3n> Shuttleu, fuck I love you right now
Rune Pro: Sorry my bad use this:
SCAR Code:Function HandleGate: boolean;
var
G:TPoint;
begin
G:=Point(3032, 3313);
if not(loggedin) then exit;
MyRandoms;
if FindObjectEx(G, 7050, 5) then
begin
Writeln('Attempting to handle gate.');
if (GetMyPos.x = 3031) then
begin
if FindColorSpiralTolerance(x, y, 5401208, 257, 183, 281, 237, 4) then
begin
MMouse(x, y, 2, 2);
wait(100+Random(75));
if IsUpText('pen') then
begin
Mouse(x, y, 0, 0, false);
wait(100+Random(75));
if FindText(x, y, 'pen', UpChars, x, y, x + 100, y + 100) then
Mouse(x, y, 0, 0, True);
Writeln('Successfully opened gate. =D');
GatesOpened:=GatesOpened+1;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end else
begin
if FindColorSpiralTolerance(x, y, 5401208, 208, 119, 225, 225, 4) then
begin
MMouse(x, y, 2, 2);
wait(100+Random(75));
if IsUpText('pen') Then
begin
Mouse(x, y, 0, 0, false);
wait(100+Random(75));
if FindText(x, y, 'pen', UpChars, x, y, x + 100, y + 100) then
Mouse(x, y, 0, 0, True);
Writeln('Successfully opened gate. =D');
GatesOpened:=GatesOpened+1;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end else
begin
Writeln('Failed to find gate.');
LogOut;
TerminateScript;
end;
end;
end else Writeln('Gate already open, walking in the cow pen now.');
end;
That should work![]()
The first one got this: [Error]: Access violation at address 00529608 in module 'scar.exe'. Read of address 00000280
second one: [Error]: Access violation at address 00529608 in module 'scar.exe'. Read of address 0000018C
I have no idea what could be wrong...
Hmm... Maybe try this on a different version of SCAR...? Or probably just do what Shuttleu's recommending, i.e: dl dev rev 32
~NS
Yes... The function ReturnPoints was changed.
Writing an SRL Member Application | [Updated] Pascal Scripting Statements
My GitHub
Progress Report:13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you have serious physchological problems 13:46 <@BenLand100> HE GETS IT! 13:46 <@BenLand100> HE FINALLY GETS IT!!!!1
Then maybe revert back to the previous one, or at least differentiate between what was changed to pin point error and come up with a better solution?
~NS
Here is the old plugin if any one wants.
Originally Posted by irc
nice postonly one thing, its a dll...! a .dbr or .pas would've been better/easier IMO
~NS
Here. The dll was just for people that need to use. Here is the other![]()
Originally Posted by irc
I have an idea to fix it. Give me a few.
Writing an SRL Member Application | [Updated] Pascal Scripting Statements
My GitHub
Progress Report:13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you have serious physchological problems 13:46 <@BenLand100> HE GETS IT! 13:46 <@BenLand100> HE FINALLY GETS IT!!!!1
Double posting, but does the newest one work?
Writing an SRL Member Application | [Updated] Pascal Scripting Statements
My GitHub
Progress Report:13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you have serious physchological problems 13:46 <@BenLand100> HE GETS IT! 13:46 <@BenLand100> HE FINALLY GETS IT!!!!1






What was there change? I'd like to see please
~NS
I honestly don't see the use for all those failsafes... If you just make sure you pass a correct box everything is well... I've already submitted a patch to nava which should fix the issue.
All this checking is just too much overhead IMO. If I start passing random params to Functions in SCAR it will most likely crash too. You can't add failsafes for everything...![]()
The best way to contact me is by email, which you can find on my website: http://wizzup.org
I also get email notifications of private messages, though.
Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
Documentation | Source | Simba Bug Tracker on Github and Villavu )
My (Blog | Website)
There are currently 1 users browsing this thread. (0 members and 1 guests)