Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

Помогите со скриптом плзззз под дрв

тут можно задать вопрос по скриптингу
Post Reply
noobJKE
Posts: 1
Joined: 29.10.2009 15:32
Contact:

Помогите со скриптом плзззз под дрв

Post by noobJKE »

Скрипт на локпики ,он работает но трудность в том что если несколько кучек аирона в сундуке скрипт сбиваеться помогиет плз..
*****
Program Tinker_Lockpick;

const
Sunduk_With_Iron_and_Tools=$40316151; //Туда же складываем и локпики
Tools=$1EBC;
Ingot=$1BEF;
Lockpick=$14FB;

var
k, l : integer;
TimeStart : TDateTime;



procedure Check_Lockpick;
begin
FindType(Lockpick,Backpack);
if FindCount>0 then
begin
while FindCount <> 0 do
begin
l:=l+1;
MoveItem(FindItem,1,Sunduk_With_Iron_and_Tools,0,0,0);
wait(500);
FindType(Lockpick,Backpack);
end;
end;
end;

procedure Check_World_Save;
begin
if InJournal('saving')<>-1 then
begin
ClearJournal;
k:=0;
repeat
wait(10000);
k:=k+1;
AddToSystemJournal('World is saving more than '+IntToStr(k*10)+' seconds.');
until (InJournal('data')<>-1) or (k>30);
end
end;

procedure Check_Connect;
begin
if not Connected then
while not Connected do
begin
Connect;
wait(1000);
end;
end;

procedure Check_Iron;
begin
FindTypeEx(Ingot,$0000,Backpack,False);
if (FindCount=0) OR (GetQuantity(FindItem)<5) then
begin
AddToSystemJournal('Добираем инги.');
UseObject(Sunduk_With_Iron_and_Tools);
wait(1000);
FindTypeEx(Ingot,$0000,Sunduk_With_Iron_and_Tools,False);
if (FindCount>0) and (GetQuantity(FindItem)>100) then
begin
MoveItem(FindItem,100,Backpack,0,0,0);
wait(1000);
AddToSystemJournal('Добрали 100 iron ingots. На данный момент имеем '+IntToStr(Count(Ingot))+' штук. Осталось ещё '+IntToStr(CountEx(Ingot,$0000,Sunduk_With_Iron_and_Tools))+' iron ingots. l='+IntToStr(l)+'; Count='+IntToStr(Count(Lockpick))+';');
end
else
AddToSystemJournal('Ошибка во время добора Iron Ignots.');
exit;
end
FindType(Ingot,Ground);
if FindCount>0 then
begin
MoveItem(FindItem,0,Sunduk_With_Iron_and_Tools,0,0,0);
wait(500);
end
end;


Begin
UseObject(Sunduk_With_Iron_and_Tools);
wait(1000);
ClearJournal;
CancelMenu;
AutoMenu( 'Tinkering' , 'Tools' );
AutoMenu( 'Tools' , 'lockpick' );
while not Dead do
begin
Check_Iron;
k:=0;
TimeStart:=Now;
UseObject(FindType(Tools,Backpack));
repeat
wait(100);
k := k + 1;
Check_World_Save;
until (InJournalBetweenTimes('You put|failed', TimeStart, Now)<>-1) or (k > 300);
wait(100);
if InJournal('put')<>-1 then
Check_Lockpick;
ClearJournal;
end;
End.
*******
WladL
Apprentice
Apprentice
Posts: 240
Joined: 27.07.2009 17:21
Location: DRW
Contact:

Post by WladL »

Вариант 1: Ищем только стопки ингов количество в которых > MinIngotCount

Code: Select all

procedure Check_Iron; 
//=================
const
MinIngotCount=5;
//сюда впиши сколько в кучке должно быть ингов чтоб скрипт обратил на нее внимание
//=================
begin 
FindTypeEx(Ingot,$0000,Backpack,False); 
if (FindCount=0) OR (GetQuantity(FindItem)<5) then 
begin 
AddToSystemJournal('Добираем инги.'); 
UseObject(Sunduk_With_Iron_and_Tools); 
wait(1000); 
FindTypeEx(Ingot,$0000,Sunduk_With_Iron_and_Tools,False);
//==============
while FindQuantity < MinIngotCount do begin
   Ignore(finditem);
   FindTypeEx(Ingot,$0000,Sunduk_With_Iron_and_Tools,False);
end;
IgnoreReset;
if (FindCount = 0)  then 
begin
   AddToSystemJournal('Кончились инги в сундуке.'); 
   exit; 
end;
//============== 
MoveItem(FindItem,100,Backpack,0,0,0); 
wait(1000); 
AddToSystemJournal('Добрали 100 iron ingots. На данный момент имеем '+IntToStr(Count(Ingot))+' штук. Осталось ещё '+IntToStr(CountEx(Ingot,$0000,Sunduk_With_Iron_and_Tools))+' iron ingots. l='+IntToStr(l)+'; Count='+IntToStr(Count(Lockpick))+';'); 

FindType(Ingot,Ground); 
if FindCount>0 then 
begin 
MoveItem(FindItem,0,Sunduk_With_Iron_and_Tools,0,0,0); 
wait(500); 
end 
end; 
Вариант 2 : Прежде чем начать добор, собираем разрозненные пачки в 1.

Code: Select all

procedure Check_Iron; 
//=================
const
MinIngotCount=5;
//сюда впиши сколько в сундуке должно быть ингов прежде чем начнем кричать "Больше нет"
var
CurrentStock:Cardinal;
//=================
begin 
FindTypeEx(Ingot,$0000,Backpack,False); 
if (FindCount=0) OR (GetQuantity(FindItem)<5) then 
begin 
AddToSystemJournal('Добираем инги.'); 
UseObject(Sunduk_With_Iron_and_Tools); 
wait(1000); 
FindTypeEx(Ingot,$0000,Sunduk_With_Iron_and_Tools,False);
if (FindCount=0)  then 
begin
   AddToSystemJournal('Кончились инги в сундуке.'); 
   exit; 
end; 
//==============
while FindCount > 1 then begin
  CurrentStock:=finditem;
  ignore(CurrentStock);
  FindTypeEx(Ingot,$0000,Sunduk_With_Iron_and_Tools,False);
  MoveItem(FindItem,FindQuantity,CurrentStock,0,0,0);
  wait(1000);//<--------??????а вдруг лаг?
  Check_World_Save;
  IgnoreReset;
  FindTypeEx(Ingot,$0000,Sunduk_With_Iron_and_Tools,False);
end;//while 
if FindQuantity < MinIngotCount then begin
   AddToSystemJournal('Кончились инги в сундуке.'); 
   exit; 
end; 
//==============
MoveItem(FindItem,100,Backpack,0,0,0); 
wait(1000); 
AddToSystemJournal('Добрали 100 iron ingots. На данный момент имеем '+IntToStr(Count(Ingot))+' штук. Осталось ещё '+IntToStr(CountEx(Ingot,$0000,Sunduk_With_Iron_and_Tools))+' iron ingots. l='+IntToStr(l)+'; Count='+IntToStr(Count(Lockpick))+';'); 

FindType(Ingot,Ground); 
if FindCount>0 then 
begin 
MoveItem(FindItem,0,Sunduk_With_Iron_and_Tools,0,0,0); 
wait(500); 
end 
end; 
Post Reply