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

Lamber POL

тут можно задать вопрос по скриптингу
Post Reply
m0nya
Neophyte
Neophyte
Posts: 37
Joined: 08.02.2008 11:15
Contact:

Lamber POL

Post by m0nya »

В Скрипте нету ни одной строчки CHECKSAVE а скрипт выдает ошибку

Code: Select all

21:14:48 [Dwarf]: Character MonyaK Connected.
21:14:52 [Dwarf]: Compiling
21:14:52 [Dwarf]: Compiler: [Error] (checksave.inc at 1:11):  Duplicate identifier 'CHECKSAVE'
21:14:52 [Dwarf]: Compiling failed
21:14:52 [Dwarf]: Script Lamber.sc stoped successfuly

Code: Select all

Program LumberJacking;
{$Include 'all.inc'}
type LumberR = record
   tile:word;
   px,py,pz:integer;
   end;
Var LumberP: array [0..16] of LumberR;
a,d,e : byte;
ItemCount,b:Integer;
Const
eda = $097B;
nearX = 708;
nearY = 1867;
onboadx = 704;
onboady = 1869;
onboadz = -2;
Trap = $4390BBE4;
maxweight = 410;
logType = $1BDD;
AxeType = $0F43;
AxeGump = '3907';
TinkGump = '7865';
Tinktype = $1EB9;
CopperType = $1BF2;

{$Include 'all.inc'}

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;
   b:integer;
begin
   List:=TStringList.Create;
   List.LoadFromFile('D:\games\Uo\Stealth_v1.0 (RC 3)\Scripts\Craft\Ltiles.txt');
   for b := 0 to List.Count-1 do
      GetLumberTiles(List.strings[b],b);
   ItemCount:=b;
end;

procedure hodilka(x,y,prec : integer; runflag : boolean);
   var ld, ldc, dx, dy, mx, my : Integer;
   begin
        ld := 0;   ldc := 0;   d := 0;     e := 2;
   AddToSystemJournal('Пошел');
     while true do
        begin
         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 > 4 then begin
             addtosystemjournal( 'GotoXY: Cannot reach location!' );
             a := 0
             repeat
             Raw_Move(d,runflag);
             a := a+1
             until a = e
             d := d + 2;
             If d = 8 then d:=0 e:= e+1 ldc :=0
              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 checkcoord;
begin
begin
if (GetZ(self) = OnBoadZ) then  begin
AddToSystemJournal('Вышел')
hodilka(OnBoadX,OnBoadY,0, true);
wait(3000);
{if (GetX(self) = OnBoadX) and (GetY(self) = OnBoadY) then  begin
AddToSystemJournal('Иду')}
repeat
UseObject(Trap);
wait(1000);
hodilka(nearX,nearY,0, true);
until (GetX(self) = nearX) and (GetY(self) = nearY);
AddToSystemJournal('ХоЖу');
end
end
end;


procedure CheckAxe;
Begin
AddToSystemJournal('Одел топор');
WaitConnection(3000);
if (Count(AxeType) < 2) then
begin
begin
FindType(Tinktype,ground);
if FindCount < 2 then
begin
UseObject(FindType(TinkType,ground));
WaitTargetobject(findtype(CopperType,ground));
WaitGump(TinkGump)
wait(500);
WaitJournalLine(Now, 'You create|destroy|You put', 30000);
Drophere(FindType(TinkType,backpack));
end
else
begin
repeat
WaitConnection(3000);
FindType(CopperType,ground);
if FindCount > 0 then
begin
UseObject(FindType(TinkType,ground));
WaitTargetobject(findtype(CopperType,ground));
WaitGump(AxeGump);
wait(500);
WaitJournalLine(Now, 'You create|destroy|You put', 30000);

end
else
begin
AddToSystemJournal('Нема Copperа!!!');
end
until Count(AxeType) >= 2
end

end

FindType(TinkType,ground);
Addtosystemjournal('дайте Тинкертулс'+intToStr(findfullquantity)+'!');
FindType(CopperType,ground);
Addtosystemjournal('Дайте купер'+intToStr(findfullquantity)+'!');
end
End;



procedure DropLog;
var g : integer;
logCol : Array [0..16] of Word;
Begin
finddistance := 2;
AddToSystemJournal('Скинул');
logCol[0] := $0000; // normum
logCol[1] := $000B; // elkris
logCol[2] := $0362; // jade
logCol[3] := $010D; // oak
logCol[4] := $0094; // karund
logCol[5] := $01B0; // leshram
logCol[6] := $01A2; // turmalit
logCol[7] := $0026; // emerint
logCol[8] := $00CB; // legrand
logCol[9] := $094A; // solmur
logCol[10] := $092B; // kleor
logCol[11] := $0931; // logradum
logCol[12] := $093F; // vialonit
logCol[13] := $0074; // stardust
logCol[14] := $09EF; // pironil
logCol[15] := $006F; // mystic
logCol[16] := $0119; // elvin
for g := 0 to 16 do
begin
FindTypeEx(logType,logCol[g],backpack,true);
if FindCount > 0 then
begin
stack(logType,logCol[g]);
wait(500);
end
end
findtype (eda,ground);
Addtosystemjournal('Дай еды '+intToStr(findfullquantity)+'!');
hungry (1,ground);
End;

procedure GotoOnBoad;
Begin
hodilka( nearX, nearY, 0,true);
  repeat
  UseObject(Trap);
  wait(1000);
  until (GetX(self) = OnBoadX) and (GetY(self) = OnBoadY);
CheckAxe;
End;

procedure CheckEquip;
   Var EquipAxe : Cardinal;
Begin
AddToSystemJournal('Одел Топорило');
  if GetType(ObjAtLayer(LhandLayer)) <> AxeType then
     begin
      Disarm;
      wait(1000);
      FindType(AxeType, backpack);
      if findCount < 2 then
       begin
       GotoOnBoad;
       end
        else
       begin
       EquipAxe := finditem;
       Equip(LhandLayer, EquipAxe);
       end
      end
End;

Function Lumber(tile:Word;x,y,z:Integer):boolean;
begin
CheckEquip;
WaitTargetTile(tile,x,y,z);
UseObject(ObjAtLayer(LhandLayer));
WaitJournalLine(now,'enough|how to use|broke|stop|can''t see|far away', 60000);
End;


procedure checkweight;
begin
if (Weight > MaxWeight) then  begin
AddToSystemJournal('Нема стамины');
GotoOnBoad;
DropLog;
end
checkcoord;
end;

BEGIN
SetArStatus(true);
getcoord;
ClearJournal;
AddToSystemJournal('Ура попер');
While (not Dead) do
begin
for b :=0 to 16 do
begin
  WaitConnection(3000);
  CheckCoord;
  CheckWeight;

   begin
    Addtosystemjournal('??? ? ????? '+intToStr(LumberP[b].px)+', '+intToStr(LumberP[b].py)+'!');
    hodilka(LumberP[b].px,LumberP[b].py,1,true);
    Addtosystemjournal('Tree number '+intToStr(b)+'!');
    Lumber(LumberP[b].tile,LumberP[b].px,LumberP[b].py,LumberP[b].pz);
   end

  end
  end
end.
Вот скрипт в чем может быть проблма ?
-=JoKeR=-
Novice
Novice
Posts: 153
Joined: 10.02.2008 11:19
Location: [Forest Wars] Ode$$a

Post by -=JoKeR=- »

зато есть две строки {$Include 'all.inc'}
m0nya
Neophyte
Neophyte
Posts: 37
Joined: 08.02.2008 11:15
Contact:

Post by m0nya »

Сори за невнимательность , но всеравно вот что выходит ;-(
1:45:32 [Dwarf]: Compiler: [Hint] (Lamber.sc at 245:10): Variable 'Result' never used
1:45:32 [Dwarf]: Compiled succesfully
1:45:32 [Dwarf]: Out Of Range at 28.218
1:45:32 [Dwarf]: Script Lamber.sc stoped successfuly
Чтото не в зоне его видимости , подскажите где ошибочку искать ...
Acronym
Novice
Novice
Posts: 114
Joined: 10.05.2005 18:42
Location: Odessa, NDW
Contact:

Post by Acronym »

Сколько деревьев в файле указано?
aka Trickster [YGG]
current version: 1.0 [RC3]
Vladimirus
Neophyte
Neophyte
Posts: 17
Joined: 12.11.2006 10:07
Contact:

Post by Vladimirus »

http://www.uo.od.ua/board/ipb.html?act=Search&f=
тебе поможет однозначно.
m0nya
Neophyte
Neophyte
Posts: 37
Joined: 08.02.2008 11:15
Contact:

Post by m0nya »

Acronym wrote:Сколько деревьев в файле указано?
23 дерева
Post Reply