SRL Archive - Help and Support

simba crashes, invalid pointer operation


footballjds

2013-11-20 14:05:31

Hey guys.

So, working on a divination script. Well. Truth is I WAS working on it…

Now, my script crashes cause of this ugliness:


any help would be nice. that line in the include that it supposedly crashes on:

function TPointArray.cluster(const dist: integer): T2DPointArray;
begin
result := clusterTPA(self, dist);
end;

Olly

2013-11-20 14:15:39

Can you like, provide a test script so i can see if it crashes for me?

Also, does it happen not using the type function ie. atpa := clusterTPAEx(tpa, 5, 5);

footballjds

2013-11-20 14:22:51

From: Olly
Can you like, provide a test script so i can see if it crashes for me?

Also, does it happen not using the type function ie. atpa := clusterTPAEx(tpa, 5, 5);

happened again:


sure, hence the members section. test this div script IN PROGRESS.
You'll need 60+ divination and use duel ring to tele to mobilising armies. if you want to teamview or use my account let me know.
program new;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

const
wispColor = 12169852;
mmRiftColor = 2591146;
conversion = 3;//1, 2 or 3 memory conversion options

procedure declarePlayers;
begin
setLength(players, 1);
with players[0] do
begin
loginName := 'log';
bankPin := '1234';
password := 'pass';
isActive := true;
isMember := true;
world := -1;
end;
currentPlayer := 0;
end;

function riftMM2: TPoint;
var
rifty: TPointArray;
rifty2d: T2DPointArray;
begin
if not findColorsTolerance(rifty, mmRiftColor, minimap.getBounds, 11) then exit;
FilterPointsPie(rifty, 0, 360, 0, 90, minimap.getCenterPoint.x, minimap.getCenterPoint.y);
rifty2d := rifty.split(10, 10);
rifty2d.sortBySize();
writeln(rifty2d);
result := rifty2d[0].getMiddle;
end;

function findWisp: TPoint;
var
wispy: TPointArray;
wispys: T2DPointArray;
i: integer;
begin
result := [0, 0];
if not findColorsTolerance(wispy, wispColor, mainscreen.getBounds, 15) then exit;
wispys := wispy.split(10, 10);
setLength(wispy, 0);
for i := 0 to high(wispys) do
begin
if length(wispys[i]) < 10 then continue;
setLength(wispy, length(wispy)+1);
wispy[i] := wispys[i].getMiddle;
end;
wispy.sortFromPoint(mainscreen.getCenterPoint);
if length(wispy) <= 0 then exit;
result := wispy[0];
end;

function siphon: boolean;
var
wisp: TPoint;
i, threshold, speedMouse: integer;
begin
threshold := getSystemTime + randomRange(3000, 5000);
result := tabBackpack.isFull;
while (threshold > getSystemTime) and (not result) do
begin
wisp := findWisp;
if wisp.equals([0, 0]) then continue;
speedMouse := mouseSpeed;
mouseSpeed := mouseSpeed + randomRange(0, 15);
mouse(wisp, MOUSE_RIGHT, MOUSE_HUMAN);
mouseSpeed := speedMouse;
result := chooseOption.select(['Harvest '], randomRange(2500,3500));
wait(randomRange(200, 400));
end;
end;

procedure waitWhileSiphoning;
var
threshold, invCount: integer;
begin
threshold := getSystemTime + randomRange(3000,3500);
invCount := tabBackpack.count;

while threshold > getSystemTime do
begin
if tabBackpack.isFull then exit;
wait(randomRange(50, 100));
if invCount <> tabBackpack.count then
begin
threshold := getSystemTime + randomRange(3000,3500);
invCount := tabBackpack.count;
end;
end;
end;

function moveToWisps: boolean;
var
wisps: TPointArray;
riftPoint: TPoint;
begin
wisps := minimap.getDots(MM_DOT_NPC, minimap.getBounds());
if length(wisps) <= 0 then exit;
riftPoint := riftMM2;
if riftPoint.equals([0,0]) then exit;
wisps.excludePointsDist(0, 55, riftPoint.x, riftPoint.y);
result := length(wisps) > 0;
if result then mouse(wisps.getMiddle, Mouse_Left, Mouse_Human) else exit;
wait(randomRange(3000, 5000));
end;

function collectMemories: boolean;
var
threshold: integer;
begin
threshold := getSystemTime + randomRange(150000,180000);
while (threshold > getSystemTime) and (not result) do
begin
result := tabBackpack.isFull;
if siphon then waitWhileSiphoning else moveToWisps;
end;
end;

function riftMM: TPoint;
begin
result := [0, 0];
minimap.findSymbol(result, MM_SYMBOL_DIVINATION, minimap.getBounds);
end;

function riftMS: TPointArray;
var
rifty: TPointArray;
rifty2d: T2DPointArray;
check: TPoint;
i: integer;
begin
if not findColorsTolerance(rifty, 8447955, mainscreen.getBounds, 31) then exit;
rifty2d := rifty.split(10, 10);
rifty2d.sortBySize();
for i := 0 to high(rifty2d) do
begin
if length(rifty2d[i]) < 5 then continue;
check := rifty2d[i].getMiddle;
if not pointInBox(check, mainscreen.getBounds) then continue;
setLength(result, length(result)+1);
result[i] := rifty2d[i].getMiddle;
end;
end;

procedure convertOption;
begin
wait(randomRange(200, 300));
typeSend(toString(conversion), false);
end;

function wait2Convert: boolean;
var
threshold: integer;
searchArea: TBox;
whitePoints: TPointArray;
begin
searchArea := [394, 189, 562, 207];
threshold := getSystemTime + randomRange(6000, 10000);
while (threshold > getSystemTime) and (not result) do
begin
findColors(whitePoints, 12378347, searchArea);
result := inRange(length(whitePoints), 545, 555);
wait(randomRange(100, 200));
end;
end;

function convertMemories: boolean;
var
MM_rift: TPoint;
i: integer;
begin
if distance(riftMM2, minimap.getCenterPoint) > 3 then
begin
MM_rift := riftMM2;
if MM_rift.equals([0, 0]) then exit;
mouse(MM_rift, Mouse_Left, Mouse_Human);
wait(randomRange(6000,10000));
end;
for i := 0 to high(riftMS) do
begin
mouse(riftMS[i], Mouse_right, Mouse_Human);
result := chooseOption.select(['Convert memories', 'memories En'], randomRange(3500,4500));
if result then break;
end;
if not result then exit;
if wait2Convert then convertOption;
end;

procedure waitWhileConverting;
var
threshold, invCount: integer;
begin
threshold := getSystemTime + randomRange(3000,3500);
invCount := tabBackpack.count;
while threshold > getSystemTime do
begin
wait(randomRange(50, 100));
if invCount <> tabBackpack.count then
begin
threshold := getSystemTime + randomRange(3000,3500);
invCount := tabBackpack.count;
end;
end;
end;

procedure mainLoop;
begin
if not collectMemories then exit;
if not convertMemories then exit else waitWhileConverting;
end;

begin
setupSRL;
declarePlayers;
while true do mainLoop;
if collectMemories then convertMemories;
end.

Kasi

2013-11-20 17:50:51

just a suggestion, why do you need that integer to be a constant? are you sure self is constant?

footballjds

2013-11-20 18:06:30

From: Kasi
just a suggestion, why do you need that integer to be a constant? are you sure self is constant?


I'm sure i dont know what you're asking

Kasi

2013-11-20 18:36:24

From: footballjds
I'm sure i dont know what you're asking


Nevermind, didn't see that it was added to the include, i'm not getting any errors though

Olly

2013-11-20 19:06:43

I think i fixed it, it was somewhere else in the script with setting an array such. IIRC pascalscript checks the length of your array and Lape doesn't so simba will just crash could be wrong tho!

footballjds

2013-11-21 10:34:10

From: Olly
I think i fixed it, it was somewhere else in the script with setting an array such. IIRC pascalscript checks the length of your array and Lape doesn't so simba will just crash could be wrong tho!


so you're done on my account? :)