faq/stealth/bowcraft.txt · Last modified: 2020/10/11 14:15 by r2d2
 

Bowcraft

Script for bolts/ arrows:

Program BowCraft_arrows;
{$Include 'all.inc'}

var
i : Integer;

Const
ShaftsType = $1BD4;
FeathersType = $1BD1;
arrowtype = 'bolt'; //'bolt' or 'arrow'

procedure FullDisconnect;
begin
  SetARStatus(false);
  Disconnect;
end;

procedure CheckShafts;
var k : Integer;
begin
  WaitConnection(3000);
  CheckSave;
  findtype(ShaftsType, ground);
  if (findfullquantity >= 100) then
  Exit;
  Disconnect;
  wait(5000);
  WaitConnection(3000);
  AddToSystemJournal('Not enough Shafts! Wait for somebody to share with you');
  while findquantity < 100 do
  begin
    WaitConnection(3000);
    CheckSave;
    UOSay('I don't have enough Shafts! Share some Shafts!');
    k := 0;
    while (k < 20) and (findquantity < 100) do
    begin
      wait(10000);
      k := k + 1;
      findtype(ShaftsType, ground);
    end;
    hungry(1, ground);
    wait(1000);
    findtype(ShaftsType, ground);
  end;
  AddToSystemJournal('Got Shafts! Let's go on!');
end;

procedure CheckFeathers;
var k : Integer;
begin
  WaitConnection(3000);
  CheckSave;
  findtype(FeathersType, ground);
  if (findfullquantity >= 100) then
  Exit;
  Disconnect;
  wait(5000);
  WaitConnection(3000);
  AddToSystemJournal('not enough Feathers! Wait for somebody to share');
  while findquantity < 100 do
  begin
    WaitConnection(3000);
    CheckSave;
    UOSay('Not enough Feathers! Share some Feathers!');
    k := 0;
    while (k < 20) and (findquantity < 100) do
    begin
      wait(10000);
      k := k + 1;
      findtype(FeathersType, ground);
    end;
    hungry(1, ground);
    wait(1000);
    findtype(FeathersType, ground);
  end;
  AddToSystemJournal('Got Feathers! Let's go on!');
end;

function GrabShafts : Boolean;
var c : Integer;
stime : TDateTime;
Shaft : Cardinal;
begin
  Shaft := FindType(ShaftsType,ground);
  if Shaft = 0 then
  begin
    AddToSystemJournal('Error with grab Shafts. Shafts not finded at ground');
    result := false;
    Exit;
  end;
  stime := Now;
  Grab(Shaft, 1);
  repeat
    c := InJournalBetweenTimes('performing|doing', stime, Now);
    wait(100);
  until (Now > stime + (1.0/1440)) or (c >= 0) or (FindType(ShaftsType,backpack) <> 0);
  wait(100);
  result := true;
end;

procedure Make;
var c : Integer;
stime : TDateTime;
Shafts : Cardinal;
Feather : Cardinal;
begin
  if GrabShafts = false then
  begin
    wait(1000);
    Exit;
  end;
  Shafts := FindType(ShaftsType,backpack);
  if Shafts = 0 then
  begin
    AddToSystemJournal('Error with make arrows. Shafts not found on the ground');
    Exit;
  end;
  Feather := FindType(FeathersType,ground);
  stime := Now;
  UseObject(Shafts);
  WaitTargetObject(Feather);
  wait(200);
  repeat
    c := InJournalBetweenTimes('performing|doing', stime, Now);
    InJournalBetweenTimes('create|make|destroy', stime, Now);
    wait(100);
  until (LineCount >= 1) or (Now > stime + (1.0/1440)) or (c >= 0);
  wait(100);
end;

Begin
  AutoMenu('create', arrowtype);
  FindDistance := 2;
  WaitConnection(3000);
  CheckSave;
  wait(5000);
  SetARStatus(true);
  while true do
  begin
    FindType(FeathersType,ground);
    AddToSystemJournal('Left '+IntToStr(FindFullQuantity)+' feathers.');
    WaitConnection(3000);
    CheckSave;
    CheckTargetError(5, 2);
    CheckShafts;
    CheckFeathers;
    Hungry(1,ground);
    wait(1000);
    i := 0;
    while i < 200 do
    begin
      Make;
      i := i + 1;
    end;
  end;
End.
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki