В паке имень ножницы и инструмент.
Code: Select all
program tailor;
const
  containerID = $4026416B; // Сундук.
  toolType = $0F9D;
  clothType = $175D;
  bandageType = $0E21;
  scissorsType = $0F9E;
  bodysashType = $1541;
var
  cTime: tdatetime;
begin
  automenu('Cloth', 'Misc.');
  automenu('Misc.', 'body sash');
  while NOT dead do begin
    if findtype(toolType ,backpack) = 0 then
      useobject(backpack)
    else if findtype(bodysashType ,backpack) > 0 then begin
      waittargetobject(finditem);
      usetype(scissorsType, $FFFF);
    end else if (findtype(clothType ,backpack) > 0) AND (findquantity >= 4) then begin
      if (injournalbetweentimes('fail|put', cTime, now) >= 0) OR (cTime+1.0/(24*60) <= now) then begin
        wait(100);
        cTime := now;
        waittargetobject(finditem);
        usetype(toolType, $FFFF);
        checklag(100000);
        wait(100);
        if injournalbetweentimes('fail', cTime, now) >= 0 then
          cTime := now;
      end;
    end else if findtype(bandageType ,backpack) > 0 then
      moveitem(finditem, 0, containerID, 0, 0, 0)
    else begin
      while findtype(clothType, containerID) = 0 do begin
        addtosystemjournal('Кончилась ткань в сундуке.');
        wait(20000);
        useobject(containerID);
        checklag(100000);
        wait(3000);
      end;
      moveitem(findtype(clothType, containerID), 300, backpack, 0, 0, 0);
    end;
    checklag(100000);
    wait(500);
  end;
end.