SRL Archive - Jr. Member General Help and Discussion

Need Help Guise


Lipcot

2014-08-30 00:39:15

So.. its been a long day and its 1:36 am, im really tired and was trying to finish my script.. but yeah, problems :duh:

Can you see ANYTHING wrong on those 2? because i cant.. (but my eyes are closing so..) The debug says nothing and just repeats:

'=*Loot Available: Looting*='
'=*Doing Fine*='

But doesent loot anything :( . I suppose its a problem with something outside these procedures? if you believe it is, ill post full script, but didnt want to bother you !

If you have read, thanks!



function LootAvailable(): boolean;
var
x2, y2, i2: integer;
TPA2: TPointArray;
begin
if findColorsSpiralTolerance(x2, y2, TPA2, 2697773, mainScreen.getBounds(), 2, colorSetting(2, 2.09, 0.24)) then
begin
result := True;
writeLn('=*Loot Available: Looting*=');
end else
begin
result:= false;
writeLn('=*Loot Not Available*=');
end;
end;


procedure findLoot();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
LootTimer: TTimeMarker;

begin
if not isLoggedIn() then
exit;

repeat
if lootavailable() then
begin
findColorsSpiralTolerance(x, y, TPA, 2697773, mainScreen.getBounds(), 2, colorSetting(2, 2.09, 0.24));
writeLn('=*Doing Fine*=');

// tar1 := getItemAmount(tabBackpack.getSlotBox(1));

if (Length(TPA) < 1) then
exit;

mouseSpeed := 20 + random(15);
ATPA := TPA.cluster(20);
ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['Take', 'ake'], 100) then
begin
fastClick(MOUSE_RIGHT);
wait(randomRange(100, 500));
chooseOption.select(['Swamp','Tar','wamp']);
wait(randomRange(800, 1200));
smartImage.clear();
break;
end;

end;
//
// Tar2 := getItemAmount(tabBackpack.getSlotBox(1));
// TarTotal := (Tar1-Tar2);
end;
until not LootAvailable(); //or (LootTimer.getTime() > 10000);

end;

riwu

2014-08-30 01:14:29

smartImage.debugATPA(ATPA);
did it debug anything? did your mouse hover over the loot?
try add a writeln(atpa); after ^ line

The Mayor

2014-08-30 06:59:26

From: undorak7
snip


Yes, like riwu said, any smart debug appear?

If no debug image appears then I've got a feeling I know what it is:


findColorsSpiralTolerance(x, y, TPA, 2697773, mainScreen.getBounds(), 2, colorSetting(2, 2.09, 0.24));
writeLn('=*Doing Fine*=');

findColors returns no matches, but you still print "doing fine", but then you exit as length(TPA) is less than 1. Maybe do something like this to test:


if findColorsSpiralTolerance(x, y, TPA, 2697773, mainScreen.getBounds(), 2, colorSetting(2, 2.09, 0.24)) then
writeLn('Found colour')
else
writeLn('Didn''t find tar colour');

Also, no need to cluster to an ATPA and then split:


ATPA := TPA.cluster(20);
ATPA := TPA.toATPA(30, 30);

that just makes the cluster redundant.

Lipcot

2014-08-30 11:24:16

From: riwu
smartImage.debugATPA(ATPA);
did it debug anything? did your mouse hover over the loot?
try add a writeln(atpa); after ^ line


the mouse does NOTHING, and nothing comes in the debug, thats why i dont understand whats going on!

ill do this now and see what happens

From: The Mayor
Yes, like riwu said, any smart debug appear?

If no debug image appears then I've got a feeling I know what it is:


findColorsSpiralTolerance(x, y, TPA, 2697773, mainScreen.getBounds(), 2, colorSetting(2, 2.09, 0.24));
writeLn('=*Doing Fine*=');

findColors returns no matches, but you still print "doing fine", but then you exit as length(TPA) is less than 1. Maybe do something like this to test:


if findColorsSpiralTolerance(x, y, TPA, 2697773, mainScreen.getBounds(), 2, colorSetting(2, 2.09, 0.24)) then
writeLn('Found colour')
else
writeLn('Didn''t find tar colour');

Also, no need to cluster to an ATPA and then split:


ATPA := TPA.cluster(20);
ATPA := TPA.toATPA(30, 30);

that just makes the cluster redundant.


Yeah, i dont know how the cluster got there, i have it in another script eheh, seems i copy pasted the ATPA part and that slipped in.

Ill do this now and check what happens, but i was sure it was finding to colours because the function i use looks for the SAME colours and returns positive, soo… dunno. Will edit with results

got this (mouse is still doing NOTHING):
=*Loot Available: Looting*=
Found colour
[]

after adding


if findColorsSpiralTolerance(x, y, TPA, 2697773, mainScreen.getBounds(), 2, colorSetting(2, 2.09, 0.24)) then
writeLn('Found colour')
else
writeLn('Didn''t find tar colour');

and writeln(atpa);

Could this be a settings problem? i mean.. i have them all correct and run many other scripts all the time but who knows.. I have an attack procedure similar to the Loot one and works perfectly :(

riwu

2014-08-30 12:00:25

That debug result means that there was 1 or more color matches but after grouping and filtering via ATPA.filterBetween(0, 10); they were all gone (all tpas in atpa have length 10 or less)

try using CTS 2 for better color finding accuracy.

Lipcot

2014-08-30 12:26:30

From: riwu
That debug result means that there was 1 or more color matches but after grouping and filtering via ATPA.filterBetween(0, 10); they were all gone (all tpas in atpa have length 10 or less)

try using CTS 2 for better color finding accuracy.


well thank you guys, now i´ve got a better understanding of ATPAs and TPAs , i´ve got it to work, it was what you said riwu. alThough i was using CTS 2 and the two procedures had the same colour, when transferring it to ATPA and filtering it, none was left, so now i´ve improved the colour and its working better, still need to make it more eficient but its cool! thanks alot mayor and riwu!

I just have one question left, how could i do to: If ATPA(empty) then exit; ? (i´ve looked at the TPA include but cant find a way to do this)

The Mayor

2014-08-30 17:34:17

From: undorak7
well thank you guys, now i´ve got a better understanding of ATPAs and TPAs , i´ve got it to work, it was what you said riwu. alThough i was using CTS 2 and the two procedures had the same colour, when transferring it to ATPA and filtering it, none was left, so now i´ve improved the colour and its working better, still need to make it more eficient but its cool! thanks alot mayor and riwu!

I just have one question left, how could i do to: If ATPA(empty) then exit; ? (i´ve looked at the TPA include but cant find a way to do this)


You've probably seen it all the time in scripts but just didn't know what it was for:


if length(TPA) < 1 then
exit;

and after you split/filter it, it might be wise to do the same with the ATPA


if length(ATPA) < 1 then
exit;

Lipcot

2014-08-31 00:44:54

From: The Mayor
You've probably seen it all the time in scripts but just didn't know what it was for:


if length(TPA) < 1 then
exit;


and after you split/filter it, it might be wise to do the same with the ATPA


if length(ATPA) < 1 then
exit;


yeah, seen it many times hehe, i had tried with "if Atpa < 1" and it didnt work hehe, so thats it, thanks!