Originally Posted by
Wooty
This seems to have fixed it for me!
Awesome that it fixed it! Nice work!
EDIT: I'm testing it out. I will report back.
EDIT2: It's not working . It detects that there is something on the ground but It's not going past this line
Code:
if InIntArray([gItems[i].getid], 1) then
As I'm noobish at debugging.. I've rewritten the procedure to write things when it gets to certain points so that I know what it's doing - it seems to be working.
Code:
function lootMark(): Boolean;
var
i, id: Integer;
gItems: TReflectGroundItemArray;
begin
if (Course = 'Draynor') then
begin
gItems.GetAll(10);
end
else if (Course = 'Falador') then
begin
gItems.GetAll(6);
end
else if (Course = 'Seers') then
begin
gItems.GetAll(15);
end
else if (Course = 'Varrock') then
begin
gItems.GetAll(15);
end
if length(gItems) = 0 then
WriteLn('There arent any ground items... Exiting');
Exit;
for i := 0 to high(gItems) do
//untested, credit for this fix to hakishakataki.
if InIntArray([gItems[i].getid], 1) then
begin
WriteLn('Changing compass!');
Reflect.Compass.MakePitch(3 + Random(3));
if (findObject(1056406, 4, 4, 0.08, 0.62)) then
begin
WriteLn('We have found a mark!');
Draw('Found Mark');
case random(10) of
0..8:
begin
randomMouseInput(position, 3, 3);
if waituptext('Mark of grace', randomrange(50, 300)) then
fastClick(mouse_left);
waitMove(900);
inc(markCount);
exit(true);
end;
9..10:
begin
randomMouseInput(position, 3, 3);
if waituptext('Mark of grace', randomrange(50, 300)) then
fastClick(mouse_Right);
chooseoptionmulti(['Take', 'Mark of grace']);
waitMove(900);
inc(markCount);
exit(true);
end;
end;
if (didYellowClick()) then
begin
sleep(random(150, 300));
end;
end
else
inc(markCount);
end
end;
I'm going to check the previous script versions to see what changes were made and If I can garner anything from them about looting marks.
EDIT 3: We have a break through! So I was messing with the script in front of the seers bank and I found out that it takes a few seconds for the script and smart to correctly pull the ID's of ground items. This gave me the thought that 'maybe the script isn't given enough time to actually 'ID' the marks of grace on the ground.' Soooo, I added a line of code to tell the script to wait a few seconds if it detects any items on the ground...
Code:
if length(gItems) > 0 then
Wait(3000);
right after
Code:
if length(gItems) = 0 then exit;
and all of a sudden the script began telling me that it was detecting marks of grace! This was exciting because I haven't had the script get the the part where it detects mark of grace yet but it was also confusing because there weren't any marks of grace on the ground. What was happening was that people were training firemaking in front of the bank and the ashes were triggering the line
Code:
if InIntArray([gItems[i].getid], 1) then
and the colour of the fire was triggering the line of code, if
Code:
(findObject(1056406, 4, 4, 0.08, 0.62)) then
.
Apparently ashes also have the 'Ground ID' of '1'... which is why it was triggering the first line of code.
EDIT 4: After tinkering around for a while, I found a way to get the code to pick up Marks of Grace reliable without getting stuck on other items. I'll post the code shortly.
EDIT 5: Here's the code for picking up marks of grace. I've only tested it on the Seers course but so far it's working flawlessly.
Code:
function lootMark(): Boolean;
var
i, id: Integer;
gItems: TReflectGroundItemArray;
begin
if (Course = 'Draynor') then
begin
gItems.GetAll(10);
end
else if (Course = 'Falador') then
begin
gItems.GetAll(6);
end
else if (Course = 'Seers') then
begin
gItems.GetAll(15);
end
else if (Course = 'Varrock') then
begin
gItems.GetAll(15);
end
if (reflect.Tiles.getplane = 0) then
Exit;
if length(gItems) = 0 then
Exit;
if length(gItems) > 0 then
Wait(3000);
for i := 0 to high(gItems) do
if InIntArray([gItems[i].getid], 1) then
begin
WriteLn('Changing compass!');
Reflect.Compass.MakePitch(9 + Random(1));
if (findObject(1418170, 12, 50, 0.11, 0.89)) then // yellow
begin
WriteLn('We have found a mark!');
Draw('Found Mark');
case random(10) of
0..8:
begin
randomMouseInput(position, 3, 3);
if waituptext('Mark of grace', randomrange(50, 300)) then
fastClick(mouse_left);
waitMove(900);
inc(markCount);
exit(true);
end;
9..10:
begin
randomMouseInput(position, 3, 3);
if waituptext('Mark of grace', randomrange(50, 300)) then
fastClick(mouse_Right);
chooseoptionmulti(['Take', 'Mark of grace']);
waitMove(900);
inc(markCount);
exit(true);
end;
end;
if (didYellowClick()) then
begin
sleep(random(150, 300));
end;
end
else
Exit;
end
end;