Page 1 of 4 123 ... LastLast
Results 1 to 25 of 98

Thread: Rucoy Online Script

  1. #1
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Lightbulb Rucoy Online Script

    3/14/18: There is now an option to use libMufasaLayer with the script.

    NoxPlayer custom size: 798x482

    Simple setup. Kills and walks around based on the tile colors you enable (line 26).
    Turn off all the settings in the Rucoy menu (e.g. blood).
    You will need to drop the 'tap.dll' file into your Simba/Plugins folder. This is what lets the script run without using your mouse.

    Please give as much detail as possible when asking for help. Pictures and/or video are very useful as well.

    Simba Code:
    1. program Rucoy;
    2. {$loadlib tap}
    3. //{$loadlib LibMufasaLayer} {$DEFINE LAYER}
    4.  
    5. //noxplayer custom size: 798x482
    6. const
    7.   MAGIC = True; //SETUP
    8.   RANGE = True; //SETUP
    9.  
    10.   //add new Tiles if you want
    11.   TILE_BROWN       = 2504765;  //mummies?
    12.   TILE_GRASS       = 4757576;  //crows
    13.   TILE_DIRT_PATH   = 4749448;  //
    14.   TILE_SAND        = 10076395; //scorpions, snakes
    15.   TILE_MUD         = 2376788;  //
    16.   TILE_GRAVE_MUD   = 1065293;  //
    17.   TILE_GRAVE       = 2843236;  //
    18.   TILE_STONE       = 5197647;  //
    19.   TILE_STONE_BLUE  = 5785654;  //vampires
    20.   TILE_STONE_BROWN = 2702658;  //wolves
    21.   TILE_MAZE        = 3497525;  //assassins
    22.   //TILE_MAZE_U      = 2500134;  //broken: don't use
    23.  
    24.   //SETUP
    25.   PLAYER_LEVEL = 56;
    26.   TILE_COLORS: TIntegerArray = [
    27.                                 //TILE_STONE_BLUE
    28.                                 //TILE_GRAVE_MUD,
    29.                                 //TILE_MAZE
    30.                                 TILE_BROWN
    31.                                 //TILE_STONE_BROWN,
    32.                                 //TILE_GRASS
    33.                                 //TILE_DIRT_PATH,
    34.                                 //TILE_SAND
    35.                                 //TILE_MUD,
    36.                                 //TILE_GRAVE,
    37.                                 //TILE_STONE
    38.                                 ];
    39.  
    40.  
    41.   PLAYER_TILE = 67;
    42.   GRID_POINT: TPoint = [52, 72];
    43.   MSX1 = 27;
    44.   MSY1 = 51;
    45.   MSX2 = 777;
    46.   MSY2 = 501;
    47.   MSBOX: TBox = [MSX1, MSY1, MSX2, MSY2];
    48.   SKILL_BOX: TBox = [4, 285, 74, 355];
    49.   MANA_POT_BOX: TBox = [4, 362, 74, 432];
    50.   HP_POT_BOX: TBox = [4, 439, 74, 509];
    51.   LOOT_BOX: TBox = [748, 128, 797, 177];
    52.   MELEE_BOX: TBox = [748, 348, 797, 397];
    53.   RANGE_BOX: TBox = [748, 404, 797, 453];
    54.   MAGIC_BOX: TBox = [748, 460, 797, 509];
    55.  
    56.   GAME_BOX: TBox = [2, 30, 799, 511];
    57.   BOT_LEFT_BOX: TBox = [0, 282, 78, 513];
    58.   BOT_RIGHT_BOX: TBox = [745, 345, 801, 513];
    59.   TOP_LEFT_BOX: TBox = [0, 0, 250, 67];
    60.   TOP_RIGHT_BOX: TBox = [645, 0, 801, 80];
    61.   LIMIT_BOXES: TBoxArray = [BOT_LEFT_BOX, BOT_RIGHT_BOX, TOP_LEFT_BOX, TOP_RIGHT_BOX];
    62.  
    63.   MANA_BLUE       = 16563260;
    64.   TEXT_WHITE      = 15987699;
    65.   TEXT_YELLOW     = 65514;
    66.   RED_SQUARE      = 3289807;
    67.   TEXT_RED        = 4013567;
    68.   TEXT_GREEN      = 5171712;
    69.   TEXT_BLUE       = 16563260;
    70.   LOOT_HAND       = 4168184;
    71.   HP_GREEN        = 4897310;
    72.   HP_YELLOW       = 65514;
    73.   HP_GRAY         = 6908265;
    74.   DARK_OUTLINE    = 2500134;
    75.  
    76.   WAND_BROWN = 28808;
    77.   CLOSE_LIGHT_GRAY = 13224393;
    78.   PLAYER_POINT: TPoint = [400, 284];
    79.  
    80. var
    81.   _w, _h, _hh, _d: Int32;
    82.  
    83. {$IFDEF LAYER}
    84.  
    85. const
    86.   NPC_COLOR = $0099FF;
    87.   PLAYER_COLOR = $0000FF;
    88.   VALID_TILE_COLOR = $00FF00;
    89.   TARGET_COLOR = $FFFF00;
    90.  
    91. var
    92.   Layer: TMufasaLayer;
    93.  
    94. procedure SetupLayer;
    95. var
    96.   W, H: Integer;
    97. begin
    98.   GetClientDimensions(W, H);
    99.   Layer.Init(GetNativeWindow(), True, PluginPath);
    100.   Layer.Bitmap.Init(Client.getMBitmaps());
    101.   Layer.Bitmap.SetPersistentMemory(PtrUInt(Layer.GetBitmapPtr(W, H)), W, H);
    102.   AddOnTerminate('FreeLayer');
    103. end;
    104.  
    105. procedure FreeLayer;
    106. begin
    107.   Layer.Bitmap.Free;
    108.   Layer.Free;
    109. end;
    110.  
    111. function MsToTime(MS: Integer): string;
    112. var
    113.   STA: array [0..5] of TVariantArray;
    114.   Time: array of Integer;
    115.   i, t, tl: Integer;
    116. begin
    117.   Result := '';
    118.  
    119.   tl := 3;
    120.   t := 2;
    121.   SetLength(Time,tl);
    122.   ConvertTime(MS, Time[0], Time[1], Time[2]);
    123.  
    124.   STA[3] := [':', ':', '', True, 2];
    125.  
    126.   for i := 0 to t do
    127.     if (Time[i] > 0) or (STA[3][tl]) or (i = t) then
    128.       Result := Result + PadZ(IntToStr(Time[i]), STA[3][tl+1]) + STA[3][i];
    129. end;
    130.  
    131. procedure DrawClear();
    132. begin
    133.   Layer.Bitmap.DrawClear(0);
    134.   Layer.Bitmap.DrawSystemText(MsToTime(GetTimeRunning()), 'Arial', 20, [344, 0], False, $FFFFFF);
    135. end;
    136.  
    137. procedure DrawTPA(const TPA: TPointArray; Color: Int32; Clear: Boolean = True);
    138. begin
    139.   if (Length(TPA) < 1) then Exit;
    140.   if Clear then DrawClear();
    141.   Layer.Bitmap.DrawTPA(TPA, Color);
    142. end;
    143.  
    144. procedure DrawATPA(const ATPA: T2DPointArray; Clear: Boolean = True);
    145. var
    146.   i: Int32;
    147.   Colors: TIntegerArray;
    148. begin
    149.   if (Length(ATPA) < 1) then Exit;
    150.   if Clear then DrawClear();
    151.   SetLength(Colors, Length(ATPA));
    152.   for i := 0 to High(Colors) do Colors[i] := HSLToColor(i * 69 / Length(Colors), 100, 50);
    153.   Layer.Bitmap.DrawATPA(ATPA, Colors);
    154. end;
    155.  
    156. procedure DrawATPA(const ATPA: T2DPointArray; Color: Int32; Clear: Boolean = True); Overload;
    157. var
    158.   i: Int32;
    159.   Colors: TIntegerArray;
    160. begin
    161.   if (Length(ATPA) < 1) then Exit;
    162.   if Clear then DrawClear();
    163.   SetLength(Colors, Length(ATPA));
    164.   for i := 0 to High(Colors) do Colors[i] := Color;
    165.   Layer.Bitmap.DrawATPA(ATPA, Colors);
    166. end;
    167.  
    168. procedure DrawBoxes(const Boxes: TBoxArray; Fill: Boolean = False; Clear: Boolean = True);
    169. var
    170.   i: Int32;
    171.   ATPA: T2DPointArray;
    172. begin
    173.   if (Length(Boxes) < 1) then Exit;
    174.   SetLength(ATPA, Length(Boxes));
    175.   for i := 0 to High(ATPA) do
    176.   begin
    177.     if Fill then
    178.       ATPA[i] := TPAFromBox(Boxes[i]) else
    179.       ATPA[i] := EdgeFromBox(Boxes[i]);
    180.   end;
    181.   DrawATPA(ATPA, Clear);
    182. end;
    183.  
    184. procedure DrawBoxes(const Boxes: TBoxArray; Color: Int32; Fill: Boolean = False; Clear: Boolean = True); Overload;
    185. var
    186.   i: Int32;
    187.   ATPA: T2DPointArray;
    188. begin
    189.   if (Length(Boxes) < 1) then Exit;
    190.   SetLength(ATPA, Length(Boxes));
    191.   for i := 0 to High(ATPA) do
    192.   begin
    193.     if Fill then
    194.       ATPA[i] := TPAFromBox(Boxes[i]) else
    195.       ATPA[i] := EdgeFromBox(Boxes[i]);
    196.   end;
    197.   DrawATPA(ATPA, Color, Clear);
    198. end;
    199.  
    200. {$ENDIF LAYER}
    201.  
    202. function BoxWidth(const B: TBox): Int32;
    203. begin
    204.   Result := B.X2 - B.X1 + 1;
    205. end;
    206.  
    207. function BoxHeight(const B: TBox): Int32;
    208. begin
    209.   Result := B.Y2 - B.Y1 + 1;
    210. end;
    211.  
    212. function BoxArea(const B: TBox): Int32;
    213. begin
    214.   Result := BoxWidth(B) * BoxHeight(B);
    215. end;
    216.  
    217. function GridBox(Slot, Columns, Rows, w, h, dX, dY: Int32; StartPoint: TPoint): TBox;
    218. begin
    219.   if (Slot > (Columns * Rows)) then
    220.   begin
    221.     WriteLn('GridBox: Invalid Slot: ', Slot);
    222.     Exit;
    223.   end;
    224.  
    225.   Result.X1 := (StartPoint.x + ((Slot mod Columns) * dX) - (w div 2));
    226.   Result.Y1 := (StartPoint.y + ((Slot div Columns) * dY) - (h div 2));
    227.   Result.X2 := (Result.X1 + w);
    228.   Result.Y2 := (Result.Y1 + h);
    229. end;
    230.  
    231. function Grid(Columns, Rows, w, h, dX, dY: Int32; StartPoint: TPoint): TBoxArray;
    232. var
    233.   i: Int32;
    234. begin
    235.   SetLength(Result, (Columns * Rows));
    236.  
    237.   for i := 0 to High(Result) do
    238.     Result[i] := GridBox(i, Columns, Rows, w, h, dX, dY, StartPoint);
    239. end;
    240.  
    241. procedure GetAndSet();
    242. var
    243.   pp: TSysProcArr;
    244.   i, w, h: Int32;
    245. begin
    246.   GetClientDimensions(w, h);
    247.   pp := Client.GetIOManager.GetProcesses;
    248.   for i := 0 to High(pp) do
    249.   begin
    250.     if Pos('NoxPlayer', pp[i].Title) then
    251.     begin
    252.       SetTarget(pp[i]);
    253.       _hh := pp[i].Handle;
    254.       GetClientDimensions(_w, _h);
    255.       if ((w = _w) and (h = _h)) then
    256.       begin
    257.         WriteLn('Do not target the game directly!');
    258.         TerminateScript;
    259.       end;
    260.       {$IFDEF LAYER} SetupLayer(); {$ENDIF LAYER}
    261.       Exit();
    262.     end;
    263.   end;
    264.   WriteLn('game not found');
    265.   TerminateScript();
    266. end;
    267.  
    268. procedure Wait(const w1, w2: UInt32) Overload;
    269. begin
    270.   Wait(Random(w1, w2));
    271. end;
    272.  
    273. procedure Mouse(P: TPoint; Button: Byte = 0);
    274. begin
    275.   tap(_hh, P, Random(44, 88));
    276. end;
    277.  
    278. procedure MouseBox(B: TBox; Button: Byte = 0);
    279. begin
    280.   Mouse(Point(B.X1 + Random(B.X2 - B.X1), B.Y1 + Random(B.Y2 - B.Y1)), Button);
    281. end;
    282.  
    283. procedure TBox.Edit(const x1_, y1_, x2_, y2_: Int32);
    284. begin
    285.   Self.X1 := Self.X1 + x1_;
    286.   Self.Y1 := Self.Y1 + y1_;
    287.   Self.X2 := Self.X2 + x2_;
    288.   Self.Y2 := Self.Y2 + y2_;
    289. end;
    290.  
    291. procedure TBox.Shrink(const Size: Int32);
    292. begin
    293.   Self.Edit(+Size, +Size, -Size, -Size);
    294. end;
    295.  
    296. procedure TBox.Offset(const p: TPoint);
    297. begin
    298.   Self.X1 := Self.X1 + p.x;
    299.   Self.X2 := Self.X2 + p.x;
    300.   Self.Y1 := Self.Y1 + p.y;
    301.   Self.Y2 := Self.Y2 + p.y;
    302. end;
    303.  
    304. function ShrinkBox(const B: TBox; ShrinkBy: Int32): TBox;
    305. begin
    306.   Result.X1 := B.X1 + ShrinkBy;
    307.   Result.Y1 := B.Y1 + ShrinkBy;
    308.   Result.X2 := B.X2 - ShrinkBy;
    309.   Result.Y2 := B.Y2 - ShrinkBy;
    310. end;
    311.  
    312. function ShrinkBoxes(const BB: TBoxArray; ShrinkBy: Int32): TBoxArray;
    313. var
    314.   i: Int32;
    315. begin
    316.   SetLength(Result, Length(BB));
    317.   for i := 0 to High(Result) do Result[i] := ShrinkBox(BB[i], ShrinkBy);
    318. end;
    319.  
    320. procedure IncludePointsBox(var TPA: TPointArray; const B: TBox);
    321. begin
    322.   FilterPointsBox(TPA, B.X1, B.Y1, B.X2, B.Y2);
    323. end;
    324.  
    325. procedure ExcludePointsBox(var TPA: TPointArray; const B: TBox);
    326. var
    327.   Temp: TPointArray;
    328. begin
    329.   Temp := TPAFromBox(B);
    330.   TPA := ClearTPAFromTPA(TPA, Temp);
    331. end;
    332.  
    333. function IsDisconnected(): Boolean;
    334. begin
    335.   Result := (InRange(CountColor(TEXT_WHITE, 0, 0, _w-1, _h-1), 2300, 2350) and
    336.              InRange(CountColor(0, 0, 0, _w-1, _h-1), 382000, 383000));
    337. end;
    338.  
    339. function IsMagic(): Boolean;
    340. begin
    341.   Result := (CountColor(WAND_BROWN, 745, 460, _w-1, _h-1) > 44);
    342. end;
    343.  
    344. function GetTiles(): TBoxArray;
    345. begin
    346.   Result := Grid(15, 9, 50, 50, 50, 50, GRID_POINT);
    347. end;
    348.  
    349. function GetTile(Slot: Int32): TBox;
    350. begin
    351.   if (not InRange(Slot, 0, 134)) then Exit;
    352.   Result := GridBox(Slot, 15, 9, 50, 50, 50, 50, GRID_POINT);
    353. end;
    354.  
    355. function GetTiles(const Tiles: TIntegerArray): TBoxArray; Overload;
    356. var
    357.   i: Int32;
    358. begin
    359.   if (Length(Tiles) < 1) then Exit;
    360.   SetLength(Result, Length(Tiles));
    361.   for i := 0 to High(Result) do Result[i] := GetTile(Tiles[i]);
    362. end;
    363.  
    364. function PlayerBox(): TBox;
    365. begin
    366.   Result := GetTile(PLAYER_TILE);
    367. end;
    368.  
    369. function PointToTile(p: TPoint): Int32;
    370. var
    371.   i: Int32;
    372.   BB: TBoxArray;
    373. begin
    374.   Result := -1;
    375.   BB := GetTiles();
    376.   for i := 0 to High(BB) do if PointInBox(p, BB[i]) then Exit(i);
    377. end;
    378.  
    379. function GetTileRow(Slot: Int32): Int32;
    380. begin
    381.   Result := Slot div 15;
    382. end;
    383.  
    384. function GetTileCol(Slot: Int32): Int32;
    385. begin
    386.   Result := Slot mod 15;
    387. end;
    388.  
    389. function TileDist(t1, t2: Int32): Int32;
    390. var
    391.   r1, r2, c1, c2: Int32;
    392. begin
    393.   r1 := GetTileRow(t1);
    394.   r2 := GetTileRow(t2);
    395.   c1 := GetTileCol(t1);
    396.   c2 := GetTileCol(t2);
    397.   Result := max(r1, r2) - min(r1, r2) + max(c1, c2) - min(c1, c2);
    398. end;
    399.  
    400. function IsInRange(t: Int32): Boolean;
    401. begin
    402.   Result := (TileDist(PLAYER_TILE, t) <= 4);
    403. end;
    404.  
    405. function InIntArrayI(const TIA: TIntegerArray; num: Int32): Int32;
    406. var
    407.   i: Int32;
    408. begin
    409.   Result := -1;
    410.   if inIntArray(TIA, num) then for i := 0 to High(TIA) do if (TIA[i] = num) then Exit(i);
    411. end;
    412.  
    413. procedure ClickMelee();
    414. begin
    415.   MouseBox(MELEE_BOX);
    416. end;
    417.  
    418. procedure ClickRange();
    419. begin
    420.   MouseBox(RANGE_BOX);
    421. end;
    422.  
    423. procedure ClickMagic();
    424. begin
    425.   MouseBox(MAGIC_BOX);
    426. end;
    427.  
    428. function InCombat(out Tile: Int32): Boolean;
    429. var
    430.   i: Int32;
    431.   p: TPoint;
    432.   B: TBox;
    433.   TPA: TPointArray;
    434.   ATPA, Temp: T2DPointArray;
    435. begin
    436.   if FindColors(TPA, RED_SQUARE, MSX1, MSY1, MSX2, MSY2) then
    437.   begin
    438.     ExcludePointsBox(TPA, [0, 0, 255, 75]);
    439.     ExcludePointsBox(TPA, [0, 285, 75, _h-1]);
    440.     ExcludePointsBox(TPA, PlayerBox());
    441.     ATPA := ClusterTPA(TPA, 20);
    442.     FilterTPAsBetween(ATPA, 0, 50);
    443.     if (Length(ATPA) < 1) then Exit;
    444.  
    445.     for i := 0 to High(ATPA) do
    446.     begin
    447.       p := MiddleTPA(ATPA[i]);
    448.       Tile := PointToTile(p);
    449.       B := [p.x, p.y, p.x, p.y];
    450.       B.Shrink(-20);
    451.       ExcludePointsBox(ATPA[i], B);
    452.       if InRange(Length(ATPA[i]), 100, 800) then
    453.       begin
    454.         {$IFDEF LAYER} DrawTPA(ATPA[i], TARGET_COLOR, True); {$ENDIF LAYER}
    455.         Exit(True);
    456.       end;
    457.     end;
    458.   end;
    459. end;
    460.  
    461. function Loot(): Boolean;
    462. begin
    463.   if (CountColor(LOOT_HAND, LOOT_BOX.X1, LOOT_BOX.Y1, LOOT_BOX.X2, LOOT_BOX.Y2) > 444) then
    464.     MouseBox(LOOT_BOX);
    465. end;
    466.  
    467. function Close(): Boolean;
    468. begin
    469.   if InRange(CountColor(CLOSE_LIGHT_GRAY, 745, 35, _w-1, 85), 333, 444) then
    470.   begin
    471.     MouseBox([757, 36, 790, 64]);
    472.     Exit(True);
    473.   end;
    474. end;
    475.  
    476. function IsWalking(): Boolean
    477. var
    478.   i, BMPA, BMPB: Int32;
    479. begin
    480.   BMPA := BitmapFromClient(0, 0, _w-1, _h-1);
    481.   Wait(122);
    482.   BMPB := BitmapFromClient(0, 0, _w-1, _h-1);
    483.   Result := (CalculatePixelShift(BMPA, BMPB, [0, 0, _w-1, _h-1]) > 12345);
    484.   FreeBitmap(BMPA);
    485.   FreeBitmap(BMPB);
    486. end;
    487.  
    488. function WalkWait(const Tile: Int32): Boolean;
    489. begin
    490.   Wait(TileDist(PLAYER_TILE, Tile) * (420 - PLAYER_LEVEL));
    491. end;
    492.  
    493. function IsMelee(): Boolean;
    494. begin
    495.   Result := (CountColor(13417668, 750, 350, _w-1, _h-1) = 48);
    496. end;
    497.  
    498. function IsRange(): Boolean;
    499. begin
    500.   Result := (CountColor(13092807, 750, 350, _w-1, _h-1) = 108);
    501. end;
    502.  
    503. procedure ClickTile(var B: TBox);
    504. begin
    505.   B.Shrink(2);
    506.   MouseBox(B);
    507. end;
    508.  
    509. procedure ClickTile(Slot: Int32); overload;
    510. var
    511.   B: TBox;
    512. begin
    513.   if (Slot = PLAYER_TILE) then Exit;
    514.   B := GetTile(Slot);
    515.   ClickTile(B);
    516. end;
    517.  
    518. function OccupiedTile(B: TBox): Boolean;
    519. begin
    520.   B.Shrink(5);
    521.   Result := (CountColor(DARK_OUTLINE, B.X1, B.Y1, B.X2, B.Y2) > 175);
    522. end;
    523.  
    524. function OccupiedTile(const Tile: Int32): Boolean; overload;
    525. begin
    526.   Result := OccupiedTile(GetTile(Tile));
    527. end;
    528.  
    529. function ValidTileColor(const B: TBox): Boolean;
    530. var
    531.   i, c: Int32;
    532. begin
    533.   for i := 0 to High(TILE_COLORS) do c += CountColor(TILE_COLORS[i], B.X1, B.Y1, B.X2, B.Y2);
    534.   Result := (c > 9);
    535. end;
    536.  
    537. function ValidTileColor(Slot: Int32): Boolean; overload;
    538. begin
    539.   if InRange(Slot, 0, 134) then Result := ValidTileColor(GetTile(Slot));
    540. end;
    541.  
    542. function ValidTile(B: TBox): Boolean;
    543. var
    544.   i, c, a: Int32;
    545. begin
    546.   B.Shrink(5);
    547.   a := BoxArea(B);
    548.   for i := 0 to High(TILE_COLORS) do c += CountColor(TILE_COLORS[i], B.X1, B.Y1, B.X2, B.Y2);
    549.   Result := ((c / a) > 0.60);
    550. end;
    551.  
    552. function ValidTile(Slot: Int32): Boolean; overload;
    553. begin
    554.   if InRange(Slot, 0, 134) then Result := ValidTile(GetTile(Slot));
    555. end;
    556.  
    557. function GetAdjacentTileSlots(const Tile: Int32): TIntegerArray;
    558. var
    559.   Row, Col: Int32;
    560. begin
    561.   if (not InRange(Tile, 0, 134)) then
    562.   begin
    563.     WriteLn('GetAdjacentTileSlots: tile not in range');
    564.     Exit;
    565.   end;
    566.   Col := GetTileCol(Tile);
    567.   Row := GetTileRow(Tile);
    568.  
    569.   if InRange(Col, 0, 13) then Result := Result + (Tile + 1);
    570.   if InRange(Col, 1, 14) then Result := Result + (Tile - 1);
    571.  
    572.   if InRange(Row, 0, 7) then Result := Result + (Tile + 15);
    573.   if InRange(Row, 1, 8) then Result := Result + (Tile - 15);
    574. end;
    575.  
    576. function GetAdjacentTileBoxes(const Tile: Int32): TBoxArray;
    577. var
    578.   i: Int32;
    579.   Tiles: TIntegerArray;
    580. begin
    581.   Tiles := GetAdjacentTileSlots(Tile);
    582.   if (Length(Tiles) < 1) then Exit;
    583.   SetLength(Result, Length(Tiles));
    584.   for i := 0 to High(Tiles) do Result[i] := GetTile(Tiles[i]);
    585. end;
    586.  
    587. function GetWalkableTileSlots(): TIntegerArray;
    588. var
    589.   i, j, h: Int32;
    590.   TileSlots, IgnoreSlots: TIntegerArray;
    591. begin
    592.   TileSlots := GetAdjacentTileSlots(PLAYER_TILE);
    593.   if (Length(TileSlots) < 1) then Exit;
    594.  
    595.   for j := 0 to High(TileSlots) do
    596.     if (ValidTile(TileSlots[j]) and (not OccupiedTile(TileSlots[j]))) then
    597.       Result := Result + TileSlots[j] else
    598.       IgnoreSlots := IgnoreSlots + TileSlots[j];
    599.  
    600.   if (Length(Result) < 1) then
    601.   begin
    602.     WriteLn('GetWalkableTileSlots: no walkable tiles found adjacent to player.');
    603.     Wait(567, 765);
    604.     Exit;
    605.   end;
    606.  
    607.   IgnoreSlots := IgnoreSlots + PLAYER_TILE;
    608.  
    609.   h := High(Result);
    610.   for i := 0 to h do
    611.   begin
    612.     TileSlots := GetAdjacentTileSlots(Result[i]);
    613.     if (Length(TileSlots) < 1) then Continue;
    614.     for j := 0 to High(TileSlots) do
    615.     begin
    616.       if InIntArray(CombineIntArray(Result, IgnoreSlots), TileSlots[j]) then
    617.         Continue;
    618.       for j := 0 to High(TileSlots) do
    619.         if (ValidTile(TileSlots[j]) and (not OccupiedTile(TileSlots[j]))) then
    620.           Result := Result + TileSlots[j] else
    621.           IgnoreSlots := IgnoreSlots + TileSlots[j];
    622.       h := High(Result);
    623.     end;
    624.   end;
    625.   {$IFDEF LAYER} DrawBoxes(ShrinkBoxes(GetTiles(Result), 1), VALID_TILE_COLOR, False, False); {$ENDIF LAYER}
    626. end;
    627.  
    628. function GetWalkableTileBoxes(): TBoxArray;
    629. var
    630.   i: Int32;
    631.   Slots: TIntegerArray;
    632. begin
    633.   Slots := GetWalkableTileSlots();
    634.   if (Length(Slots) < 1) then Exit;
    635.   SetLength(Result, Length(Slots));
    636.   for i := 0 to High(Result) do Result[i] := GetTile(Slots[i]);
    637. end;
    638.  
    639. procedure RandomWalk();
    640. var
    641.   r: Int32;
    642.   Tiles: TIntegerArray;
    643. begin
    644.   Tiles := GetWalkableTileSlots();
    645.   if (Length(Tiles) < 1) then Exit;
    646.   r := Tiles[Random(High(Tiles))];
    647.   {$IFDEF LAYER} DrawBoxes([GetTile(r)], VALID_TILE_COLOR, True, False); {$ENDIF LAYER}
    648.   ClickTile(r);
    649.   WalkWait(r);
    650. end;
    651.  
    652. //SETUP
    653. function GetDirectionTile(): Int32;
    654. var
    655.   i, n: Int32;
    656.   tt, ValidTiles: TIntegerArray;
    657. begin
    658.   Result := -1;
    659.   ValidTiles := GetWalkableTileSlots();
    660.   if (Length(ValidTiles) < 1) then Exit;
    661.   repeat
    662.     case _d of
    663. {N}   1: tt := [7, 6, 8, 5, 9, 4, 10, 22, 23, 21, 24, 20, 25, 19, 26, 18, 27, 17, 28, 16];
    664. {E}   2: tt := [73, 88, 58, 103, 42, 118, 28];
    665. {S}   3: tt := [127, 126, 128, 125, 129, 124, 130, 112, 113, 111, 114, 110, 115, 109, 116, 108, 117, 107, 118, 106];
    666. {W}   4: tt := [61, 76, 46, 91, 31, 106, 16];
    667.     end;
    668.     for i := 0 to High(tt) do if InIntArray(ValidTiles, tt[i]) then Exit(tt[i]);
    669.     _d := (_d mod 4) + 1;
    670.     Inc(n);
    671.   until (n > 4);
    672. end;
    673.  
    674. function SlotFromCR(const Col, Row: Int32): Int32;
    675. begin
    676.   Result := (Row * 15) + Col;
    677. end;
    678.  
    679. function GetTileTPA(const c1, r1, c2, r2: Int32): TPointArray;
    680. var
    681.   minR, minC, maxR, maxC, n, i, j: Int32;
    682. begin
    683.   minR := min(r1, r2); maxR := max(r1, r2);
    684.   minC := min(c1, c2); maxC := max(c1, c2);
    685.   SetLength(Result, (maxR-minR+1)*(maxC-minC+1));
    686.   for i := minC to maxC do
    687.   begin
    688.     for j := minR to maxR do
    689.     begin
    690.       Result[n] := [i, j];
    691.       Inc(n);
    692.     end;
    693.   end;
    694. end;
    695.  
    696. function GetTileTPA(const t1, t2: Int32): TPointArray; overload;
    697. begin
    698.   Result := GetTileTPA(GetTileCol(t1), GetTileRow(t1), GetTileCol(t2), GetTileRow(t2));
    699. end;
    700.  
    701. function GetValidTileNear(const Slot: Int32): Int32;
    702. var
    703.   i, x, y: Int32;
    704.   B: TBox;
    705.   Tiles: TPointArray;
    706. begin
    707.   Tiles := GetTileTPA(PLAYER_TILE, Slot);
    708.   SortTPAFrom(Tiles, [GetTileCol(Slot), GetTileRow(Slot)]);
    709.   for i := 0 to High(Tiles) do
    710.   begin
    711.     B := GetTile(SlotFromCR(Tiles[i].x, Tiles[i].y));
    712.     B.Shrink(4);
    713.     if (ValidTile(SlotFromCR(Tiles[i].x, Tiles[i].y)) and
    714.         (not FindColor(x, y, RED_SQUARE, B.X1, B.Y1, B.X2, B.Y2))) then
    715.       Exit(SlotFromCR(Tiles[i].x, Tiles[i].y));
    716.   end;
    717. end;
    718.  
    719. function GetHpBarTPA(): TPointArray;
    720. var
    721.   TPA, TPA2: TPointArray;
    722. begin
    723.   FindColors(TPA, HP_GREEN, MSX1, MSY1, MSX2, MSY2);
    724.   //if FindColors(TPA2, HP_YELLOW, MSX1, MSY1, MSX2, MSY2) then TPA := CombineTPA(TPA, TPA2); //
    725.   if FindColors(TPA2, HP_GRAY, MSX1, MSY1, MSX2, MSY2) then TPA := CombineTPA(TPA, TPA2);
    726.   if FindColors(TPA2, RED_SQUARE, MSX1, MSY1, MSX2, MSY2) then TPA := CombineTPA(TPA, TPA2);
    727.   ExcludePointsBox(TPA, [375, 240, 425, 250]);
    728.   if (Length(TPA) < 1) then Exit;
    729.   Result := CopyTPA(TPA);
    730. end;
    731.  
    732. function GetHpBarATPA(): T2DPointArray;
    733. var
    734.   i: Int32;
    735.   B: TBox;
    736.   Temp: T2DPointArray;
    737. begin
    738.   Temp := ClusterTPA(GetHpBarTPA, 1);
    739.   FilterTPAsBetween(Temp, 250, 9000);
    740.   FilterTPAsBetween(Temp, 0, 50);
    741.   if (Length(Temp) < 1) then Exit;
    742.   for i := 0 to High(Temp) do
    743.   begin
    744.     B := GetTPABounds(Temp[i]);
    745.     if (InRange(B.Y2 - B.Y1, 3, 6) and InRange(B.X2 - B.X1, 40, 50)) then Result := Result + Temp[i];
    746.   end;
    747. end;
    748.  
    749. function GetPlayerTileSlots(const ATPA: T2DPointArray): TIntegerArray;
    750. var
    751.   i, Tile: Int32;
    752.   P: TPoint;
    753.   B: TBox;
    754. begin
    755.   for i := 0 to High(ATPA) do
    756.   begin
    757.     B := GetTPABounds(ATPA[i]);
    758.     if ((CountColor(TEXT_BLUE, B.X1, B.Y1 - 12, B.X2, B.Y2) +
    759.          CountColor(TEXT_GREEN, B.X1, B.Y1 - 12, B.X2, B.Y2) +
    760.          CountColor(TEXT_RED, B.X1, B.Y1 - 12, B.X2, B.Y2)) > 70) then
    761.     begin
    762.       P := MiddleTPA(ATPA[i]);
    763.       P.Y += 10;
    764.       Tile := PointToTile(P);
    765.       if (InRange(Tile, 0, 134) and (Tile <> PLAYER_TILE)) then Result := Result + Tile;
    766.     end;
    767.   end;
    768. end;
    769.  
    770. function GetPlayerTileBoxes(const ATPA: T2DPointArray): TBoxArray;
    771. var
    772.   i: Int32;
    773.   Tiles: TIntegerArray;
    774. begin
    775.   Tiles := GetPlayerTileSlots(ATPA);
    776.   if (Length(Tiles) < 1) then Exit;
    777.   SetLength(Result, Length(Tiles));
    778.   for i := 0 to High(Tiles) do Result[i] := GetTile(Tiles[i]);
    779. end;
    780.  
    781. function GetNPCTileSlots(const ATPA: T2DPointArray): TIntegerArray;
    782. var
    783.   i, j, Tile: Int32;
    784.   ValidTiles, AdjTiles, PlayerTiles: TIntegerArray;
    785.   P: TPoint;
    786.   B: TBox;
    787. begin
    788.   PlayerTiles := GetAdjacentTileSlots(PLAYER_TILE);
    789.   //ValidTiles := GetWalkableTileSlots();
    790.   for i := 0 to High(ATPA) do
    791.   begin
    792.     B := GetTPABounds(ATPA[i]);
    793.     if ((CountColor(TEXT_WHITE, B.X1, B.Y1 - 12, B.X2, B.Y2) +
    794.          CountColor(TEXT_YELLOW, B.X1, B.Y1 - 12, B.X2, B.Y2)) > 70) then
    795.     begin
    796.       P := MiddleTPA(ATPA[i]);
    797.       P.Y += 25;
    798.       Tile := PointToTile(P);
    799.       if InRange(Tile, 0, 134) then
    800.       begin
    801.         if InIntArray(PlayerTiles, Tile) then
    802.         begin
    803.           Result := Result + Tile;
    804.         end else
    805.         begin
    806.           if ValidTileColor(Tile) then
    807.             Result := Result + Tile;
    808.         end;
    809.       end;
    810.     end;
    811.   end;
    812. end;
    813.  
    814. function GetNPCTileBoxes(const ATPA: T2DPointArray): TBoxArray;
    815. var
    816.   i: Int32;
    817.   Tiles: TIntegerArray;
    818. begin
    819.   Tiles := GetNPCTileSlots(ATPA);
    820.   if (Length(Tiles) < 1) then Exit;
    821.   SetLength(Result, Length(Tiles));
    822.   for i := 0 to High(Tiles) do Result[i] := GetTile(Tiles[i]);
    823. end;
    824.  
    825. function ClickClosestNPC(): Boolean;
    826. var
    827.   i: Int32;
    828.   NPCs, Players, Exclude: TIntegerArray;
    829.   ATPA: T2DPointArray;
    830.   bb: TBoxArray;
    831. begin
    832.   ATPA := GetHpBarATPA();
    833.   if (Length(ATPA) < 1) then Exit;
    834.   SortATPAFromMidPoint(ATPA, PLAYER_POINT);
    835.   NPCs := GetNPCTileSlots(ATPA);
    836.   if (Length(NPCs) < 1) then Exit;
    837.   {$IFDEF LAYER} DrawBoxes(GetTiles(NPCs), NPC_COLOR, False, False); {$ENDIF LAYER}
    838.   Players := GetPlayerTileSlots(ATPA);
    839.   if (Length(Players) > 0) then
    840.   begin
    841.     {$IFDEF LAYER} DrawBoxes(GetTiles(Players), PLAYER_COLOR, False, False); {$ENDIF LAYER}
    842.     Exclude := CombineIntArray(Exclude, Players);
    843.     for i := 0 to High(Players) do Exclude := CombineIntArray(Exclude, GetAdjacentTileSlots(Players[i]));
    844.     ClearSameIntegers(Exclude);
    845.   end else Exclude := Exclude + PLAYER_TILE;
    846.  
    847.   for i := 0 to High(NPCs) do
    848.   begin
    849.     if InIntArray(Exclude, NPCs[i]) then Continue;
    850.     ClickTile(NPCs[i]);
    851.     {$IFDEF LAYER} DrawBoxes([GetTile(NPCs[i])], NPC_COLOR, True, False); {$ENDIF LAYER}
    852.     if IsMelee() then WalkWait(NPCs[i]);
    853.     Exit(True);
    854.   end;
    855. end;
    856.  
    857. function GetManaPercent(): Int32;
    858. var
    859.   TPA: TPointArray;
    860. begin
    861.   Result := 100 * CountColor(MANA_BLUE, 4, 55, 250, 61) div 1470;
    862. end;
    863.  
    864. function HasArrows(): Boolean;
    865. begin
    866.   Result := (CountColor(TEXT_WHITE, 675, 485, 692, _h-1) > 44);
    867. end;
    868.  
    869. function FollowDirections(): Boolean;
    870. var
    871.   t: Int32;
    872. begin
    873.   t := GetDirectionTile();
    874.   if (t < 0) then Exit(False);
    875.   {$IFDEF LAYER} DrawBoxes([GetTile(t)], VALID_TILE_COLOR, True, False); {$ENDIF LAYER}
    876.   ClickTile(t);
    877.   WalkWait(t);
    878.   Exit(True);
    879. end;
    880.  
    881. function IsTraining(): Boolean;
    882. begin
    883.   Result := (CountColor(TEXT_RED, 257, 357, 542, 375) > 1000);
    884. end;
    885.  
    886. function HasMPot(): Boolean;
    887. begin
    888.   Result := (CountColor(8871435, 25, 414, 50, 430) > 9);
    889. end;
    890.  
    891. procedure ClickMPot();
    892. begin
    893.   MouseBox(MANA_POT_BOX);
    894. end;
    895.  
    896. procedure Mainloop();
    897. var
    898.   TempTile, t: Int32;
    899. begin
    900.   if IsDisconnected() then
    901.   begin
    902.     WriteLn('Disconnected');
    903.     TerminateScript();
    904.   end;
    905.   {$IFDEF LAYER} DrawClear(); {$ENDIF LAYER}
    906.   while InCombat(TempTile) do
    907.   begin
    908.     if (IsMagic() or IsRange()) then
    909.     begin
    910.       if (not IsInRange(TempTile)) then
    911.       begin
    912.         t := GetValidTileNear(TempTile);
    913.         ClickTile(t);
    914.         WalkWait(t);
    915.       end;
    916.     end else if ((TileDist(PLAYER_TILE, TempTile) > 1) and (not IsWalking())) then
    917.     begin
    918.       if ClickClosestNPC() then Wait(345, 456);
    919.     end;
    920.     Loot();
    921.     Wait(444, 666);
    922.   end;
    923.  
    924.   if (MAGIC and (GetManaPercent() > 20)) then
    925.   begin
    926.     if (not IsMagic()) then ClickMagic;
    927.   end else
    928.   if (RANGE and HasArrows()) then
    929.   begin
    930.     if (not IsRange()) then ClickRange();
    931.   end else
    932.   if (not IsMelee()) then ClickMelee();
    933.  
    934.   if (MAGIC and (GetManaPercent() < 50) and HasMPot()) then ClickMPot();
    935.  
    936.   while IsTraining() do
    937.   begin
    938.     {$IFDEF LAYER} Layer.Bitmap.DrawSystemText('TRAINING', 'Arial', 20, [344, 30], False, $0000FF); {$ENDIF LAYER}
    939.     FollowDirections();
    940.     Wait(234, 345);
    941.   end;
    942.  
    943.   if Close() then Wait(345, 456);
    944.   if Loot() then Wait(345, 456);
    945.  
    946.   if ((not IsTraining()) and ClickClosestNPC()) then
    947.   begin
    948.     Wait(567, 876);
    949.   end else if (not FollowDirections()) then RandomWalk();
    950.  
    951.   Wait(121, 212);
    952. end;
    953.  
    954. begin
    955.   ClearDebug();
    956.   GetAndSet();
    957.   while True do Mainloop();
    958. end.
    tap.zip
    Last edited by Citrus; 03-31-2018 at 07:47 AM. Reason: 3/14/18 libLayer

  2. #2
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    It clicks on NPCs. It will randomly walk to tiles of colors listed in tile_colors (line 8), so edit that to suit your needs.
    Written for NoxPlayer 480x800. Turn all config settings off.
    Melee only. Limited looting. Doesn't use pots or skills.
    If you want more features then add them yourself.

    Simba Code:
    1. program citrus_rucoy;
    2. //nox 480x800 directX 30 fps
    3. //turn all config settings off
    4. const
    5.   tile_brown = 2504765;
    6.   tile_green = 4757576;
    7.   tile_sand = 10076395;
    8.   tile_colors: TIntegerArray = [tile_brown, tile_green, tile_sand]; //edit to your liking
    9.   npc_text = 15987699;
    10.   red_square = 3289807;
    11.   loot_hand = 4168184;
    12.   hp_green = 4897310;
    13.   hp_yellow = 65514;
    14.   hp_gray = 6908265;
    15.   close_light_gray = 13224393;
    16.   player_point: TPoint = [400, 284];
    17.   mouse_move = 3;
    18.  
    19. var
    20.   _w, _h: integer;
    21.  
    22. procedure mouse(pnt: TPoint; button: integer);
    23. var
    24.   x, y: integer;
    25. begin
    26.   moveMouse(pnt.x, pnt.y);
    27.   if (button = MOUSE_MOVE) then exit();
    28.   wait(9 + random(9));
    29.   holdMouse(pnt.x, pnt.y, button); wait(69 + random(22, 69));
    30.   getMousePos(x, y);
    31.   releaseMouse(x, y, button);
    32. end;
    33.  
    34. procedure getAndSet();
    35. var
    36.   pp: TSysProcArr;
    37.   i: integer;
    38. begin
    39.   pp := client.getIOManager.getProcesses;
    40.   for i := 0 to high(pp) do
    41.     if pos('NoxPlayer', pp[i].title) then
    42.     begin
    43.       setTarget(pp[i]);
    44.       getClientDimensions(_w, _h);
    45.       exit();
    46.     end;
    47.   writeln('game not found');
    48.   terminateScript();
    49. end;
    50.  
    51. function gridBox(slot, columns, rows, w, h, diffX, diffY: integer; startPoint: TPoint): TBox; //srl6
    52. begin
    53.   if (slot > (columns * rows)) then exit;
    54.   result.x1 := (startPoint.x + ((slot mod columns) * diffX) - (w div 2));
    55.   result.y1 := (startPoint.y + ((slot div columns) * diffY) - (h div 2));
    56.   result.x2 := (result.x1 + w);
    57.   result.y2 := (result.y1 + h);
    58. end;
    59.  
    60. function grid(columns, rows, w, h, diffX, diffY: integer; starTPoint: TPoint): TBoxArray; //srl6
    61. var
    62.   i: integer;
    63. begin
    64.   setLength(result, (columns * rows));
    65.   for i := 0 to high(result) do result[i] := gridBox(i, columns, rows, w, h, diffX, diffY, starTPoint);
    66. end;
    67.  
    68. procedure TPointArray.filterPointsBox(b: TBox);
    69. var
    70.   i: integer;
    71.   temp: TPointArray;
    72. begin
    73.   for i := 0 to high(self) do if (not pointInBox(self[i], b)) then temp := temp + self[i];
    74.   self := temp;
    75. end;
    76.  
    77. function getTiles(): TBoxArray;
    78. begin
    79.   result := grid(15, 9, 50, 50, 50, 50, [50, 74]);
    80. end;
    81.  
    82. function inIntArrayI(const tia: TIntegerArray; num: integer): integer;
    83. var
    84.   i: integer;
    85. begin
    86.   result := -1;
    87.   for i := 0 to high(tia) do if (tia[i] = num) then exit(i);
    88. end;
    89.  
    90. function maxAI(tia: TIntegerArray): integer;
    91. var
    92.   i, max: integer;
    93. begin
    94.   max := -999999;
    95.   for i := 0 to high(tia) do
    96.     if (tia[i] > result) then
    97.     begin
    98.       result := i;
    99.       max := tia[i];
    100.     end;
    101. end;
    102.  
    103. function getTileColor(): integer;
    104. var
    105.   i, c, n: integer;
    106.   nn: TIntegerArray;
    107.   p: TPoint;
    108.   bb: TBoxArray;
    109. begin
    110.   bb := getTiles();
    111.   setLength(nn, length(tile_colors));
    112.   for i := 0 to high(bb) do
    113.   begin
    114.     p := middleBox(bb[i]);
    115.     c := getColor(p.x, p.y);
    116.     n := inIntArrayI(tile_colors, c);
    117.     if (n > -1) then inc(nn[n]);
    118.   end;
    119.   result := tile_colors[maxAI(nn)];
    120. end;
    121.  
    122. function clickClosestNPC(): boolean;
    123. var
    124.   i: integer;
    125.   b: TBox;
    126.   p: TPoint;
    127.   tpa, tpa2: TPointArray;
    128.   atpa, temp: T2DPointArray;
    129. begin
    130.   if findColors(tpa, hp_green, 0, 0, _w-1, _h-1) then
    131.   begin
    132.     if findColors(tpa2, hp_yellow, 0, 0, _w-1, _h-1) then tpa := combineTPA(tpa, tpa2);
    133.     if findColors(tpa2, hp_gray, 0, 0, _w-1, _h-1) then tpa := combineTPA(tpa, tpa2);
    134.     tpa.filterPointsBox([375, 240, 425, 250]);
    135.     atpa := clusterTPA(tpa, 1);
    136.     filterTPAsBetween(atpa, 200, 9000);
    137.     filterTPAsBetween(atpa, 0, 50);
    138.     for i := 0 to high(atpa) do
    139.     begin
    140.       b := getTPABounds(atpa[i]);
    141.       if ((b.y2-b.y1) = 2) then if (countColor(npc_text, b.x1, b.y1-10, b.x2, b.y2) > 22) then temp := temp + atpa[i];
    142.     end;
    143.     if length(temp) > 0 then
    144.     begin
    145.       sortATPAFromMidPoint(temp, player_point);
    146.       p := middleTPA(temp[0]);
    147.       p.y := min(p.y + random(25), _h-7);
    148.       mouse(p, mouse_left);
    149.       exit(true);
    150.     end;
    151.   end;
    152. end;
    153.  
    154. function inCombat(): boolean;
    155. var
    156.   tpa: TPointArray;
    157. begin
    158.   if findColors(tpa, red_square, 0, 0, _w-1, _h-1) then
    159.   begin
    160.     tpa.filterPointsBox([0, 0, 255, 75]);
    161.     tpa.filterPointsBox([0, 285, 75, _h-1]);
    162.     result := (length(tpa) > 144);
    163.   end;
    164. end;
    165.  
    166. function loot(): boolean;
    167. begin
    168.   if (countColor(loot_hand, 745, 150, _w-1, 200) > 444) then
    169.   begin
    170.     mouse([775, 175], mouse_left);
    171.     exit(true);
    172.   end;
    173. end;
    174.  
    175. function close(): boolean;
    176. begin
    177.   if inRange(countColor(close_light_gray, 745, 35, _w-1, 85), 333, 369) then
    178.   begin
    179.     mouse([769, 54], mouse_left);
    180.     exit(true);
    181.   end;
    182. end;
    183.  
    184. function isWalking(): boolean
    185. var
    186.   bmp1, bmp2: integer;
    187. begin
    188.   bmp1 := bitmapFromClient(0, 0, _w-1, _h-1);
    189.   wait(69);
    190.   bmp2 := bitmapFromClient(0, 0, _w-1, _h-1);
    191.   result := (calculatePixelShift(bmp1, bmp2, [0, 0, _w-1, _h-1]) > 45678);
    192.   freeBitmap(bmp1);
    193.   freeBitmap(bmp2);
    194. end;
    195.  
    196. procedure randomWalk();
    197. var
    198.   i, j: integer;
    199.   valid, cc: TIntegerArray;
    200.   tiles: TBoxArray;
    201. begin
    202.   tiles := getTiles();
    203.   setLength(cc, length(tiles));
    204.   for i := 0 to high(tiles) do
    205.   begin
    206.     for j := 0 to high(tile_colors) do cc[i] += countColor(tile_colors[j], tiles[i].x1, tiles[i].y1, tiles[i].x2, tiles[i].y2);
    207.     if (cc[i] > 888) then valid := valid + i;
    208.   end;
    209.   if (length(valid) < 1) then exit();
    210.   mouse(middleBox(tiles[valid[random(length(valid))]]), mouse_left);
    211.   wait(345);
    212.   while isWalking() do wait(234);
    213. end;
    214.  
    215. procedure mainloop();
    216. begin
    217.   if isKeyDown(27) then terminateScript;
    218.   while inCombat() do wait(121);
    219.   if close() then wait(234);
    220.   if loot() then wait(234);
    221.   if (not clickClosestNPC()) then randomWalk() else while isWalking() do wait(121);
    222.   wait(121);
    223. end;
    224.  
    225. begin
    226.   clearDebug();
    227.   getAndSet();
    228.   while true do mainloop();
    229. end.
    Love the way you detect if you're in combat or not. It's so simple, yet I couldn't think of it

  3. #3
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by Aspect View Post
    Love the way you detect if you're in combat or not. It's so simple, yet I couldn't think of it
    Well, it breaks if someone with red clothes is on screen, so don't feel too bad

  4. #4
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Update 6/6/2017: haven't touched the game in weeks, so I posted my full script. Have fun!

  5. #5
    Join Date
    Jun 2017
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    Update 6/6/2017: haven't touched the game in weeks, so I posted my full script. Have fun!
    Hey mate, how you doing?
    i'm trying to use your rucoy bot but when i start the bot nothing happens ingame.


    Any idea?

  6. #6
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by guigodoi View Post
    Hey mate, how you doing?
    i'm trying to use your rucoy bot but when i start the bot nothing happens ingame.


    Any idea?
    It attacks and moves based on the tiles that you specify. I'm guessing you didn't do that step of the setup.

  7. #7
    Join Date
    Jun 2017
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    In which code line do I specify where to walk and attack?

  8. #8
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by guigodoi View Post
    In which code line do I specify where to walk and attack?
    The 'tile_colors' constant at line 22.

  9. #9
    Join Date
    Feb 2012
    Location
    Norway
    Posts
    995
    Mentioned
    145 Post(s)
    Quoted
    596 Post(s)

    Default

    @Citrus; psst.. Check out your maxAI function

    Can you see it?:
    Simba Code:
    function maxAI(tia: TIntegerArray): integer;
    var
      i, max: integer;
    begin
      max := -999999;
      for i := 0 to high(tia) do
        if (tia[i] > result) then
        begin
          result := i;
          max := tia[i];
        end;
    end;
    Last edited by slacky; 06-19-2017 at 07:08 AM.
    !No priv. messages please

  10. #10
    Join Date
    Jun 2017
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    I tried to add some monster colors in this line but nothing happens. i'm really bad at coding :/
    Can you send me a example of how it has to be for any monster?

  11. #11
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by guigodoi View Post
    I tried to add some monster colors in this line but nothing happens. i'm really bad at coding :/
    Can you send me a example of how it has to be for any monster?
    There are no monster colors in this script. It uses the tile colors. You need to comment out any tile colors that you don't want to use. e.g. if you're killing things in the desert, you should comment out every tile color except 'tile_sand'. In the OP, the script is set up for vampires (tile_stone_blue).

    @slacky you saw nothing... getTileColor isn't even used
    Last edited by Citrus; 06-19-2017 at 01:35 PM.

  12. #12
    Join Date
    Jun 2017
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Nice, got it! i set up tile_brown for mummies and it's walking arround but not killing monsters. Actually it ramdonly kill some mobs but most of time just get trapped by them and i have to manually kill.

  13. #13
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by guigodoi View Post
    Nice, got it! i set up tile_brown for mummies and it's walking arround but not killing monsters. Actually it ramdonly kill some mobs but most of time just get trapped by them and i have to manually kill.
    Hard to diagnose without knowing your setup. You're using the correct resolution and have blood, etc. turned off in the settings? Maybe post a screenshot of your setup.

  14. #14
    Join Date
    Jun 2017
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Have to do one more post to be able to post a image lol

  15. #15
    Join Date
    Jun 2017
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    i'm using the correct resolution without blood effect.

    https://gyazo.com/fd4944ec28a426defc06bf251da7e6aa

    Just changed tile_stone_blue for tile_brown.

  16. #16
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by guigodoi View Post
    Have to do one more post to be able to post a image lol
    There is also a Discord for Rucoy stuff: https://villavu.com/forum/showthread.php?t=117547

    It helps if you either mention me or reply to one of my earlier posts when you post on this thread. That way I'll get a notification and will be more likely to see it.

  17. #17
    Join Date
    Jun 2017
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    NoxPlayer custom size: 798x482

    Simple setup. Kills and walks around based on the tile colors you enable. Turn off all the settings in the Rucoy menu (e.g. blood).
    You will need to drop the 'tap.dll' file into your Simba/Plugins folder. This is what lets the script run without using your mouse.

    Simba Code:
    1. program rucoy;
    2. {$loadlib tap}
    3.  
    4. //noxplayer custom size: 798x482
    5. const
    6.   magic = false; //SETUP
    7.   range = false; //SETUP
    8.  
    9.   //add new tiles if you want
    10.   tile_brown      = 2504765;
    11.   tile_grass      = 4757576;
    12.   tile_sand       = 10076395;
    13.   tile_mud        = 2376788;
    14.   tile_grave_mud  = 1065293;
    15.   tile_grave      = 2843236;
    16.   tile_stone      = 5197647;
    17.   tile_stone_blue = 5785654;
    18.   tile_maze       = 3497525;
    19.   tile_maze_u     = 2500134;
    20.  
    21.   //SETUP
    22.   tile_colors: TIntegerArray = [tile_stone_blue{, tile_grave_mud, tile_maze, tile_brown, tile_grass, tile_sand, tile_mud, tile_grave, tile_stone, tile_maze_u}];
    23.  
    24.   player_tile = 67;
    25.   grid_point: TPoint = [52, 76];
    26.   msx1 = 27;
    27.   msy1 = 51;
    28.   msx2 = 777;
    29.   msy2 = 501;
    30.   msBox: TBox = [msx1, msy1, msx2, msy2];
    31.  
    32.   mana_blue       = 16563260;
    33.   text_white      = 15987699;
    34.   text_yellow     = 65514;
    35.   red_square      = 3289807;
    36.   text_red        = 4013567;
    37.   loot_hand       = 4168184;
    38.   hp_green        = 4897310;
    39.   hp_yellow       = 65514;
    40.   hp_gray         = 6908265;
    41.  
    42.   wand_brown = 28808;
    43.   close_light_gray = 13224393;
    44.   player_point: TPoint = [400, 284];
    45.  
    46. var
    47.   walkTimer: longword;
    48.   _w, _h, _hh, _d: integer;
    49.  
    50. procedure getAndSet();
    51. var
    52.   pp: TSysProcArr;
    53.   i, w, h: integer;
    54. begin
    55.   getClientDimensions(w, h);
    56.   pp := client.getIOManager.getProcesses;
    57.   for i := 0 to high(pp) do
    58.   begin
    59.     if pos('NoxPlayer', pp[i].title) then
    60.     begin
    61.       setTarget(pp[i]);
    62.       _hh := pp[i].handle;
    63.       getClientDimensions(_w, _h);
    64.       if ((w = _w) and (h = _h)) then
    65.       begin
    66.         writeln('Do not target the game directly!');
    67.         terminateScript;
    68.       end;
    69.       exit();
    70.     end;
    71.   end;
    72.   writeln('game not found');
    73.   terminateScript();
    74. end;
    75.  
    76. procedure mouse(pnt: TPoint; button: byte = 0);
    77. begin
    78.   tap(_hh, pnt, 44 + random(44));
    79. end;
    80.  
    81. procedure mouseBox(b: TBox; button: integer);
    82. begin
    83.   mouse(point(b.x1 + random(b.x2 - b.x1), b.y1 + random(b.y2 - b.y1)), button);
    84. end;
    85.  
    86. procedure TBox.edit(const x1_, y1_, x2_, y2_: integer);
    87. begin
    88.   self.x1 := self.x1 + x1_;
    89.   self.y1 := self.y1 + y1_;
    90.   self.x2 := self.x2 + x2_;
    91.   self.y2 := self.y2 + y2_;
    92. end;
    93.  
    94. procedure TBox.shrink(const size: integer);
    95. begin
    96.   self.edit(+size, +size, -size, -size);
    97. end;
    98.  
    99. procedure TBox.offset(const p: TPoint);
    100. begin
    101.   self.X1 := self.X1 + p.x;
    102.   self.X2 := self.X2 + p.x;
    103.   self.Y1 := self.Y1 + p.y;
    104.   self.Y2 := self.Y2 + p.y;
    105. end;
    106.  
    107. function gridBox(slot, columns, rows, w, h, diffX, diffY: integer; startPoint: TPoint): TBox;
    108. begin
    109.   if (slot > (columns * rows)) then
    110.   begin
    111.     writeln('gridBox: Invalid slot: '+toStr(slot));
    112.     exit;
    113.   end;
    114.  
    115.   result.x1 := (startPoint.x + ((slot mod columns) * diffX) - (w div 2));
    116.   result.y1 := (startPoint.y + ((slot div columns) * diffY) - (h div 2));
    117.   result.x2 := (result.x1 + w);
    118.   result.y2 := (result.y1 + h);
    119. end;
    120.  
    121. function grid(columns, rows, w, h, diffX, diffY: integer; starTPoint: TPoint): TBoxArray;
    122. var
    123.   i: integer;
    124. begin
    125.   setLength(result, (columns * rows));
    126.  
    127.   for i := 0 to high(result) do
    128.     result[i] := gridBox(i, columns, rows, w, h, diffX, diffY, starTPoint);
    129. end;
    130.  
    131. procedure TPointArray.filterPointsBox(b: TBox);
    132. var
    133.   i: integer;
    134.   temp: TPointArray;
    135. begin
    136.   for i := 0 to high(self) do
    137.     if (not pointInBox(self[i], b)) then
    138.       temp := temp + self[i];
    139.   self := temp;
    140. end;
    141.  
    142. function isMagic(): boolean;
    143. begin
    144.   result := (countColor(wand_brown, 745, 460, _w-1, _h-1) > 44);
    145. end;
    146.  
    147. function getTiles(): TBoxArray;
    148. begin
    149.   result := grid(15, 9, 50, 50, 50, 50, grid_point);
    150. end;
    151.  
    152. function getTile(slot: integer): TBox;
    153. begin
    154.   result := gridBox(slot, 15, 9, 50, 50, 50, 50, grid_point);
    155. end;
    156.  
    157. function playerBox(): TBox;
    158. begin
    159.   result := getTile(player_tile);
    160. end;
    161.  
    162. function pointToTile(p: TPoint): integer;
    163. var
    164.   i: integer;
    165.   bb: TBoxArray;
    166. begin
    167.   result := -1;
    168.   bb := getTiles();
    169.   for i := 0 to high(bb) do if pointInBox(p, bb[i]) then exit(i);
    170. end;
    171.  
    172. function getTileRow(slot: integer): integer;
    173. begin
    174.   result := slot div 15;
    175. end;
    176.  
    177. function getTileCol(slot: integer): integer;
    178. begin
    179.   result := slot mod 15;
    180. end;
    181.  
    182. function tileDist(t1, t2: integer): integer;
    183. var
    184.   r1, r2, c1, c2: integer;
    185. begin
    186.   r1 := getTileRow(t1);
    187.   r2 := getTileRow(t2);
    188.   c1 := getTileCol(t1);
    189.   c2 := getTileCol(t2);
    190.   result := max(r1, r2) - min(r1, r2) + max(c1, c2) - min(c1, c2);
    191. end;
    192.  
    193. function isInRange(t: integer): boolean;
    194. begin
    195.   result := (tileDist(player_tile, t) <= 4);
    196. end;
    197.  
    198. function inIntArrayI(const tia: TIntegerArray; num: integer): integer;
    199. var
    200.   i: integer;
    201. begin
    202.   result := -1;
    203.   if inIntArray(tia, num) then for i := 0 to high(tia) do if (tia[i] = num) then exit(i);
    204. end;
    205.  
    206. function maxAI(tia: TIntegerArray): integer;
    207. var
    208.   i, max: integer;
    209. begin
    210.   max := -999999;
    211.   for i := 0 to high(tia) do
    212.   begin
    213.     if (tia[i] > max) then
    214.     begin
    215.       result := i;
    216.       max := tia[i];
    217.     end;
    218.   end;
    219. end;
    220.  
    221. function getTileColor(): integer;
    222. var
    223.   i, c, n: integer;
    224.   nn: TIntegerArray;
    225.   p: TPoint;
    226.   bb: TBoxArray;
    227. begin
    228.   bb := getTiles();
    229.   setLength(nn, length(tile_colors));
    230.   for i := 0 to high(bb) do
    231.   begin
    232.     p := middleBox(bb[i]);
    233.     c := getColor(p.x, p.y);
    234.     n := inIntArrayI(tile_colors, c);
    235.     if (n > -1) then inc(nn[n]);
    236.   end;
    237.   result := tile_colors[maxAI(nn)];
    238. end;
    239.  
    240. procedure clickMelee();
    241. begin
    242.   mouse([775, 375], mouse_left);
    243. end;
    244.  
    245. procedure clickRange();
    246. begin
    247.   mouse([775, 435], mouse_left);
    248. end;
    249.  
    250. procedure clickMagic();
    251. begin
    252.   mouse([775, 485], mouse_left);
    253. end;
    254.  
    255. function clickClosestNPC(): boolean;
    256. var
    257.   i, j, x, y: integer;
    258.   b: TBox;
    259.   p: TPoint;
    260.   tpa, tpa2: TPointArray;
    261.   atpa, temp: T2DPointArray;
    262. begin
    263.   if findColors(tpa, hp_green, msx1, msy1, msx2, msy2) then
    264.   begin
    265.     if findColors(tpa2, hp_yellow, msx1, msy1, msx2, msy2) then tpa := combineTPA(tpa, tpa2);
    266.     if findColors(tpa2, hp_gray, msx1, msy1, msx2, msy2) then tpa := combineTPA(tpa, tpa2);
    267.     if findColors(tpa2, red_square, msx1, msy1, msx2, msy2) then tpa := combineTPA(tpa, tpa2);
    268.     tpa.filterPointsBox([375, 240, 425, 250]);
    269.     atpa := clusterTPA(tpa, 1);
    270.     filterTPAsBetween(atpa, 222, 9000);
    271.     filterTPAsBetween(atpa, 0, 50);
    272.     for i := 0 to high(atpa) do
    273.     begin
    274.       b := getTPABounds(atpa[i]);
    275.       b.edit(+4, 0, -4, 0);
    276.       if (b.x1 >= b.x2) then continue();
    277.       if (inRange((b.y2-b.y1), 2, 5)) then
    278.         if ((countColor(text_white, b.x1, b.y1-12, b.x2, b.y2) > 88) or
    279.             (countColor(text_yellow, b.x1, b.y1-12, b.x2, b.y2) > 88)) then
    280.           temp := temp + atpa[i];
    281.     end;
    282.     if (length(temp) > 0) then
    283.     begin
    284.       sortATPAFromMidPoint(temp, player_point);
    285.       for i := 0 to high(temp) do
    286.       begin
    287.         p := middleTPA(temp[0]);
    288.         b := getTile(pointToTile(p));
    289.         for j := 0 to high(tile_colors) do
    290.         begin
    291.           if findColor(x, y, tile_colors[j], b.x1, b.y1, b.x2, b.y2) then
    292.           begin
    293.             p.y := min(p.y + random(10, 25), _h-7);
    294.             p.x := p.x + random(-10, 10);
    295.             mouse(p, mouse_left); wait(345);
    296.             exit(true);
    297.           end;
    298.         end;
    299.       end;
    300.     end;
    301.   end;
    302. end;
    303.  
    304. function inCombat(out tile: integer): boolean;
    305. var
    306.   i: integer;
    307.   p: TPoint;
    308.   b: TBox;
    309.   tpa: TPointArray;
    310.   atpa, temp: T2DPointArray;
    311. begin
    312.   if findColors(tpa, red_square, msx1, msy1, msx2, msy2) then
    313.   begin
    314.     tpa.filterPointsBox([0, 0, 255, 75]);
    315.     tpa.filterPointsBox([0, 285, 75, _h-1]);
    316.     atpa := clusterTPA(tpa, 15);
    317.     filterTPAsBetween(atpa, 0, 50);
    318.     for i := 0 to high(atpa) do
    319.     begin
    320.       p := middleTPA(atpa[i]);
    321.       tile := pointToTile(p);
    322.       b := [p.x, p.y, p.x, p.y];
    323.       b.shrink(-20);
    324.       atpa[i].filterPointsBox(b);
    325.       if (length(atpa[i]) > 111) then exit(true);
    326.     end;
    327.   end;
    328. end;
    329.  
    330. function loot(): boolean;
    331. begin
    332.   if (countColor(loot_hand, 745, 150, _w-1, 200) > 444) then
    333.   begin
    334.     mouse([775, 175], mouse_left);
    335.     wait(1);
    336.     mouse([774, 174], mouse_left);
    337.     exit(true);
    338.   end;
    339. end;
    340.  
    341. function close(): boolean;
    342. begin
    343.   if inRange(countColor(close_light_gray, 745, 35, _w-1, 85), 333, 444) then
    344.   begin
    345.     mouse([777, 77], mouse_left);
    346.     exit(true);
    347.   end;
    348. end;
    349.  
    350. function isWalking(): boolean
    351. var
    352.   i, bmp1, bmp2: integer;
    353. begin
    354.   bmp1 := bitmapFromClient(0, 0, _w-1, _h-1);
    355.   wait(122);
    356.   bmp2 := bitmapFromClient(0, 0, _w-1, _h-1);
    357.   result := (calculatePixelShift(bmp1, bmp2, [0, 0, _w-1, _h-1]) > 12345);
    358.   freeBitmap(bmp1);
    359.   freeBitmap(bmp2);
    360. end;
    361.  
    362. function isMelee(): boolean;
    363. begin
    364.   result := (countColor(13417668, 750, 350, _w-1, _h-1) = 22);
    365. end;
    366.  
    367. function isRange(): boolean;
    368. begin
    369.   result := (countColor(13092807, 750, 350, _w-1, _h-1) = 50);
    370. end;
    371.  
    372. function validTile(const b: TBox): boolean;
    373. var
    374.   i, c: integer;
    375. begin
    376.   for i := 0 to high(tile_colors) do c += countColor(tile_colors[i], b.x1, b.y1, b.x2, b.y2);
    377.   result := (c > 1369);
    378. end;
    379.  
    380. function validTile(slot: integer): boolean; overload;
    381. var
    382.   b: TBox;
    383. begin
    384.   b := getTile(slot);
    385.   result := validTile(b);
    386. end;
    387.  
    388. //SETUP
    389. function getDirectionTile(): integer;
    390. var
    391.   i, n: integer;
    392.   tt: TIntegerArray;
    393. begin
    394.   result := -1;
    395.   repeat
    396.     case _d of
    397.       1: tt := [22, 23, 21, 24, 20, 25, 19, 26, 18, 27, 17, 28, 16];              // north
    398.       2: tt := [73, 88, 58, 103, 42, 118, 28];                                    // east
    399.       3: tt := [112, 113, 111, 114, 110, 115, 109, 116, 108, 117, 107, 118, 106]; // south
    400.       4: tt := [61, 76, 46, 91, 31, 106, 16];                                     // west
    401.     end;
    402.     for i := 0 to high(tt) do if validTile(tt[i]) then exit(tt[i]);
    403.     _d := (_d mod 4) + 1;
    404.     inc(n);
    405.   until (n > 4);
    406. end;
    407.  
    408. function slotFromCR(const col, row: integer): integer;
    409. begin
    410.   result := (row * 15) + col;
    411. end;
    412.  
    413. function getTileTPA(const c1, r1, c2, r2: integer): TPointArray;
    414. var
    415.   minR, minC, maxR, maxC, n, i, j: integer;
    416. begin
    417.   minR := min(r1, r2); maxR := max(r1, r2);
    418.   minC := min(c1, c2); maxC := max(c1, c2);
    419.   setLength(result, (maxR-minR+1)*(maxC-minC+1));
    420.   for i := minC to maxC do
    421.   begin
    422.     for j := minR to maxR do
    423.     begin
    424.       result[n] := [i, j];
    425.       inc(n);
    426.     end;
    427.   end;
    428. end;
    429.  
    430. function getTileTPA(const t1, t2: integer): TPointArray; overload;
    431. begin
    432.   result := getTileTPA(getTileCol(t1), getTileRow(t1), getTileCol(t2), getTileRow(t2));
    433. end;
    434.  
    435. function getValidTileNear(const slot: integer): integer;
    436. var
    437.   i: integer;
    438.   tiles: TPointArray;
    439. begin
    440.   tiles := getTileTPA(player_tile, slot);
    441.   sortTPAFrom(tiles, [getTileCol(slot), getTileRow(slot)]);
    442.   for i := 0 to high(tiles) do if validTile(slotFromCR(tiles[i].x, tiles[i].y)) then exit(slotFromCR(tiles[i].x, tiles[i].y));
    443. end;
    444.  
    445. procedure clickTile(var b: TBox);
    446. begin
    447.   b.shrink(2);
    448.   mouseBox(b, mouse_left);
    449. end;
    450.  
    451. procedure clickTile(slot: integer); overload;
    452. var
    453.   b: TBox;
    454. begin
    455.   b := getTile(slot);
    456.   clickTile(b);
    457. end;
    458.  
    459. procedure randomWalk();
    460. var
    461.   i, j: integer;
    462.   valid, cc: TIntegerArray;
    463.   tiles: TBoxArray;
    464. begin
    465.   tiles := getTiles();
    466.   setLength(cc, length(tiles));
    467.   for i := 0 to high(tiles) do if validTile(tiles[i]) then valid := valid + i;
    468.   if (length(valid) < 1) then exit();
    469.   mouse(middleBox(tiles[valid[random(length(valid))]]), mouse_left);
    470.   wait(345);
    471.   while isWalking() do wait(234);
    472. end;
    473.  
    474. function getManaPercent(): integer;
    475. var
    476.   tpa: TPointArray;
    477. begin
    478.   result := 100 * countColor(mana_blue, 5, 62, 249, 66) div 1225;
    479. end;
    480.  
    481. function hasArrows(): boolean;
    482. begin
    483.   result := (countColor(text_white, 675, 485, 692, _h-1) > 44);
    484. end;
    485.  
    486. function followDirections(): boolean;
    487. var
    488.   t: integer;
    489. begin
    490.   t := getDirectionTile();
    491.   if (t < 0) then exit(false);
    492.   clickTile(t);
    493.   wait(345);
    494.   while isWalking() do
    495.   begin
    496.     loot();
    497.     if clickClosestNPC() then
    498.     begin
    499.       wait(234);
    500.       break;
    501.     end;
    502.     wait(121);
    503.   end;
    504.   result := true;
    505. end;
    506.  
    507. function isTraining(): boolean;
    508. begin
    509.   result := (countColor(text_red, 222, 333, 563, 383) > 1444);
    510. end;
    511.  
    512. function hasMPot(): boolean;
    513. begin
    514.   result := (countColor(8871435, 25, 414, 50, 430) > 9);
    515. end;
    516.  
    517. procedure clickMPot();
    518. begin
    519.   mouse([39, 409]);
    520. end;
    521.  
    522. procedure mainloop();
    523. var
    524.   tempTile: integer;
    525. begin
    526.   while inCombat(tempTile) do
    527.   begin
    528.     if (isMagic() or isRange()) then
    529.     begin
    530.       if (not isInRange(tempTile)) then
    531.       begin
    532.         clickTile(getValidTileNear(tempTile)); wait(121);
    533.         while isWalking() do
    534.         begin
    535.           loot();
    536.           wait(121);
    537.         end;
    538.       end;
    539.     end else if ((tileDist(player_tile, tempTile) > 1) and (not isWalking())) then
    540.     begin
    541.       if clickClosestNPC() then wait(345);
    542.     end;
    543.     loot();
    544.     wait(121);
    545.   end;
    546.  
    547.   if (magic and (getManaPercent() > 20)) then
    548.   begin
    549.     if (not isMagic()) then clickMagic;
    550.   end else
    551.   if (range and hasArrows()) then
    552.   begin
    553.     if (not isRange()) then clickRange();
    554.   end else
    555.   if (not isMelee()) then clickMelee();
    556.  
    557.   if (magic and (getManaPercent() < 50) and hasMPot()) then clickMPot();
    558.  
    559.   while isTraining() do
    560.   begin
    561.     followDirections();
    562.     wait(234);
    563.   end;
    564.  
    565.   if close() then wait(345);
    566.   if loot() then wait(345);
    567.  
    568.   if ((not isTraining) and clickClosestNPC()) then
    569.   begin
    570.     wait(121);
    571.   end else if (not followDirections()) then randomWalk();
    572.  
    573.   wait(121);
    574. end;
    575.  
    576. begin
    577.   clearDebug();
    578.   getAndSet();
    579.   while true do mainloop();
    580. end.
    tap.zip
    Hey there,

    I have try it, but not working

  18. #18
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by diesel1990 View Post
    Hey there,

    I have try it, but not working
    Thanks for the info.
    Did you edit the tile_colos constant on line 22?

  19. #19
    Join Date
    Jun 2017
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Hey Citrus,

    Hmm im just a tester cD
    If you can explainb to me wat i have to changchange i do it ^^ i really dont know anything about scripts

    Ty in advance

  20. #20
    Join Date
    Jun 2017
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    okey i use noxplayer change the line 22 but if i want to press the play button nothing happends lol
    no error just nothing..

    why it wont start? xD

  21. #21
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by diesel1990 View Post
    okey i use noxplayer change the line 22 but if i want to press the play button nothing happends lol
    no error just nothing..

    why it wont start? xD
    It's hard to say without seeing your setup. The script will only attack and walk on the tiles that you specify in line 22. Obviously, if none of those tiles are visible, then the script will do nothing.

    There's also a chance that a game update has broken the script since I last played like 5 weeks ago. I won't be home for a few days, so I won't be able to look at it until then.

  22. #22
    Join Date
    Jun 2017
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Its working now ^^

    Can you make a logout function?
    That it quit the game in 2 hours?

    Tnx

  23. #23
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by diesel1990 View Post
    Its working now ^^

    Can you make a logout function?
    That it quit the game in 2 hours?

    Tnx
    I'm not going to update the script anymore, but I will encourage you to.

    What you're asking for would be really simple, and you should be able to write it yourself. Static coordinates would probably work.
    Here is a good intro tutorial to Simba.
    There are two functions you might find useful:
    Simba Code:
    GetTimeRunning;   //returns how long the script has been running in milliseconds
    TerminateScript;  //Terminates the script
    Good luck!

  24. #24
    Join Date
    Dec 2013
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    The script ran perfectly for a few hours, but all of the sudden it keeps coming across the same error within 5 minutes of restarting.

    Error: You passed a wrong xe to a finder function: 777. The client has a width of 160, thus the xe is out of bounds. at line 312
    Execution failed.
    Any suggestions?

    I'm certainly not new to this realm, but I am still on the newb side of coding. I won't waste your time if you decide to help. c:

    Thanks for your contribution regardless!

    EDIT:: I actually believe this occurs when the NoxPlayer gets minimized for one reason or another.
    Last edited by Malouy; 07-16-2017 at 02:46 PM.

  25. #25
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by Malouy View Post
    The script ran perfectly for a few hours, but all of the sudden it keeps coming across the same error within 5 minutes of restarting.

    Any suggestions?

    I'm certainly not new to this realm, but I am still on the newb side of coding. I won't waste your time if you decide to help. c:

    Thanks for your contribution regardless!
    I don't think I've ever had that problem. Not sure what would cause the client size to change while running. Does the client look normal, or does it actually have a width of 160?

Page 1 of 4 123 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •