Code: Select all
Program carpentry;
var
TwoTarget,ItemCostWood,ItemCostTwoMaterial,TotalWoods,TotalTwoMaterial,i: integer;
stime : TDateTime;
Trash,TempWoods,TempTwoMaterial : cardinal;
TwoMaterialType,WoodType,ItemType,ToolType : word;
ItemGump:string;
{$Include 'all.inc'}
procedure FullDisconnect;
begin
SetARStatus(false);
Disconnect;
end;
function timer(var acttimer:integer;actafter:integer):boolean;
begin
result:=false;
acttimer:=acttimer+1;
if acttimer>=actafter then
begin
acttimer:=0;
result:=true;
end;
end;
procedure Checktools;
begin
WaitConnection(3000);
checksave;
findtype(ToolType,backpack);
if (findcount > 0) then Exit;
findtype(ToolType,ground);
if (findcount > 0) then
begin
Grab(finditem,1)
Exit;
end;
Addtosystemjournal('Не нашел инструмент в приделах досягаемости, чара в лагаут');
FullDisconnect;
while true do wait(1000);
end;
procedure CheckTwoMaterial;
Label a1st;
begin
WaitConnection(3000);
checksave;
if (GetQuantity(TempTwoMaterial) >= ItemCostTwoMaterial) then Exit;
a1st:
WaitConnection(3000);
findtype(TwoMaterialType,ground);
if findcount = 0 then
begin
Addtosystemjournal('Закончился дополнительный материал, либо он не найден, чара в лагаут');
FullDisconnect;
while true do wait(1000);
end;
if findquantity < ItemCostTwoMaterial then
begin
Ignore(finditem);
goto a1st;
end
else TempTwoMaterial:=finditem;
end;
procedure Checkwoods;
Label a1st;
begin
WaitConnection(3000);
checksave;
if (GetQuantity(TempWoods) >= ItemCostWood) then Exit;
a1st:
WaitConnection(3000);
findtype(WoodType,ground);
if findcount = 0 then
begin
Addtosystemjournal('Закончилось дерево, либо оно не найдено, чара в лагаут');
FullDisconnect;
while true do wait(1000);
end;
if findquantity < ItemCostWood then
begin
Ignore(finditem);
goto a1st;
end
else TempWoods:=finditem;
end;
procedure MoveMakeItem;
begin
WaitConnection(3000);
findtype(ItemType,backpack);
if findcount>0 then
begin
ClickOnObject(finditem);
while findcount > 0 do
begin
Checksave;
moveitem(findtype(ItemType,backpack),1,Trash,0,0,0);
CheckLag;
findtype(ItemType,backpack);
end;
end;
end;
Begin
{===============================================================================
======================================}
TwoTarget:=1; {1 или 0, при 1 качаемся на муз.инструментах, удочках, при 0 на всем
остальном}
ItemGump:='3519'; {номер гампа делаемого итема}
ItemType:=$0DBF; {тайп делаемого итема}
ToolType:=$102C; {тайп инструмета}
WoodType:=$1BDD; {тайп дерева}
TwoMaterialType:=$1BF2 {при использовании 2 таргетов дополнительный материал, железо или ткань}
Trash:=$582ACCEE; {ID мусорника}
ItemCostWood:=15; {кол-во дерева требуемое на 1 итем}
ItemCostTwoMaterial:=5; {кол-во дополнительного материала требуемое на 1 итем}
{===============================================================================
======================================}
FindDistance := 2;
SetARStatus(true);
TempWoods:=0;
TempTwoMaterial:=0;
Clearjournal;
if connected then hungry(1,ground);
while not dead do
begin
if targetpresent then canceltarget;
MoveMakeItem;
CheckTools;
if TwoTarget=1 then CheckTwoMaterial;
CheckWoods;
WaitConnection(2000);
checksave;
CheckTargetError(2,2);
stime := Now;
WaitGump(ItemGump);
WaitTargetObject(TempWoods);
UseObject(FindType(ToolType,backpack));
if TwoTarget=1 then
begin
repeat
CheckSave;
InJournalBetweenTimes('ingots|fabric|already', stime, Now);
wait(50);
until (LineCount > 0) or (Now > stime + (1.0/1440));
WaitTargetObject(TempTwoMaterial);
end;
repeat
CheckSave;
InJournalBetweenTimes('destroy|make|create|made|already', stime, Now);
wait(50);
until (LineCount > 0) or (Now > stime + (1.0/1440));
if timer(i,100) then
begin
Hungry(1,ground);
FindType(WoodType,ground);
TotalWoods:=FindFullQuantity;
if TwoTarget=1 then
begin
FindType(TwoMaterialType,ground);
TotalTwoMaterial:=FindFullQuantity;
AddToSystemJournal('Осталось '+IntToStr(TotalWoods)+' дерева и '+IntToStr(TotalTwoMaterial)+'
доп. материала');
end
else AddToSystemJournal('Осталось '+IntToStr(TotalWoods)+' дерева ');
end;
end;
End.
Code: Select all
Compiler: [Error] (êàðïà.txt at 104:2): Unknown identifier 'CheckLag'
19:18:01 [eZy]: Compiling failed
19:18:01 [eZy]: Script êàðïà.txt stoped successfuly