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

Help oldabyss antimacro

тут можно задать вопрос по скриптингу
Post Reply
boylord
Posts: 4
Joined: 05.11.2018 21:07

Help oldabyss antimacro

Post by boylord »

Sorry, my English and Russian are not very good, so the expression is not very clear


steath 8.9.4

AbyssAntiMacro.pas
Compiler: [Error] (E:\UO\Stealth_v8.9.2\Scripts\Uses\AbyssAntiMacro.pas at 5:1): 'BEGIN' expected

Code: Select all

// v 1.0
// First maker is Grin (inject)
// adaptation AdmiR

unit AbyssAntiMacro; 
interface 

function return_value(gi :TGumpInfo) : integer;
procedure AntimacroAbyss(Serial,GumpID,X,Y : Cardinal);


implementation

const
  AntiMacroGumpSerial = $1832044;   

function return_value(gi :TGumpInfo) : integer;

var 
  a : array of array of integer;
  i ,j , k , VariantReply , F: integer;  
  dx,dy : array [0..1] of integer; 
  cos : longint;
begin
  SetLength(a, 10); 
  a[2]:=[8,9,10,8,5,6,8,1,2];
  a[3]:=[4,7,6,6,7,8,5,7,11];
  a[5]:=[4,5,6,6,7,8,5,7,11];
  a[6]:=[7,9,10,5,6,8,8,11,10];
  a[8]:=[3,5,6,6,7,9,4,9,8];
  a[9]:=[4,6,7,5,8,7,2,1,4];    
  F := 10000;
                            
  for i := 0 to 2 do
  begin  
    VariantReply := StrToInt(gi.Text[i+1]);  
    cos := 0; 
    for k := 0 to 2 do
    begin
      for j := 0 to 1 do 
      begin 
        dx[j] := gi.GumpPics[a[VariantReply][j+k*3]].x-gi.GumpPics[a[VariantReply][j+1+k*3]].x; 
        dy[j] := gi.GumpPics[a[VariantReply][j+k*3]].y-gi.GumpPics[a[VariantReply][j+1+k*3]].y;
      end; 
      cos := cos + Abs(round(1000*(dx[0]*dx[1]+dy[0]*dy[1])/sqrt((dx[0]*dx[0]+dy[0]*dy[0])*(dx[1]*dx[1]+dy[1]*dy[1]))));    
    end;  
    if cos < F then 
    begin
      F := cos;
      result := i+1;
    end;
  end;
end;    

procedure AntimacroAbyss(Serial,GumpID,X,Y : Cardinal);
  var
    gi :TGumpInfo;
  begin 
    if Serial = AntiMacroGumpSerial then
      begin
        GetGumpInfo(GetGumpsCount-1,gi);    
        NumGumpButton(GetGumpsCount-1,return_value(gi));        
      end;  
  end;     

Begin
  SetEventProc(evIncomingGump,'AntimacroAbyss');  
end.

21:17:00:980 [fxuo5232]: Compiler: [Error] (AbyssAntiMacro at 45:120): Type mismatch
21:17:00:980 [fxuo5232]: Compiler: [Error] (E:\UO\Stealth_v8.9.2\Scripts\Uses\ABYSSANTIMACRO.pas at 2:12): Unit 'AbyssAntiMacro' not found or contains errors
21:17:00:980 [fxuo5232]: Compiling failed

Code: Select all

Program Miner;
uses AbyssAntiMacro.pas;
type
 TMinTile = record
  Tile, X, Y : Integer; 
 end;

var
 MinTiles : Array of TMinTile;
 k : Integer;
 Healers  : Array of TPoint;
 
 {Config vards}
 UnloadPoint : TPoint;
 ZhongZ : TPoint;
 Yuemen : TPoint;
 OreMine1 : TPoint;
 OreMine2 : TPoint;
 UnloadChest : Cardinal;
 WhereUnload : String;
stealth 8.9.11

Compiler: [Error] (E:\UO\Stealth_v8.9.11\Scripts\Uses\AbyssAntiMacro.pas at 5:1): 'BEGIN' expected
21:21:11:064 [fxuoboylord01]: Compiling failed

Code: Select all

// v 1.0
// First maker is Grin (inject)
// adaptation AdmiR

unit AbyssAntiMacro; 
interface 

function return_value(gi :TGumpInfo) : integer;
procedure AntimacroAbyss(Serial,GumpID,X,Y : Cardinal);


implementation

const
  AntiMacroGumpSerial = $1832044;   

function return_value(gi :TGumpInfo) : integer;

var 
  a : array of array of integer;
  i ,j , k , VariantReply , F: integer;  
  dx,dy : array [0..1] of integer; 
  cos : longint;
begin
  SetLength(a, 10); 
  a[2]:=[8,9,10,8,5,6,8,1,2];
  a[3]:=[4,7,6,6,7,8,5,7,11];
  a[5]:=[4,5,6,6,7,8,5,7,11];
  a[6]:=[7,9,10,5,6,8,8,11,10];
  a[8]:=[3,5,6,6,7,9,4,9,8];
  a[9]:=[4,6,7,5,8,7,2,1,4];    
  F := 10000;
                            
  for i := 0 to 2 do
  begin  
    VariantReply := StrToInt(gi.Text[i+1]);  
    cos := 0; 
    for k := 0 to 2 do
    begin
      for j := 0 to 1 do 
      begin 
        dx[j] := gi.GumpPics[a[VariantReply][j+k*3]].x-gi.GumpPics[a[VariantReply][j+1+k*3]].x; 
        dy[j] := gi.GumpPics[a[VariantReply][j+k*3]].y-gi.GumpPics[a[VariantReply][j+1+k*3]].y;
      end; 
      cos := cos + Abs(round(1000*(dx[0]*dx[1]+dy[0]*dy[1])/sqrt((dx[0]*dx[0]+dy[0]*dy[0])*(dx[1]*dx[1]+dy[1]*dy[1]))));    
    end;  
    if cos < F then 
    begin
      F := cos;
      result := i+1;
    end;
  end;
end;    

procedure AntimacroAbyss(Serial,GumpID,X,Y : Cardinal);
  var
    gi :TGumpInfo;
  begin 
    if Serial = AntiMacroGumpSerial then
      begin
        GetGumpInfo(GetGumpsCount-1,gi);    
        NumGumpButton(GetGumpsCount-1,return_value(gi));        
      end;  
  end;     

Begin
  SetEventProc(evIncomingGump,'AntimacroAbyss');  
end.
Compiler: [Error] (E:\UO\Stealth_v8.9.11\Scripts\Uses\ABYSSANTIMACRO.pas at 45:120): Type mismatch
21:23:15:382 [fxuoboylord01]: Compiling failed

Code: Select all

rogram Miner;
uses AbyssAntiMacro.pas;

type
 TMinTile = record
  Tile, X, Y : Integer; 
 end;

var
 MinTiles : Array of TMinTile;
 k : Integer;
 Healers  : Array of TPoint;
 
 {Config vards}
 UnloadPoint : TPoint;
 ZhongZ : TPoint;
 Yuemen : TPoint;
 OreMine1 : TPoint;
 OreMine2 : TPoint;
 UnloadChest : Cardinal;
 WhereUnload : String;
 SmeltPoint  : TPoint; 
 ForgeId     : Cardinal;
 OreMine     : TPoint;
antimacro

Code: Select all

Serial: 1E1A3
GumpID: 119FB593
X: 001E
Y: 001E
Pages: 0
Gump Options:

GumpPics: X  Y  ID  Hue  Page  ElemNum
0:        120  120  5021  0  0  2
1:        374  126  2362  0  0  3
2:        387  124  2362  0  0  4
3:        363  128  2362  0  0  5
4:        362  139  2362  0  0  6
5:        370  142  2362  0  0  7
6:        380  145  2362  0  0  8
7:        357  147  2362  0  0  9
8:        376  155  2362  0  0  10
9:        354  159  2362  0  0  11
10:        364  163  2362  0  0  12
11:        374  166  2362  0  0  13

ResizePics: X   Y   ID   Width   Height   Page   ElemNum
0:        100  100  83  320  205  0  0
1:        108  110  3000  306  185  0  1

GumpTexts: X   Y   Color   Text_ID   Page   ElemNum
0:        170  135  0  0  0  14
1:        160  190  65  1  0  16
2:        160  225  56  2  0  18
3:        160  260  69  3  0  20

Text Lines:
Please choose this number:
6
5
9

GumpButtons: X   Y   Released_ID  Pressed_ID   Quit   Page_ID   Return_value   Page   ElemNum
0:        120  185  2152  2153  1  0  1  0  15
1:        120  220  2152  2153  1  0  2  0  17
2:        120  255  2152  2153  1  0  3  0  19
boylord
Posts: 4
Joined: 05.11.2018 21:07

Re: Help oldabyss antimacro

Post by boylord »

Who has Abyss Gump Parser
Can you help me..
thank you

The answer is 6

Code: Select all

Serial: 10D18
GumpID: 45712DC5
X: 001E
Y: 001E
Pages: 0
Gump Options:

GumpPics: X  Y  ID  Hue  Page  ElemNum
0:        120  120  5021  0  0  2
1:        375  126  2362  0  0  3
2:        388  127  2362  0  0  4
3:        364  128  2362  0  0  5
4:        360  139  2362  0  0  6
5:        370  143  2362  0  0  7
6:        381  146  2362  0  0  8
7:        357  149  2362  0  0  9
8:        377  156  2362  0  0  10
9:        353  159  2362  0  0  11
10:        361  162  2362  0  0  12
11:        373  167  2362  0  0  13

ResizePics: X   Y   ID   Width   Height   Page   ElemNum
0:        100  100  83  320  205  0  0
1:        108  110  3000  306  185  0  1

GumpTexts: X   Y   Color   Text_ID   Page   ElemNum
0:        170  135  0  0  0  14
1:        160  190  93  1  0  16
2:        160  225  39  2  0  18
3:        160  260  96  3  0  20

Text Lines:
Please choose this number:
9
3
6

GumpButtons: X   Y   Released_ID  Pressed_ID   Quit   Page_ID   Return_value   Page   ElemNum
0:        120  185  2152  2153  1  0  1  0  15
1:        120  220  2152  2153  1  0  2  0  17
2:        120  255  2152  2153  1  0  3  0  19

The answer is 9

Code: Select all

Serial: 10D18
GumpID: 2067F6E6
X: 001E
Y: 001E
Pages: 0
Gump Options:

GumpPics: X  Y  ID  Hue  Page  ElemNum
0:        120  120  5021  0  0  2
1:        352  128  2362  0  0  3
2:        362  122  2362  0  0  4
3:        371  119  2362  0  0  5
4:        357  137  2362  0  0  6
5:        375  127  2362  0  0  7
6:        362  148  2362  0  0  8
7:        371  142  2362  0  0  9
8:        379  136  2362  0  0  10
9:        384  146  2362  0  0  11
10:        371  166  2362  0  0  12
11:        378  156  2362  0  0  13

ResizePics: X   Y   ID   Width   Height   Page   ElemNum
0:        100  100  83  320  205  0  0
1:        108  110  3000  306  185  0  1

GumpTexts: X   Y   Color   Text_ID   Page   ElemNum
0:        170  135  0  0  0  14
1:        160  190  98  1  0  16
2:        160  225  89  2  0  18
3:        160  260  93  3  0  20

Text Lines:
Please choose this number:
9
8
3

GumpButtons: X   Y   Released_ID  Pressed_ID   Quit   Page_ID   Return_value   Page   ElemNum
0:        120  185  2152  2153  1  0  1  0  15
1:        120  220  2152  2153  1  0  2  0  17
2:        120  255  2152  2153  1  0  3  0  19

The answer is 9

Code: Select all

Serial: 10D18
GumpID: 28483F42
X: 001E
Y: 001E
Pages: 0
Gump Options:

GumpPics: X  Y  ID  Hue  Page  ElemNum
0:        120  120  5021  0  0  2
1:        371  125  2362  0  0  3
2:        384  122  2362  0  0  4
3:        360  132  2362  0  0  5
4:        362  141  2362  0  0  6
5:        372  144  2362  0  0  7
6:        383  143  2362  0  0  8
7:        360  152  2362  0  0  9
8:        381  152  2362  0  0  10
9:        359  162  2362  0  0  11
10:        369  164  2362  0  0  12
11:        381  164  2362  0  0  13

ResizePics: X   Y   ID   Width   Height   Page   ElemNum
0:        100  100  83  320  205  0  0
1:        108  110  3000  306  185  0  1

GumpTexts: X   Y   Color   Text_ID   Page   ElemNum
0:        170  135  0  0  0  14
1:        160  190  62  1  0  16
2:        160  225  26  2  0  18
3:        160  260  68  3  0  20

Text Lines:
Please choose this number:
6
2
8

GumpButtons: X   Y   Released_ID  Pressed_ID   Quit   Page_ID   Return_value   Page   ElemNum
0:        120  185  2152  2153  1  0  1  0  15
1:        120  220  2152  2153  1  0  2  0  17
2:        120  255  2152  2153  1  0  3  0  19
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: Help oldabyss antimacro

Post by Vizit0r »

Code: Select all

// v 1.1
// First maker is Grin (inject)
// adaptation AdmiR

unit AbyssAntiMacro; 
interface 

function return_value(gi :TGumpInfo) : integer;
procedure AntimacroAbyss(Serial,GumpID,X,Y : Cardinal);


implementation

const
  AntiMacroGumpSerial = $1832044;   

function return_value(gi :TGumpInfo) : integer;

var 
  a : array of array of integer;
  i ,j , k , VariantReply , F: integer;  
  dx,dy : array [0..1] of integer; 
  cos : longint;
begin
  SetLength(a, 10); 
  a[2]:=[8,9,10,8,5,6,8,1,2];
  a[3]:=[4,7,6,6,7,8,5,7,11];
  a[5]:=[4,5,6,6,7,8,5,7,11];
  a[6]:=[7,9,10,5,6,8,8,11,10];
  a[8]:=[3,5,6,6,7,9,4,9,8];
  a[9]:=[4,6,7,5,8,7,2,1,4];    
  F := 10000;
                            
  for i := 0 to 2 do
  begin  
    VariantReply := StrToInt(gi.Text[i+1]);  
    cos := 0; 
    for k := 0 to 2 do
    begin
      for j := 0 to 1 do 
      begin 
        dx[j] := gi.GumpPics[a[VariantReply][j+k*3]].x-gi.GumpPics[a[VariantReply][j+1+k*3]].x; 
        dy[j] := gi.GumpPics[a[VariantReply][j+k*3]].y-gi.GumpPics[a[VariantReply][j+1+k*3]].y;
      end; 
      cos := cos + Trunc(Abs(Extended(round(1000*(dx[0]*dx[1]+dy[0]*dy[1])/sqrt((dx[0]*dx[0]+dy[0]*dy[0])*(dx[1]*dx[1]+dy[1]*dy[1]))))));    
    end;  
    if cos < F then 
    begin
      F := cos;
      result := i+1;
    end;
  end;
end;    

procedure AntimacroAbyss(Serial,GumpID,X,Y : Cardinal);
  var
    gi :TGumpInfo;
  begin 
    if Serial = AntiMacroGumpSerial then
      begin
        GetGumpInfo(GetGumpsCount-1,gi);    
        NumGumpButton(GetGumpsCount-1,return_value(gi));        
      end;  
  end;     

Begin
  SetEventProc(evIncomingGump,'AntimacroAbyss');  
end.
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
User avatar
Vizit0r
Developer
Developer
Posts: 3958
Joined: 24.03.2005 17:05
Contact:

Re: Help oldabyss antimacro

Post by Vizit0r »

P.S. Asking community in Diskorg will give you result much faster)
"Пишите код так, как будто сопровождать его будет склонный к насилию психопат, который знает, где вы живете". (с) Макконнелл, "Совершенный код".
boylord
Posts: 4
Joined: 05.11.2018 21:07

Re: Help oldabyss antimacro

Post by boylord »

Vizit0r wrote:P.S. Asking community in Diskorg will give you result much faster)
Thank you for your reply, use the new file or out of the question.

[fxuohnj2]: Compiler: [Error] ( at 68:5): Semicolon (';') expected
23:32:59:186 [fxuohnj2]: Compiling failed

Code: Select all

Program Lumber;{伐木脚本}
uses AbyssAntiMacro;
 
type  {类型定义}
TreeRecord = Record  {树记录类型}
t,x,y: integer;
end;
 
var
TreeTile: array[0..50] of integer; {树分布数组 整型}
TreePlace: array[0..700] of TreeRecord; {树位置数组 树记录类型}
TreeCount: integer;  {树数量}
x,y,c,a,s: integer;
 
/// 设置 ///
const
RadiusX=60; {搜索树X坐标半径范围}
RadiusY=60; {搜索树Y坐标半径范围}
Axe=$0F43; {斧子类型,!!!这个一定要设置!!!}
StartXY=false;
bank1=$4001EC7E;//银行木材箱  $4000FB55;//银行箱子
StartX=1656; {开始x坐标}
StartY=2737; {开始Y坐标}
////////////////////

 
procedure CheckCon; {检查连接}
begin
if Connected=False then
begin;
repeat
Wait(1000);
until Connected=True;
Wait(5000);
end;
end;

procedure yz; //检测验证菜单
begin
if getgumpscount > 0 then 
repeat
AddToSystemJournal('请点击验证' + GetName(self));
wait(8000);
until getgumpscount = 0;
end;
           
procedure Checkguai;     
begin
FindDistance:=5;
if (FindTypesArrayEx([$0008,$000E,$0005,$0007],[$FFFF],[Ground],false) >0) then begin
AddToSystemJournal('发现怪物 ' + inttostr(FindItem) + ', 名字 ' + getname(FindItem));
newmovexy(1867,2782,true,0,true);
wait(4000);
end;
if hp < maxhp then
repeat
newmovexy(1867,2782,true,0,true);
wait(400);
newmovexy(1867,2786,true,0,true);
wait(400);
findtype($0E21,backpack);
UseObject(finditem);
WaitTargetSelf;
SetWarMode(false);
wait(4000);
until hp = maxhp;
end;
 
function CheckTool: boolean; {检查工具}
 begin
   CheckCon;{检查连接}
   {FindType(Axe, backpack);{找背包里的斧头}
   {if (dead=false) and (FindQuantity = 0) and (ObjAtLayer(RhandLayer) = 1) then {如果 死亡 或者 斧子=0 或者 没有拿斧头 则}
   { begin
    AddToSystemJournal('没有斧子');
    newmovexy(2500,560,true,0,true);
    wait(500);
    uosay('bank');
    wait(800);
    if findtype(axe,bank1) > 0 then
    begin
    moveitem(axe,1,backpack,0,0,0);
    wait(400);
    moveitem(axe,1,backpack,0,0,0);
    wait(400);
    moveitem(axe,1,backpack,0,0,0);
    wait(400);
    moveitem(axe,1,backpack,0,0,0);
    wait(400);
    end;

    //s:=0;
    //result:=false; {结果=假}
    //SetARStatus(false); {设置重新连接状态=假}
    //Disconnect;  {从UO服务器断开}
   { end
   else}
   result:=true; {结果=真}
 end;
 
 
procedure CheckTree;{检查树}
var
LCount: integer;
t,i: integer;
TTile: TStaticCell;
 
 begin
  TTile:=ReadStaticsXY(x, y, WorldNum);
  LCount:=GetLayerCount(x, y, WorldNum);
  i:=0;
  while i < LCount do
   begin
    for t:=0 to 28 do
    begin
     if TTile.Statics[i].Tile=TreeTile[t] then
     begin
      TreePlace[c].t:=TTile.Statics[i].Tile;
      TreePlace[c].x:=x;
      TreePlace[c].y:=y;
      c:=c+1;
      end;
    end;
  i:=i+1;
   end;
 end;
 
 
procedure FindTree; {找树}
 begin
  for x:=GetX(self)-RadiusX to GetX(self)+RadiusX do  {For循环 x=自己所在座标-搜索半径 到 自己所在范围+搜索半径 则退出循环}
  if x mod 2 = 0 then    {如果 X 求余 2 = 0 则}
   begin
   for y:=GetY(self)-RadiusY to GetY(self)+RadiusY do {For循环 Y=自己所在座标-搜索半径 到 自己所在范围+搜索半径 则退出循环}
   CheckTree;   {检查树}
   end
   else
  begin
   for y:=GetY(self)+RadiusY to GetY(self)-RadiusY do  {For循环 Y=自己所在座标+搜索半径 到 自己所在范围-搜索半径 则退出循环}
   CheckTree;  {检查树}
   end;
 TreeCount:=c-1;  {树数量=C-1}
end;
 
procedure Lumber;   {过程 伐木}
var
t: TDateTime;   {时间变量}
 begin
 for a:=0 to TreeCount do  {For循环 a=0 到 树数量 则 退出循环}
  begin
   CheckCon; {检查链接}
   t:=now;   {t=当前时间}
  { if hidden=false then
   begin
   useskill('Hiding');
   wait(2800); 
   end;}
   NewMoveXY(TreePlace[a].x, TreePlace[a].y, true, 1, true);  {移动到查找到的树附近}
   Wait(700);   {等待1秒}
   if CheckTool=true then   {如果 检查工具=真 则执行下面}
    begin
     {if hidden=false then
     begin
     Checkguai;
     SetWarMode(false);
     useskill('Hiding');
     wait(2800); 
     end;}
    //Equipt(RhandLayer,Axe); {装备斧头}
    //UseObject(ObjAtLayerEx(RhandLayer, Axe));
    //UseType(Axe, $FFFF); {使用斧头}
    useobject($4001ACF6);
    wait(500);
    yz;
    WaitTargetTile(TreePlace[a].t, TreePlace[a].x, TreePlace[a].y, 0);{目标对准树位置坐标}
     repeat
      Wait(700); {等待1秒}
      if (Weight>=400)and (connected)then
      begin
       newmovexy(1819,2820,true,0,true); //检测到超重后移动到房屋保险箱坐标
       wait(300); 
       //newmovexy(1821,2818,true,0,true); //检测到超重后移动到房屋保险箱坐标
       //wait(300); 
        while (FindTypeEx($1BDD,$FFFF,backpack,false)>1) do begin //如果身上还有矿就继续存
        uosay('nancy bank');  
        wait(1500) 
        FindTypeEx($1BDD,$FFFF,backpack,false)          //根据TYPE和颜色定义物品ITEM
        MoveItem(FindItem,0,bank1,0,0,0);          //  移动定义的物品到指定的箱子(保险箱)
        wait(1000)
        end; 
        end;
     until (InJournalBetweenTimes('to chop|log in your pack|logs in your pack|far|any useable wood|no wood|destroer!|You can' , t, now) > 0) or (Connected=False);// or (timer > 15000); {}
        end 
   else break;
   //Checkguai;
   end;
 end;
 
begin
c:=0;
s:=1;
   TreeTile[0]:=3274; 
   TreeTile[1]:=3275; 
   TreeTile[2]:=3277; 
   TreeTile[3]:=3280;

   TreeTile[4]:=3283; 
   TreeTile[5]:=3286; 
   TreeTile[6]:=3288; 
   TreeTile[7]:=3290;

   TreeTile[8]:=3293; 
   TreeTile[9]:=3296; 
   TreeTile[10]:=3299; 
   TreeTile[11]:=3302; 

   TreeTile[12]:=3320; 
   TreeTile[13]:=3323; 
   TreeTile[14]:=3326; 
   TreeTile[15]:=3329;

   TreeTile[16]:=3393;
   TreeTile[17]:=3394;
   TreeTile[18]:=3395;
   TreeTile[19]:=3396;

   TreeTile[20]:=3415;
   TreeTile[21]:=3416;
   TreeTile[22]:=3417;
   TreeTile[23]:=3418;

   TreeTile[24]:=3419;
   TreeTile[25]:=3438;
   TreeTile[26]:=3439;
   TreeTile[27]:=3440;

   TreeTile[28]:=3441;
   TreeTile[29]:=3442;
   TreeTile[30]:=3460;
   TreeTile[31]:=3461;

   TreeTile[32]:=3462;
   TreeTile[33]:=3476;
   TreeTile[34]:=3478;
   TreeTile[35]:=3480;

   TreeTile[36]:=3482;
   TreeTile[37]:=3484;
   TreeTile[38]:=3492;
   TreeTile[39]:=3496;
{TreeTile[0]:=3240;
TreeTile[1]:=3242;
TreeTile[2]:=3277;
TreeTile[3]:=3283;
TreeTile[4]:=3286;
TreeTile[5]:=3288;
TreeTile[6]:=3289;
TreeTile[7]:=3290;
TreeTile[8]:=3291;
TreeTile[9]:=3294;
TreeTile[10]:=3296;
TreeTile[11]:=3299;
TreeTile[12]:=3302;
TreeTile[13]:=3393;
TreeTile[14]:=3394;
TreeTile[15]:=3395;
TreeTile[16]:=3396;
TreeTile[17]:=3415;
TreeTile[18]:=3416;
TreeTile[19]:=3417;
TreeTile[20]:=3418;
TreeTile[21]:=3419;
TreeTile[22]:=3438;
TreeTile[23]:=3439;
TreeTile[24]:=3440;
TreeTile[25]:=3441;
TreeTile[26]:=3442;
TreeTile[27]:=3460;
TreeTile[28]:=3461;
TreeTile[29]:=3462;
TreeTile[30]:=3480;
TreeTile[31]:=3482;
TreeTile[32]:=3488;}
 
CheckCon;  {检查连接}
 
if StartXY=true then      {如果 开始变量等于真 则}
NewMoveXY(StartX, StartY, true, 0, true);   {移动到开始XY坐标上}
 
FindTree;   {找树}
AddToSystemJournal('发现树: '+IntToStr(TreeCount));
 
while (s=1) and (not dead) do
Lumber; {伐木}
end.
boylord
Posts: 4
Joined: 05.11.2018 21:07

Re: Help oldabyss antimacro

Post by boylord »

Vizit0r wrote:P.S. Asking community in Diskorg will give you result much faster)
Yes, thank you for your help and solve my problem. :D :D :D :D

Code: Select all

Program Lumber;{伐木脚本}
 
type  {类型定义}
TreeRecord = Record  {树记录类型}
t,x,y: integer;
end;
 
var
TreeTile: array[0..50] of integer; {树分布数组 整型}
TreePlace: array[0..700] of TreeRecord; {树位置数组 树记录类型}
TreeCount: integer;  {树数量}
x,y,c,a,s: integer;
 
/// 设置 ///
const
tools=$4001ACF6;
RadiusX=60; {搜索树X坐标半径范围}
RadiusY=60; {搜索树Y坐标半径范围}
Axe=$0F43; {斧子类型,!!!这个一定要设置!!!}
StartXY=false;
bank1=$4001EC7E;//银行木材箱  $4000FB55;//银行箱子
StartX=1656; {开始x坐标}
StartY=2737; {开始Y坐标}
////////////////////

 
procedure CheckCon; {检查连接}
begin
if Connected=False then
begin;
repeat
Wait(1000);
until Connected=True;
Wait(5000);
end;
end;

procedure CloseGumps;
var i,GumpsCount : Integer;
    tryClose : Boolean;
begin
i := 0;
while True do
  begin
    if i >= GetGumpsCount then Break;
    if tryClose and (GumpsCount = GetGumpsCount) then
      inc(i);
    GumpsCount := GetGumpsCount;
    tryClose := False;
    If IsGumpCanBeClosed(i) then
      begin
        CloseSimpleGump(i);
        tryClose := True;
      end
    else
      Inc(i);
    wait(20);          
  end;
end;

Function return_value(gi :TGumpInfo) : integer;

var 
  a : array of array of integer;
  i ,j , k , VariantReply , F: integer;  
  dx,dy : array [0..1] of integer; 
  cos : longint;
begin
  SetLength(a, 10); 
  a[2]:=[8,9,10,8,5,6,8,1,2];
  a[3]:=[4,7,6,6,7,8,5,7,11];
  a[5]:=[4,5,6,6,7,8,5,7,11];
  a[6]:=[7,9,10,5,6,8,8,11,10];
  a[8]:=[3,5,6,6,7,9,4,9,8];
  a[9]:=[4,6,7,5,8,7,2,1,4];    
  F := 10000;
                            
  for i := 0 to 2 do
  begin  
    VariantReply := StrToInt(gi.Text[i+1]);  
    cos := 0; 
    for k := 0 to 2 do
    begin
      for j := 0 to 1 do 
      begin 
        dx[j] := gi.GumpPics[a[VariantReply][j+k*3]].x-gi.GumpPics[a[VariantReply][j+1+k*3]].x; 
        dy[j] := gi.GumpPics[a[VariantReply][j+k*3]].y-gi.GumpPics[a[VariantReply][j+1+k*3]].y;
      end; 
      cos := cos + Trunc(Abs(Extended(round(1000*(dx[0]*dx[1]+dy[0]*dy[1])/sqrt((dx[0]*dx[0]+dy[0]*dy[0])*(dx[1]*dx[1]+dy[1]*dy[1]))))));    
    end;  
    if cos < F then 
    begin
      F := cos;
      result := i+1;
    end;
  end;
end;    

procedure AntimacroAbyss(Serial,GumpID,X,Y : Cardinal);
  var
    gi :TGumpInfo;
  begin 
    //if Serial = AntiMacroGumpSerial then
      begin
        GetGumpInfo(GetGumpsCount-1,gi);    
        NumGumpButton(GetGumpsCount-1,return_value(gi));        
      end;  
  end;   

procedure yz; //检测验证菜单
begin
if getgumpscount > 0 then 
repeat
SetEventProc(evIncomingGump,'AntimacroAbyss');
AddToSystemJournal('正在验证' + getname(self));
wait(1000);
CloseGumps;
wait(500);
UseObject($4001ACF6);
until getgumpscount = 0;
end;
           
procedure Checkguai;     
begin
FindDistance:=5;
if (FindTypesArrayEx([$0008,$000E,$0005,$0007],[$FFFF],[Ground],false) >0) then begin
AddToSystemJournal('发现怪物 ' + inttostr(FindItem) + ', 名字 ' + getname(FindItem));
newmovexy(1867,2782,true,0,true);
wait(4000);
end;
if hp < maxhp then
repeat
newmovexy(1867,2782,true,0,true);
wait(400);
newmovexy(1867,2786,true,0,true);
wait(400);
findtype($0E21,backpack);
UseObject(finditem);
WaitTargetSelf;
SetWarMode(false);
wait(4000);
until hp = maxhp;
end;
 
function CheckTool: boolean; {检查工具}
 begin
   CheckCon;{检查连接}
   //FindType(Axe, backpack);{找背包里的斧头}
   //if (dead=false) and (FindQuantity = 0) and (ObjAtLayer(RhandLayer) = 1) then {如果 死亡 或者 斧子=0 或者 没有拿斧头 则}
   { begin
    AddToSystemJournal('没有斧子');
    newmovexy(2500,560,true,0,true);
    wait(500);
    uosay('bank');
    wait(800);
    if findtype(axe,bank1) > 0 then
    begin
    moveitem(axe,1,backpack,0,0,0);
    wait(400);
    moveitem(axe,1,backpack,0,0,0);
    wait(400);
    moveitem(axe,1,backpack,0,0,0);
    wait(400);
    moveitem(axe,1,backpack,0,0,0);
    wait(400);
    end;  }

    //s:=0;
    //result:=false; {结果=假}
    //SetARStatus(false); {设置重新连接状态=假}
    //Disconnect;  {从UO服务器断开}
    {end
   else}
   result:=true; {结果=真}
 end;
 
 
procedure CheckTree;{检查树}
var
LCount: integer;
t,i: integer;
TTile: TStaticCell;
 
 begin
  TTile:=ReadStaticsXY(x, y, WorldNum);
  LCount:=GetLayerCount(x, y, WorldNum);
  i:=0;
  while i < LCount do
   begin
    for t:=0 to 28 do
    begin
     if TTile.Statics[i].Tile=TreeTile[t] then
     begin
      TreePlace[c].t:=TTile.Statics[i].Tile;
      TreePlace[c].x:=x;
      TreePlace[c].y:=y;
      c:=c+1;
      end;
    end;
  i:=i+1;
   end;
 end;
 
 
procedure FindTree; {找树}
 begin
  for x:=GetX(self)-RadiusX to GetX(self)+RadiusX do  {For循环 x=自己所在座标-搜索半径 到 自己所在范围+搜索半径 则退出循环}
  if x mod 2 = 0 then    {如果 X 求余 2 = 0 则}
   begin
   for y:=GetY(self)-RadiusY to GetY(self)+RadiusY do {For循环 Y=自己所在座标-搜索半径 到 自己所在范围+搜索半径 则退出循环}
   CheckTree;   {检查树}
   end
   else
  begin
   for y:=GetY(self)+RadiusY to GetY(self)-RadiusY do  {For循环 Y=自己所在座标+搜索半径 到 自己所在范围-搜索半径 则退出循环}
   CheckTree;  {检查树}
   end;
 TreeCount:=c-1;  {树数量=C-1}
end;
 
procedure Lumber;   {过程 伐木}
var
t: TDateTime;   {时间变量}
 begin
 for a:=0 to TreeCount do  {For循环 a=0 到 树数量 则 退出循环}
  begin
   CheckCon; {检查链接}
   t:=now;   {t=当前时间}
  { if hidden=false then
   begin
   useskill('Hiding');
   wait(2800); 
   end;}
   NewMoveXY(TreePlace[a].x, TreePlace[a].y, true, 1, true);  {移动到查找到的树附近}
   Wait(1000);   {等待1秒}
   if CheckTool=true then   {如果 检查工具=真 则执行下面}
    begin
     {if hidden=false then
     begin
     Checkguai;
     SetWarMode(false);
     useskill('Hiding');
     wait(2800); 
     end;}
    //Equipt(RhandLayer,Axe); {装备斧头}
    //UseObject(ObjAtLayerEx(RhandLayer, Axe));
    UseObject($4001ACF6);
    //UseType(Axe, $FFFF); {使用斧头}
    yz;
    WaitTargetTile(TreePlace[a].t, TreePlace[a].x, TreePlace[a].y, 0);{目标对准树位置坐标}
    wait(800);
    yz;
     repeat
      Wait(700); {等待1秒}
      if (Weight>=350)and (connected)then
      begin
       newmovexy(1819,2820,true,0,true); //检测到超重后移动到房屋保险箱坐标
       wait(300); 
       //newmovexy(1821,2818,true,0,true); //检测到超重后移动到房屋保险箱坐标
       //wait(300); 
        while (FindTypeEx($1BDD,$FFFF,backpack,false)>1) do begin //如果身上还有矿就继续存
        uosay('nancy bank');  
        wait(1500) 
        FindTypeEx($1BDD,$FFFF,backpack,false)          //根据TYPE和颜色定义物品ITEM
        MoveItem(FindItem,0,bank1,0,0,0);          //  移动定义的物品到指定的箱子(保险箱)
        wait(1000)
        end; 
        end;
     until (InJournalBetweenTimes('to chop|log in your pack|logs in your pack|far|any useable wood|no wood|destroer!|You can' , t, now) > 0) or (Connected=False);// or (timer > 15000); {}
        end 
   else break;
   //Checkguai;
   end;
 end;
 
begin
c:=0;
s:=1;
   TreeTile[0]:=3274; 
   TreeTile[1]:=3275; 
   TreeTile[2]:=3277; 
   TreeTile[3]:=3280;

   TreeTile[4]:=3283; 
   TreeTile[5]:=3286; 
   TreeTile[6]:=3288; 
   TreeTile[7]:=3290;

   TreeTile[8]:=3293; 
   TreeTile[9]:=3296; 
   TreeTile[10]:=3299; 
   TreeTile[11]:=3302; 

   TreeTile[12]:=3320; 
   TreeTile[13]:=3323; 
   TreeTile[14]:=3326; 
   TreeTile[15]:=3329;

   TreeTile[16]:=3393;
   TreeTile[17]:=3394;
   TreeTile[18]:=3395;
   TreeTile[19]:=3396;

   TreeTile[20]:=3415;
   TreeTile[21]:=3416;
   TreeTile[22]:=3417;
   TreeTile[23]:=3418;

   TreeTile[24]:=3419;
   TreeTile[25]:=3438;
   TreeTile[26]:=3439;
   TreeTile[27]:=3440;

   TreeTile[28]:=3441;
   TreeTile[29]:=3442;
   TreeTile[30]:=3460;
   TreeTile[31]:=3461;

   TreeTile[32]:=3462;
   TreeTile[33]:=3476;
   TreeTile[34]:=3478;
   TreeTile[35]:=3480;

   TreeTile[36]:=3482;
   TreeTile[37]:=3484;
   TreeTile[38]:=3492;
   TreeTile[39]:=3496;
 
CheckCon;  {检查连接}
 
if StartXY=true then      {如果 开始变量等于真 则}
NewMoveXY(StartX, StartY, true, 0, true);   {移动到开始XY坐标上}
 
FindTree;   {找树}
AddToSystemJournal('发现树: '+IntToStr(TreeCount));
 
while (s=1) and (not dead) do
Lumber; {伐木}
end.
Post Reply