Бегает по координатам, если перевес или отсутствуют топоры - бежит к дому затаривается.
Прошу прощения за то что скрипт не вычещен - руки не дошли. Надо иметь файл с тайлами и координаты ящиков (и их ИД)
Code: Select all
Program LumberBasic;
type LumberR = record
tile:word;
px,py,pz:integer;
end;
var
LumberP: array [0..32] of LumberR;
ItemCount,i,MaxWeight:Integer;
Cli: array [0..8] of string;
AxeType, oo, ii :word;
out11 : boolean;
{$Include 'all.inc'}
procedure RestoreStamina;
// если стамины мало, восстанавливаем ее чару до полной
begin
if Stam < 20 then
begin
repeat
waitconnection(3000);
wait(1000);
until Stam = MaxStam;
end;
end;
Procedure Go_Home;
VAR
resourse: array [0..4] of word;
Box_Drova,Box_Topory : cardinal;
HatchetCC, hatch : integer;
begin
axeType:=$0f43;
Box_Drova := $4008C115;
Box_Topory := $400BCC4A;
HatchetCC :=5;
resourse[0] :=$1BDD; //wood
resourse[1] :=$0F85; //gs
resourse[2] :=$0F25; //amber
resourse[3] :=$0F2D; // tourn
resourse[4] :=$0F86; //mr
newMoveXY(2553,768,False,0,false);
useobject(Box_Topory);
wait(1000);
hatch := count(AxeType);
Addtosystemjournal('At the start I have '+intToStr(hatch)+' hatchets!');
while (hatch<HatchetCC) do
begin
findtype(Axetype,Box_Topory);
grab(finditem,1);
wait(800);
hatch := count(AxeType);
Addtosystemjournal('I have '+intToStr(hatch)+' hatchets!');
end;
useobject(Box_Drova);
wait(1000);
for i:= 0 to 4 do
begin
while (getquantity(findtype(resourse[i],Backpack))>0) do
begin
moveitem(finditem,0,Box_Drova,0,0,0);
wait(1000);
end;
end;
end;
Procedure GetLumberTiles(s:String;WPos:Integer);
begin
s := s + ' ';
LumberP[WPos].tile:=StrToInt(Copy(s,1,Pos(' ',s)-1));
Delete(s,1,Pos(' ',s));
LumberP[WPos].px:=StrToInt(Copy(s,1,Pos(' ',s)-1));
Delete(s,1,Pos(' ',s));
LumberP[WPos].py:=StrToInt(Copy(s,1,Pos(' ',s)-1));
Delete(s,1,Pos(' ',s));
LumberP[WPos].pz:=StrToInt(Copy(s,1,Pos(' ',s)-1));
Delete(s,1,Pos(' ',s));
end;
Procedure GetCoord;
var
List:TStringList;
i:integer;
begin
List:=TStringList.Create;
List.LoadFromFile('C:\Drovosek.txt');
for i := 0 to List.Count-1 do
GetLumberTiles(List.strings[i],i);
ItemCount:=i;
end;
Function Lumber(tile:Word;x,y,z:Integer):boolean;
var
FBegin:TDateTime;
begin
FBegin:=Now;
axeType:=$0f43;
Cli[0]:='cliloc# 0xA20D'; //Target cannot be seen.
Cli[1]:='cliloc# 0xA30D'; //There's not enough wood here to harvest.
Cli[2]:='cliloc# 0xA309'; //You can't use an axe on that.
Cli[3]:='cliloc# 0xA2E7'; //There isn't enough wood here
Cli[4]:='cliloc# 0xA2DE'; //That is too far away.
Cli[5]:='cliloc# 0xA309'; //You can't use an axe on that.
Cli[6]:='cliloc# 0xA308'; //There's not enough wood here to harvest.
Cli[7]:='cliloc# 0xA311'; //You can't place any wood into your backpack!
Cli[8]:='cliloc# 0xA30D'; //There's not enough wood here to harvest.
useobject(backpack);
wait(3000);
repeat
begin
if (getquantity(findtype(AxeType,backpack)) > 0) or (gettype(ObjAtLayer(RhandLayer)) = AxeType) then
begin
Usetype(AxeType,0);
WaitTargetTile(tile,x,y,z);
wait(3000);
end
else
begin
oo := gettype(ObjAtLayer(RhandLayer));
ii := getquantity(findtype(AxeType,backpack));
Addtosystemjournal('yo '+intToStr(oo)+'!');
Addtosystemjournal('ya '+intToStr(ii)+'!');
wait(500);
end;
end;
until
(InJournalBetweenTimes(Cli[0], FBegin, Now) <> -1)
or (InJournalBetweenTimes(Cli[1], FBegin, Now) <> -1)
or (InJournalBetweenTimes(Cli[2], FBegin, Now) <> -1)
or (InJournalBetweenTimes(Cli[3], FBegin, Now) <> -1)
or (InJournalBetweenTimes(Cli[4], FBegin, Now) <> -1)
or (InJournalBetweenTimes(Cli[5], FBegin, Now) <> -1)
or (InJournalBetweenTimes(Cli[6], FBegin, Now) <> -1)
or (InJournalBetweenTimes(Cli[7], FBegin, Now) <> -1)
or (InJournalBetweenTimes(Cli[8], FBegin, Now) <> -1)
or (weight>400)
if
(InJournalBetweenTimes(Cli[7], FBegin, Now) <> -1)
or (weight>400)
or (getquantity(findtype(AxeType,backpack)) = 0)
then
result:=true //go home
else
result:=false; //go next
end;
begin
SetArStatus(true);
getcoord;
while not dead do
begin
for i :=1 to 40 do
begin
Addtosystemjournal('I go here '+intToStr(LumberP[i].px)+', '+intToStr(LumberP[i].py)+'!');
newMoveXY(LumberP[i].px,LumberP[i].py,false,1,false);
out11 := Lumber(LumberP[i].tile,LumberP[i].px,LumberP[i].py,LumberP[i].pz);
if out11 = true then
Go_Home
else
begin
Addtosystemjournal('Tree number '+intToStr(i)+'!');
end;
end;
end;
end.