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

Деревья

тут можно задать вопрос по скриптингу
Post Reply
Half-Life
Novice
Novice
Posts: 86
Joined: 30.10.2012 12:06
Location: Одесса
Contact:

Деревья

Post by Half-Life »

Добрый день. Хочу переделать скрипт на мининг для добычи дерева. Суть проблемы в чём. При добыче руды, в TargetToTile(tile, X, Y, Z); переменная tile равна нулю. А при добычи древесины у каждого дерева она разная. Есть рунабука с 16 рунами. При реколе к любой из 16 рун дерево стоит в кординатах (X - 1, Y + 1) где X и Y - координаты того тайла куда рекольнулся чар. Теперь вопрос. Можно ли сделать так. Чар реколится по руне, на кординаты (X - 1, Y + 1) накидывает допустим ,infotile, вытаскивает значение tile запоминает его и использует в TargetToTile(tile, X, Y, Z); где x=x-1 y=y+1 а tile то что мы запомнили в предыдущей процедуре.?

procedure ChopPoint;
var
X, Y: Word;
begin
X := GetX(Self);
Y := GetY(Self);
Chop(X - 1, Y + 1);

end;

procedure Chop(X, Y: Integer);
var
Z: ShortInt;
Finded: Boolean;
Counter: Byte;
StartTime: TDateTime;
Tile: Word;

begin


CheckState();
Finded := True;
// while Finded do begin
// if Dead or not Connected then Exit;
// if TargetPresent then CancelTarget;
// while not CheckMiningTool do begin
// if Dead or not Connected then Exit;
// CreateMiningTools;
// end;
CheckLag(LagWait);
Wait(WaitTime);
UseObject(Tool);
CheckLag(LagWait);
WaitForTarget(WaitTime);
if TargetPresent then begin
StartTime := Now;
TargetToTile(tile, X, Y, Z);
Counter := WaitCycles;
Finded := False;
while (not Finded) and (Counter > 0) do begin
CheckLag(LagWait);
if InJournalBetweenTimes('t mine there|is too far away|cannot be seen|is no metal here to mine', StartTime, Now) > 0 then Exit;
if InJournalBetweenTimes('put it in your backpack|loosen some rocks but fail to find any useable ore|have worn out your tool', StartTime, Now) > 0 then Finded := True;
if Not Finded then Wait(200);
Dec(Counter);
end;
CheckState();
end;
end;
//end;
shinma
Expert
Expert
Posts: 505
Joined: 28.04.2011 12:05

Re: Деревья

Post by shinma »

на форуме есть поиск


http://stealth.od.ua/forum/viewtopic.php?f=3&t=1906
--->>>ПОИСК ПО ФОРУМУ, НАЧНИ С НЕГО!!!<<<---
--->>>Search the forum, start with him!!!<<<---
95% Ваших вопросов уже кем-то написаны и решены.
Half-Life
Novice
Novice
Posts: 86
Joined: 30.10.2012 12:06
Location: Одесса
Contact:

Re: Деревья

Post by Half-Life »

Ещё раз. Я играю на РанУо сервере, мне не надо бегать искать деревья. Мне надо узнать значение tile из x-y координат что бы использовать его в TargetToTile(tile, 1320, 2016, 0);
shinma
Expert
Expert
Posts: 505
Joined: 28.04.2011 12:05

Re: Деревья

Post by shinma »

Изобретая колесо будь готов изобретать его сам.
Просто или ты не понимаешь, что делаешь сизифов труд, или вообще ничего не понимаешь. А так - на мини код разбирайся. Все это есть в вики.

Code: Select all

var
    X0,Y0,Z0,Tile: Word;
    Tile0: TStaticCell;
    C,W0: Byte;
begin
 // repeat
      X0:=872;
      Y0:=1246;
      W0:=WorldNum;
      Tile0:=ReadStaticsXY(X0,Y0,W0);
      C:=GetLayerCount(X0,Y0,WorldNum);
      Addtosystemjournal('GetLayerCount = '+IntToStr(c)+' | X = ' +IntToStr(X0)+' | Y = '+IntToStr(Y0)); 
       Addtosystemjournal('Tile = ' +IntToStr(Tile0.Statics[0].Tile));
    {  Addtosystemjournal('Layers = '+IntToStr(Tile0.StaticCount)+' | Tile = ' +IntToStr(Tile0.Statics[0].Tile)+
      ' | X = ' +IntToStr(Tile0.Statics[0].X)+' | Y = ' +IntToStr(Tile0.Statics[0].Y)+' | Z = ' +IntToStr(Tile0.Statics[0].Z)+' | Color = ' +IntToStr(Tile0.Statics[0].Color));
      Addtosystemjournal('Tile = ' +IntToStr(GetMapCell(X0,Y0,WorldNum).Tile)+' | Z = ' +IntToStr(GetMapCell(X0,Y0,WorldNum).Z));
      Tile:= (GetMapCell(X0,Y0,WorldNum).Tile);
      Addtosystemjournal('Flags = '+IntToHex(GetLandTileData(Tile).Flags,8)+' | TextureID = ' +IntToStr(GetLandTileData(Tile).TextureID));
      Addtosystemjournal('Flags = '+IntToHex(GetStaticTileData(Tile).Flags,8)+' | Weight = ' +IntToStr(GetStaticTileData(Tile).Weight)+' | Height = ' +IntToStr(GetStaticTileData(Tile).Height));     }

//  until (1<>1); 
end.
--->>>ПОИСК ПО ФОРУМУ, НАЧНИ С НЕГО!!!<<<---
--->>>Search the forum, start with him!!!<<<---
95% Ваших вопросов уже кем-то написаны и решены.
Half-Life
Novice
Novice
Posts: 86
Joined: 30.10.2012 12:06
Location: Одесса
Contact:

Re: Деревья

Post by Half-Life »

Спасибо за мини код. Всё работает как часики)
Post Reply