SRL Archive - OSR Help

TPA looting help


King

2013-04-26 20:32:08

I'm trying to make a before and after TPA of the Red MM dots of loot in the Ancient cavern, it should combine the two then delete the duplicate portions leaving only the new loot points. It goes through and sets the loot points and I can tell because of the writeln's, but it doesnt actually have a length because it stops at
if GetArrayLength(LootTPA[i]) > 0 then

procedure FightFiends;
Var
BeforeKillTPA, AfterKillTPA: TPointArray;
begin
if not Fighting then
KillFiends;
if Fighting then
begin
BeforeKillTPA := GetMMDotsOnMS('red')
writeln('getting before kill TPA');
MarkTime(x);
repeat
Eating;
wait(RandomRange(150, 260));
until ((TimeFromMark(x) >= 45000) or not Fighting);
wait(RandomRange(5000, 6000));
AfterKillTPA := GetMMDotsOnMS('red');
writeln('getting after kill TPA');
wait(RandomRange(250, 300));
end;
end;

Procedure Looting2;
var
BeforeKillTPA, AfterKillTPA, LootTPA: TPointArray;
L, i:integer;
LootPoint: TPoint;
begin
writeln('looting');
LootTPA := combinetpa(BeforeKillTPA, AfterKillTPA)
cleardoubletpa(LootTPA);
L := High(LootTPA) for i := 0 to L do
if GetArrayLength(LootTPA[i]) > 0 then
begin
writeln('looting2');
LootPoint := MMToMSEx(0, 2, LootTPA[i]);
MMouse(LootPoint.x, LootPoint.y, 1, 1);
ClickMouse2(False);
if WaitOptionMulti(['ater orb', 'Rune helm', 'eaweed', 'attlestaff', 'eath rune', 'charm', 'Snape'], 350) then
begin
FFlag(1);
While IsMoving Do Wait(RandomRange(25, 50));
exit;
end;
end;
end;





begin
SetupSRL;
DeclarePlayers;
MouseSpeed := 25;
DeclareDTMz;
AddOnTerminate('FreeDTMz');
Init;
repeat
if not LoggedIn then
begin
LogInPlayer;
wait(RandomRange(1000, 6000));
end;
if not NeedToBank and AtCave then
begin
repeat
FightFiends;
Looting2;
until (GoToBank);
end;
if AtBank and NeedToBank then
begin
OpenZBank;
DoBanking;
end;
if not AtBank and NeedToBank then
begin
GetToBank;
OpenZBank;
DoBanking;
end;
if not NeedToBank and not AtCave then
begin
WalkToRing;
UseFairyRing;
end;
until (False);
end.

EngageTheRage

2013-04-26 21:02:37

your TPA's are local variables … should they not be global? when you call your looter, beforeKill and afterKill are not assigned any values … so your lootTPA has a length of 0 and so the if statement is not entered :)

King

2013-04-26 21:09:27

From: EngageTheRage
your TPA's are local variables … should they not be global? when you call your looter, beforeKill and afterKill are not assigned any values … so your lootTPA has a length of 0 and so the if statement is not entered :)


Thanks <3 I should have known :P

EngageTheRage

2013-04-26 21:11:37

From: King
Thanks <3 I should have known :P


no worries, only noticed because i did the same thing yesterday with some of my variables :/ took me an age to figure it out! lol