Page 1 of 1

Хелпайте! ФАКАП какойто...

Posted: 20.06.2008 8:10
by JesuS (AoP)
короче говоря, хотел переделать скрипт ламбер на майнинг под свой сервак. Но мне оно факапит, немогу разобраться почему...
Может вы подскажите. Зарание благодарен людям за их трату времени и помощь.

Code: Select all

Program LumberBasic; 
type LumberR = record 
   tile:word; 
   px,py,pz:integer; 
end; 

var 
   LumberP: array [0..32] of LumberR; 
   ItemCount,i: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 GotoXY(x,y,prec : integer; runflag : boolean); 
   // x,y - координаты, в которые идем 
   // prec - точность подхода 
   // runflag - бежать или идти 
   // v. 1.04 (с) Edred, скрипт портирован с инжекта 
   // оригинальная версия Yoko с доработкой AGRS и Edred. 
   var ld, ldc, dx, dy, mx, my : Integer; 
   begin 
      ld := 0; ldc := 0; 
      while true do 
      begin 
         RestoreStamina; 
         dx := GetX(self) - x; if dx < 0 then dx := 0 - dx; 
         dy := GetY(self) - y; if dy < 0 then dy := 0 - dy; 
         if dy > dx then dx := dy; 
         if dx <= prec then exit; 
         mx := GetX(self); my := GetY(self); 
         dx := mx - x; if dx < 0 then dx := 0 - dx; 
         dy := my - y; if dy < 0 then dy := 0 - dy; 
         if dy > dx then dx := dy; 
         if dx <= prec then exit; 
         if ld = dx then begin 
            ldc := ldc + 1; 
            if ldc > 10 then begin addtosystemjournal( 'GotoXY: Cannot reach location!' ); 

exit; end; 
         end 
         else ld := dx; 
         waitconnection(5000); 
         if mx = x then begin 
            if my = y then exit; 
            // North 
            if my > y then begin Raw_Move(0,runflag); continue; end; 
            // South 
            Raw_Move(4,runflag); continue; 
         end; 
         if mx < x then begin 
            // Northeast 
            if my > y then begin Raw_Move(1,runflag); continue; end; 
            // East 
            if my = y then begin Raw_Move(2,runflag); continue; end; 
            // Southeast 
            Raw_Move(3,runflag); continue; 
         end; 
         // Southwest 
         if my < y then begin Raw_Move(5,runflag); continue; end; 
         // West 
         if my = y then begin Raw_Move(6,runflag); continue; end; 
         // Nortwest 
         Raw_Move(7,runflag); continue; 
      end; 
   end; 
Procedure Go_Home; 
VAR 

Weigth : integer;
resourse: array [0..4] of word; 
Box_Drova,Box_Topory : cardinal; 
HatchetCC, hatch : integer; 

begin 
axeType:=$0E85; 
Box_Drova := $783167D0; 
Box_Topory := $783167D0; 
HatchetCC :=1; 
resourse[0] :=$19B9; //wood 
resourse[1] :=$0F21; //gs 
resourse[2] :=$0F8C; //amber  
gotoxy(994,1580,0,false);
gotoxy(997,1600,0,false);
gotoxy(997,1606,0,false); 
gotoxy(985,1606,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);
If Weigth > 400 then 
begin
gotoxy(997,1606,0,false); 
gotoxy(997,1600,0,false);
gotoxy(994,1580,0,false);
end;
    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:\Tile.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)

+'!'); 
     gotoxy(LumberP[i].px,LumberP[i].py,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. 
П.С. огромная благодарность CrazyCats он помагал в переписании скрипта

Posted: 20.06.2008 21:50
by proZak
Ну дак строчки текстовые помоему так и остались под ламбер нада под миненг заделать

Posted: 10.07.2008 15:19
by Unholy
Бррр. Поставь скрипт в тег Code... Так его хоть можно будет прочитать!

Posted: 10.07.2008 15:21
by Edred
JesuS (AoP)
Я исправил твой пост, разместив код в соответствующие теги. В дальнейшем делай также.