Polack
2015-04-03 12:58:03
Hey, I'm trying to make a simple collector script, and I'm having trouble with a few parts:
This is my code for just the looting part:
Overall this code works for looting, albeit it's kinda slow and inefficient – especially how it sometimes doesn't pick items up in order of closeness. I remember reading a part of a tutorial (forgot whose) about making TPA's of bankers and using them based on closeness – could that work for collecting (haven't done a TPA yet so I'm apprehensive xD).
Also, on a unrelated note, do I need to 'FreeDTMs' in my script if I use them (also haven't done this yet).
- *Script needs to wait for a set time period after collecting X amount of items (i.e. after collecting 3 bones it needs to sit there and wait until a bone respawns (not keep searching for similar colors)
*Is there a way to tell if the script is walking so that it doesn't try to click mid-walk (especially on a different object – so far I'm just solving by increasing the wait times between clicks)
*What function do I use to switch worlds (to a world that I set?)
This is my code for just the looting part:
procedure Loot;.
var
x, y : Integer;
i : integer;
begin
for i:=1 to 3 do //my attempt at making it only collect 3 items before waiting X amount of time
begin
if not LoggedIn then LoginPlayer else
begin
if FindObjCustom(x, y, ['Take', 'ones'], [COLOR], 3) then //it doesn't seem to collect items in order of closeness to player; it might be a problem with the color tolerance (a lot of similar colors around unfortunately(the wall, the NPCS, even the damn ground lol))
begin
MMouse (x, y, 3, 3);
Wait(200 + Random(100));
Mouse (x, y, 0, 0, false); //left click would be faster/easier, but this is more stable i think
Wait(100 + Random(100));
ChooseOption('Take Bones');
Wait(4000 + Random(100)); //wait in between collecting items (to compensate for walking time)
end else; //I thought this would work for waiting X amount of time before looking for the item again after IF there were none left
begin
wait (3000 + Random(250));
end;
end;
end;
end;
Overall this code works for looting, albeit it's kinda slow and inefficient – especially how it sometimes doesn't pick items up in order of closeness. I remember reading a part of a tutorial (forgot whose) about making TPA's of bankers and using them based on closeness – could that work for collecting (haven't done a TPA yet so I'm apprehensive xD).
Also, on a unrelated note, do I need to 'FreeDTMs' in my script if I use them (also haven't done this yet).