SRL Archive - OSR Help

Access violation


rj

2013-09-29 09:13:58

For some reason I am getting a access violation error here:


type SS_tabs = record
LowerTabs, UpperTabs:TBoxArray;
end;

procedure SS_tabs.setUp();
var
lowerBounds, upperBounds:Tbox;
begin
lowerBounds := IntToBox(524, 467, 760, 503);
upperBounds := IntToBox(524, 169, 760, 204);
self.LowerTabs := ExplodeBox(lowerBounds, 1, 7);
self.UpperTabs := ExplodeBox(upperBounds, 1, 7);
end;


At this line:

  self.LowerTabs := ExplodeBox(lowerBounds, 1, 7);

Le Jingle

2013-09-29 15:40:36

I do not know what your explode box function is / does, but if it is of, "TBoxArray.ExplodeBox(someTBA: TBoxArray; w, h: Integer)" then you do not assign with ":=", and instead use "."

rj

2013-09-29 15:56:39

From: Le Jingle
I do not know what your explode box function is / does, but if it is of, "TBoxArray.ExplodeBox(someTBA: TBoxArray; w, h: Integer)" then you do not assign with ":=", and instead use "."


I don't understand

JennyCocoX

2013-09-29 17:32:15

From: Officer Barbrady
I don't understand


You have to use a . instead of a := and try see if it works when you assign the values!

rj

2013-09-29 17:34:47

From: JennyCocoX
You have to use a . instead of a := and try see if it works when you assign the values!


Ok so your logic is

self.LowerTabs . ExplodeBox(lowerBounds, 1, 7);

JennyCocoX

2013-09-29 17:37:01

From: Officer Barbrady
Ok so your logic is

self.LowerTabs . ExplodeBox(lowerBounds, 1, 7);


Noooo hmm hard to explain this okay I can team viewer you but we also
have to do a webcam session first (5-15 minutes) so I know you are genuinely a nice person
and don't want to scam me or something or do something to my PC.

Thanks,
Jenny

rj

2013-09-29 17:38:51

From: JennyCocoX
Noooo hmm hard to explain this okay I can team viewer you but we also
have to do a webcam session first (5-15 minutes) so I know you are genuinely a nice person
and don't want to scam me or something or do something to my PC.

Thanks,
Jenny

No. Don't post on this thread again.

JennyCocoX

2013-09-29 17:40:47

From: Officer Barbrady
No. Don't post on this thread again.


Are you sure? My help is fast and easy.
I would be happy to explain the script to you over voicechat and videochat.
I really enjoy helping people finish off over webcam.

Best,
Jenny

NKN

2013-09-29 17:45:57

From: JennyCocoX
Are you sure? My help is fast and easy.
I would be happy to explain the script to you over voicechat and videochat.
I really enjoy helping people finish off over webcam.

Best,
Jenny


Please stop with the sexual comments. Young people view this site and we don't want to expose them to this.

Brandon

2013-09-29 17:53:49

From: NKN
Please stop with the sexual comments. Young people view this site and we don't want to expose them to this.


Cuz NKN is young you know.. ;) He/She's been posting like this for a while now. Just report the post for now. Taken care of. Seems like spambot but has a couple "legit" posts.



Uhh @OP, you can't just post a small snippet and expect anyone to figure out what is wrong. Post any functions relating to those that are called.

rj

2013-09-29 17:55:32

From: Brandon
Cuz NKN is young you know.. ;)

Uhh @OP, you can't just post a small snippet and expect anyone to figure out what is wrong. Post any functions relating to those that are called.


Here is the explode box:

function ExplodeBox(bx: TBox; rows, columns: integer): TBoxArray;
var
r, c, w, h, ew, eh, ow, oh, i, x, y: integer;
begin
if ((rows > 0) and (columns > 0) and (bx.X1 <= bx.X2) and (bx.Y1 <= bx.Y2)) then
begin
w := ((bx.X2 - bx.X1) + 1);
h := ((bx.Y2 - bx.Y1) + 1);
if (rows < 1) then
rows := 1
else
if (rows > h) then
rows := h;
if (columns < 1) then
columns := 1
else
if (columns > w) then
columns := w;
w := (w div columns);
h := (h div rows);
ew := (((bx.X2 - bx.X1) + 1) - (w * columns));
eh := (((bx.Y2 - bx.Y1) + 1) - (h * rows));
SetLength(Result, (rows * columns));
y := bx.Y1;
for r := 0 to (rows - 1) do
begin
x := bx.X1;
if ((eh > 0) and (r < eh)) then
oh := 1
else
oh := 0;
for c := 0 to (columns - 1) do
begin
if ((ew > 0) and (c < ew)) then
ow := 1
else
ow := 0;
i := ((r * columns) + c);
Result[i].X1 := x;
Result[i].X2 := (x + (w - 1) + ow);
Result[i].Y1 := y;
Result[i].Y2 := (y + (h - 1) + oh);
x := (Result[i].X2 + 1);
end;
y := (Result[i].Y2 + 1);
end;
end else
SetLength(Result, 0);
end;

Brandon

2013-09-29 18:05:19

From: Officer Barbrady
Here is the explode box.. [LongCode Here]..


Could have added that to the OP. Anyway, it seems to work just fine. I just tried it multiple times.. No access violation. Must be somewhere else in your other code lines.

Run this in a new Simba tab (make sure interpreter is set to Lape):


function ExplodeBox(bx: TBox; rows, columns: integer): TBoxArray;
var
r, c, w, h, ew, eh, ow, oh, i, x, y: integer;
begin
if ((rows > 0) and (columns > 0) and (bx.X1 <= bx.X2) and (bx.Y1 <= bx.Y2)) then
begin
w := ((bx.X2 - bx.X1) + 1);
h := ((bx.Y2 - bx.Y1) + 1);
if (rows < 1) then
rows := 1
else
if (rows > h) then
rows := h;
if (columns < 1) then
columns := 1
else
if (columns > w) then
columns := w;
w := (w div columns);
h := (h div rows);
ew := (((bx.X2 - bx.X1) + 1) - (w * columns));
eh := (((bx.Y2 - bx.Y1) + 1) - (h * rows));
SetLength(Result, (rows * columns));
y := bx.Y1;
for r := 0 to (rows - 1) do
begin
x := bx.X1;
if ((eh > 0) and (r < eh)) then
oh := 1
else
oh := 0;
for c := 0 to (columns - 1) do
begin
if ((ew > 0) and (c < ew)) then
ow := 1
else
ow := 0;
i := ((r * columns) + c);
Result[i].X1 := x;
Result[i].X2 := (x + (w - 1) + ow);
Result[i].Y1 := y;
Result[i].Y2 := (y + (h - 1) + oh);
x := (Result[i].X2 + 1);
end;
y := (Result[i].Y2 + 1);
end;
end else
SetLength(Result, 0);
end;

type SS_tabs = record
LowerTabs, UpperTabs:TBoxArray;
end;

procedure SS_tabs.setUp();
var
lowerBounds, upperBounds:Tbox;
begin
lowerBounds := IntToBox(524, 467, 760, 503);
upperBounds := IntToBox(524, 169, 760, 204);
self.LowerTabs := ExplodeBox(lowerBounds, 1, 7);
self.UpperTabs := ExplodeBox(upperBounds, 1, 7);
end;

var
S: SS_tabs;
begin
S.setup();
writeln(S);
end.

rj

2013-09-29 18:10:20

From: Brandon
Could have added that to the OP. Anyway, it seems to work just fine. I just tried it multiple times.. No access violation. Must be somewhere else in your other code lines.

Run this in a new Simba tab (make sure interpreter is set to Lape):


function ExplodeBox(bx: TBox; rows, columns: integer): TBoxArray;
var
r, c, w, h, ew, eh, ow, oh, i, x, y: integer;
begin
if ((rows > 0) and (columns > 0) and (bx.X1 <= bx.X2) and (bx.Y1 <= bx.Y2)) then
begin
w := ((bx.X2 - bx.X1) + 1);
h := ((bx.Y2 - bx.Y1) + 1);
if (rows < 1) then
rows := 1
else
if (rows > h) then
rows := h;
if (columns < 1) then
columns := 1
else
if (columns > w) then
columns := w;
w := (w div columns);
h := (h div rows);
ew := (((bx.X2 - bx.X1) + 1) - (w * columns));
eh := (((bx.Y2 - bx.Y1) + 1) - (h * rows));
SetLength(Result, (rows * columns));
y := bx.Y1;
for r := 0 to (rows - 1) do
begin
x := bx.X1;
if ((eh > 0) and (r < eh)) then
oh := 1
else
oh := 0;
for c := 0 to (columns - 1) do
begin
if ((ew > 0) and (c < ew)) then
ow := 1
else
ow := 0;
i := ((r * columns) + c);
Result[i].X1 := x;
Result[i].X2 := (x + (w - 1) + ow);
Result[i].Y1 := y;
Result[i].Y2 := (y + (h - 1) + oh);
x := (Result[i].X2 + 1);
end;
y := (Result[i].Y2 + 1);
end;
end else
SetLength(Result, 0);
end;

type SS_tabs = record
LowerTabs, UpperTabs:TBoxArray;
end;

procedure SS_tabs.setUp();
var
lowerBounds, upperBounds:Tbox;
begin
lowerBounds := IntToBox(524, 467, 760, 503);
upperBounds := IntToBox(524, 169, 760, 204);
self.LowerTabs := ExplodeBox(lowerBounds, 1, 7);
self.UpperTabs := ExplodeBox(upperBounds, 1, 7);
end;

var
S: SS_tabs;
begin
S.setup();
writeln(S);
end.


Ok thanks worked, I have overhauled the include and will add this later

riwu

2013-09-30 06:27:02

From: Officer Barbrady
Ok thanks worked, I have overhauled the include and will add this later

So…what was the problem?

rj

2013-09-30 15:00:03

From: riwu
So…what was the problem?


no idea decided to make the include a different way