Page 3 of 4 FirstFirst 1234 LastLast
Results 51 to 75 of 98

Thread: Rucoy Online Script

  1. #51
    Join Date
    Jan 2018
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    [deleted];
    Last edited by Relentless; 01-26-2018 at 12:39 AM. Reason: I guess I edited it 5 times :D

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

    Default

    Before you continue, you should really read some beginner tutorials.
    Here is another great one: https://villavu.com/forum/showthread.php?t=107757. Specifically "Sub-Tutorial 4 - Understanding TPoints, TPAs and ATPAs"

    It doesn't matter that it's for RS3. The basics apply to any script.

    Quote Originally Posted by MichaelFortis View Post
    How did you evaluate the numbers (222, 9000) for large and (0, 50) for small. I mean is there some kind of a rule for calculating these numbers or you just put them approximately?
    Code:
    filterTPAsBetween(atpa, 222, 9000); //filter out TPAs that are too big
    filterTPAsBetween(atpa, 0, 50); //filter out TPAs that are too small
    I don't know exactly where I got those numbers from, but in general you can just use WriteLn(Length(TPA)) for example to see how long a TPA is, then figure out a good range of acceptable sizes.

    Why do you edit them. As far as I understand you combined tpa's because you need to filter them out later. After filtering you will need to split them to their original form for the next part of the code, so why do you need to change them?
    I'm not sure that you understand what's going on (you should read the tutorial that I linked above). Basically, I want a TPA of the HP bar of each individual NPC on screen. The HP bar isn't just one color though: it can be green, red, gray, etc. So, I get each of those colors and combine them into a single TPA. Now I have ONE TPA with ALL of the HP bars in it. Here is an example from OSRS (a bunch of cabbages):


    There isn't anything I can do with this TPA though, so I use ClusterTPA() to get an ATPA that contains a TPA of each individual cluster:

    Now I have a whole bunch of TPAs, each of which is a separate item (cabbages in OSRS, HP bars in Rucoy). From here I can sort them based on size, location, whatever, then click on the 'best' one.
    Here they are sorted from the midpoint of the box:

    And when you will answered on this question tell me are these numbers for editing the box specific? And if they are how did you calculate them?
    Code:
    b.edit(+4, 0, -4, 0); //slightly edit the box"
    I don't remember exactly what Rucoy looks like and I don't think I have any screenshots handy, so I can't really say. You should be able to tell from looking at the game though.

    P.S. I have another question this is probably the last!
    This function determines whether or not the player is in combat by looking for the red square around the currently targeted NPC. Now that I look at it, I'm not sure it works how I intended.. FilterPointsBox is poorly named so sometimes I forget if it includes or excludes
    Simba Code:
    function inCombat(out tile: integer): boolean;
    var
      i: integer;
      p: TPoint;
      b: TBox;
      tpa: TPointArray;
      atpa, temp: T2DPointArray;
    begin
      if findColors(tpa, red_square, msx1, msy1, msx2, msy2) then
      begin
        tpa.filterPointsBox([0, 0, 372, 35]); //Filter out hp bar
        tpa.filterPointsBox([0, 564, 112, _apph-1]); //Filter out hp potion
        atpa := clusterTPA(tpa, 15); //sometimes the NPC covers part of the red box, so we need to cluster at a greater distance, i.e. 15
        filterTPAsBetween(atpa, 0, 50);// filter out small tpa's
        for i := 0 to high(atpa) do
        begin
          p := middleTPA(atpa[i]);//get the middle of the ith point
          tile := pointToTile(p);// we get a grid with slots and if p is the point in box of the slot then we will get this slot
          b := [p.x, p.y, p.x, p.y]; //this is a box made from a single point. useless as is..
          b.shrink(-20);//so.. I expand the box by 20 pixels on each side (negative shrink = expand)
          atpa[i].filterPointsBox(b); //only include points that are in the box. this makes sense because the red square is a square
          if (length(atpa[i]) > 111) then exit(true);//if the current TPA has enough points, then it's probably the red square we're looking for
        end;
      end;
    end;
    I left your comments in if they were basically correct.
    Last edited by Citrus; 01-24-2018 at 01:35 AM.

  3. #53
    Join Date
    Jan 2018
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    [deleted];
    Last edited by Relentless; 01-26-2018 at 12:39 AM.

  4. #54
    Join Date
    Jan 2018
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    [deleted];
    Last edited by Relentless; 01-25-2018 at 11:25 PM.

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

    Default

    Quote Originally Posted by MichaelFortis View Post
    ..
    If you aren't using the same resolution as the script was written for, then obviously nothing should work
    You either have to use the resolution that I specified, or rewrite every coordinate in the script, as well pretty much every number that isn't a wait time.
    Last edited by Citrus; 01-25-2018 at 04:14 AM.

  6. #56
    Join Date
    Jan 2018
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    If you aren't using the same resolution as the script was written for, then obviously nothing should work
    You either have to use the resolution that I specified, or rewrite every coordinate in the script.
    That is what I've done... I rewrited every coordinate
    Last edited by Relentless; 01-25-2018 at 03:09 AM.

  7. #57
    Join Date
    Jan 2018
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    I give up So, if someone want to change resolution for the script go ahead. I marked some lines that you will need to change (In my case it doesn't work.... but surely you will be more smarter than me and fix everything). I'm not sure about accuracy of all this information but at least you will have some notes that may help you.
    Simba Code:
    program RucoyBot1080x648;
    {$loadlib tap}
    const
      //add new tiles if you want
      tile_brown      = 2504765;
      tile_grass      = 4757576;
      tile_sand       = 10076395;
      tile_mud        = 2376788;
      tile_grave_mud  = 1065293;
      tile_grave      = 2843236;
      tile_stone      = 5197647;
      tile_stone_blue = 5785654;
      tile_maze       = 3497525;
      tile_maze_u     = 2500134;
      tile_b          = 4737096;

      //SETUP
      tile_colors: TIntegerArray = [tile_maze_u, tile_b];

      player_tile = 67;
      grid_point: TPoint = [36, 36];
      msx1 = 0;
      msy1 = 0;
      msx2 = 1080;
      msy2 = 648;
      msBox: TBox = [msx1, msy1, msx2, msy2];

      mana_blue       = 16563260;
      text_white      = 15987699;
      text_yellow     = 65514;
      text_red        = 4013567;
      loot_hand       = 4168184;
      hp_green        = 4897310;
      hp_yellow       = 65514;
      hp_gray         = 6908265;
      hp_red          = 3289807;

      wand_brown = 28808;
      close_light_gray = 13224393;
      player_point: TPoint = [540, 324];

    var
     {walkTimer: longword;}
      _w, _h, _hh, _d: Integer;

    procedure getAndSet();
    var
      pp: TSysProcArr;
      i, w, h: integer;
    begin
      getClientDimensions(w, h);
      pp := client.getIOManager.getProcesses;
      for i := 0 to high(pp) do
      begin
        if pos('NoxPlayer', pp[i].title) then
        begin
          setTarget(pp[i]);
          _hh := pp[i].handle;
          getClientDimensions(_w, _h);
          if ((w = _w) and (h = _h)) then
          begin
            writeln('Do not target the game directly!');
            terminateScript;
          end;
          exit();
        end;
      end;
      writeln('game not found');
      terminateScript();
    end;

    procedure mouse(pnt: TPoint; button: byte = 0);
    begin
      tap(_hh, pnt, 44 + random(44));
    end;

    procedure mouseBox(b: TBox; button: Integer);
    begin
      mouse(point(b.x1 + random(b.x2 - b.x1), b.y1 + random(b.y2 - b.y1)), button);
    end;

    procedure TBox.edit(const x1_, y1_, x2_, y2_: Integer);
    //edit Tbox's initial values
    begin
      self.x1 := self.x1 + x1_;
      self.y1 := self.y1 + y1_;
      self.x2 := self.x2 + x2_;
      self.y2 := self.y2 + y2_;
    end;

    procedure TBox.shrink(const size: Integer);//(+size, +size, -size, -size) this is very important, if your number will be negative then signs will change to (-size, -size, +size, +size)
    begin
      self.edit(+size, +size, -size, -size);
    end;

    {procedure TBox.offset(const p: TPoint); //Offsets by p
    begin
      self.X1 := self.X1 + p.x;
      self.Y1 := self.Y1 + p.y;
      self.X2 := self.X2 + p.x;
      self.Y2 := self.Y2 + p.y;
    end;
    }


    function gridBox(slot, columns, rows, w, h, diffX, diffY: Integer; startPoint: TPoint): TBox;
    //Return TBox coordinate of the slot in a grid
    //starTPoint: the center point of the top left box in the grid
    begin
      if (slot > (columns * rows)) then
      begin
        writeln('gridBox: Invalid slot: '+toStr(slot));
        exit;
      end;

      result.x1 := (startPoint.x + ((slot mod columns) * diffX) - (w div 2));
      result.y1 := (startPoint.y + ((slot div columns) * diffY) - (h div 2));
      result.x2 := (result.x1 + w);
      result.y2 := (result.y1 + h);
    end;

    function grid(columns, rows, w, h, diffX, diffY: Integer; starTPoint: TPoint): TBoxArray;
    //Calculate the number of slots in a grid and return each of the slot to the gridBox
    var
      i: Integer;
    begin
      setLength(result, (columns * rows));

      for i := 0 to high(result) do
        result[i] := gridBox(i, columns, rows, w, h, diffX, diffY, starTPoint);
        //starTPoint: the center point of the top left box in the grid
    end;

    procedure TPointArray.filterPointsBox(box: TBox);
    //Delete Array Points inside the box
    var
      i: Integer;
      temp: TPointArray;
    begin
      for i := 0 to high(self) do  //for all values in an array do
        if (not pointInBox(self[i], box)) then //if point is not in the box
          temp := temp + self[i]; //add this point to temp tpa
          self := temp; //array self becomes temp
    end;

    function getTiles(): TBoxArray;
    //Return all slots in the grid
    begin
      result := grid(15, 9, 72, 72, 72, 72, grid_point);
    end;

    function getTile(slot: Integer): TBox;
    //Return a specific slot from the grid
    begin
      result := gridBox(slot, 15, 9, 72, 72, 72, 72, grid_point);
    end;

    function playerBox(): TBox;
    //Find a Player Slot in the grid
    begin
      result := getTile(player_tile);
    end;

    function pointToTile(p: TPoint): Integer;
    //Find a specific point in the grid, Return the number of the slot where it was found.
    var
      i: Integer;
      tba: TBoxArray;
    begin
      result := -1;
      tba := getTiles(); //grid of all tiles
      for i := 0 to high(tba) do
        if pointInBox(p, tba[i]) then
          exit(i);
    end;

    function getTileRow(slot: Integer): Integer;
    //Return a row where a specific slot is located
    begin
      result := slot div 15;
    end;

    function getTileCol(slot: Integer): Integer;
    //Return a col where a specific slot is located
    begin
      result := slot mod 15;
    end;

    function tileDist(t1, t2: Integer): Integer;
    //Calculate the distance between 2 slots(tiles)
    var
      r1, c1, r2, c2: integer;
    begin
      r1 := getTileRow(t1);
      c1 := getTileCol(t1);
      r2 := getTileRow(t2);
      c2 := getTileCol(t2);
      result := max(r1, r2) - min(r1, r2) + max(c1, c2) - min(c1, c2);
    end;

    function isInRange(t: Integer): boolean;
    {Check the position of the player's slot and tile's slot, If the distance
    between player and tile <= 2 then Return True}

    begin
      result := (tileDist(player_tile, t) <= 3);
    end;

    function inIntArrayI(const tia: TIntegerArray; num: Integer): Integer;
    //Return number's position in the TIntegerArray(tia)
    var
      i: Integer;
    begin
      result := -1;
      if inIntArray(tia, num) then
        for i := 0 to high(tia) do
          if (tia[i] = num) then
            exit(i);
    end;

    {function maxAI(tia: TIntegerArray): integer;
    var
      i, max: integer;
    begin
      max := -999999;
      for i := 0 to high(tia) do
      begin
        if (tia[i] > max) then
        begin
          result := i;
          max := tia[i];
        end;
      end;
    end;

    function getTileColor(): integer;
    var
      i, c, n: integer;
      nn: TIntegerArray;
      p: TPoint;
      bb: TBoxArray;
    begin
      bb := getTiles();
      setLength(nn, length(tile_colors));
      for i := 0 to high(bb) do
      begin
        p := middleBox(bb[i]);
        c := getColor(p.x, p.y);
        n := inIntArrayI(tile_colors, c);
        if (n > -1) then inc(nn[n]);
      end;
      result := tile_colors[maxAI(nn)];
    end;
    }


    function clickClosestNPC(): boolean;
    var
      i, j, x, y: Integer;
      box: TBox;
      p: TPoint;
      tpa, tpa2: TPointArray;
      atpa, temp: T2DPointArray;
    begin
      if findColors(tpa, hp_green, msx1, msy1, msx2, msy2) then
      begin
        if findColors(tpa2, hp_yellow, msx1, msy1, msx2, msy2) then tpa := combineTPA(tpa, tpa2);
        if findColors(tpa2, hp_gray, msx1, msy1, msx2, msy2) then tpa := combineTPA(tpa, tpa2);
        if findColors(tpa2, hp_red, msx1, msy1, msx2, msy2) then tpa := combineTPA(tpa, tpa2);
        {all of these 'findColors' are finding the various possible colors of the NPC HP bars and combining them}
        tpa.filterPointsBox([509, 281, 570, 287]); //exclude points in this box (function => TPoinArray.filterPointsBox())
        atpa := clusterTPA(tpa, 1); //ideally we get a different cluster for each NPC
        filterTPAsBetween(atpa, 300, 9000); //filter out TPAs that are too big (width*height of the hp bars gives you number ~ 222)
        filterTPAsBetween(atpa, 0, 50); //filter out TPAs that are too small
        for i := 0 to high(atpa) do
        begin
          box := getTPABounds(atpa[i]); //return a TBox of the TPA's bounds
          //box.edit(+4, 0, -4, 0); //(procedure TBox.edit) I think we don't need to change tbox of the hp bars
          if (box.x1 >= box.x2) then continue(); //skip the box if the bounds are messed up for some reason
          if (inRange((box.y2-box.y1), 4, 7)) then //check if the box is the right height (it's a height of the hp bar)
            if ((countColor(text_white, box.x1, box.y1-20, box.x2, box.y2) > 88) or  //change box's y axis in order to include white text above hp bar
            (countColor(text_yellow, box.x1, box.y1-20, box.x2, box.y2) > 88)) then //88 is a number of pixels (color white/yellow) in the new box
              temp := temp + atpa[i]; //assign all of the "good" monsters to a temporary variable
        end;
        if (length(temp) > 0) then //make sure we found at least one good monster
        begin
          sortATPAFromMidPoint(temp, player_point); //get the closest monster first
          for i := 0 to high(temp) do //loop through each good monster in 'temp'
          begin
            p := middleTPA(temp[i]); //get the middle of the point in a temp array
            box := getTile(pointToTile(p)); //convert from point to tile box
            for j := 0 to high(tile_colors) do //check each valid tile color
            begin
              if findColor(x, y, tile_colors[j], box.x1, box.y1, box.x2, box.y2) then //check if the color is found within the tile box
              begin
                p.y := p.y + random(10, 25); //offset the Y coordinate, since the HP bar is above the NPC's head
                p.x := p.x + random(-10, 10); //randomize the X a bit
                mouse(p, mouse_left); wait(345);
                exit(true);
              end;
            end;
          end;
        end;
      end;
    end;

    function inCombat(out tile: Integer): boolean;
    var
      i: Integer;
      p: TPoint;
      box: TBox;
      tpa: TPointArray;
      atpa, temp: T2DPointArray;
    begin
      if findColors(tpa, hp_red, msx1, msy1, msx2, msy2) then
      begin
        tpa.filterPointsBox([0, 0, 336, 50]); //Filter out hp bar
        tpa.filterPointsBox([0, 100, 104, _h-1]); //Filter out hp potion
        atpa := clusterTPA(tpa, 20); //sometimes the NPC covers part of the red box, so we need to cluster at a greater distance, i.e. 15
        filterTPAsBetween(atpa, 0, 50); //filter out small tpa's
        for i := 0 to high(atpa) do
        begin
          p := middleTPA(atpa[i]); //get the middle of the ith point
          tile := pointToTile(p); // get a grid with slots and if p is the point in box of the slot then we will get this slot
          box := [p.x, p.y, p.x, p.y]; //this is a box made from a single point
          box.shrink(-20); {expand the box by 20 pixels on each side (procedure TBox.shrink),
          (x1 - size, y1 - size, x2 + size, y2 + size)}

          atpa[i].filterPointsBox(box); //only include points that are in the box. this makes sense because the red square is a square
          if (length(atpa[i]) > 200) then //if the current TPA has enough points, then it's probably the red square we're looking for
            exit(true);
        end;
      end;
    end;

    function loot(): boolean; //Changed
    begin
      if (countColor(loot_hand, 1007, 129, _w-1, 202) > 1500) then
      begin
        mouse([1050, 170], mouse_left);
        wait(1);
        mouse([1050, 170], mouse_left);
        exit(true);
      end;
    end;

    function close(): boolean; //Changed
    begin
      if inRange(countColor(close_light_gray, 1028, 17, 1032, 27), 40, 60) then
      begin
        mouse([1040, 20], mouse_left);
        exit(true);
      end;
    end;

    function isWalking(): boolean
    var
      i, bmp1, bmp2: integer;
    begin
      bmp1 := bitmapFromClient(0, 0, _w-1, _h-1); //Create Bitmap from a Client
      wait(122);
      bmp2 := bitmapFromClient(0, 0, _w-1, _h-1); //Create Bitmap from a Client
      result := (calculatePixelShift(bmp1, bmp2, [0, 0, _w-1, _h-1]) > 12345);//compare bmp1 and bmp2
      freeBitmap(bmp1);
      freeBitmap(bmp2);
    end;

    function isMelee(): boolean; //Changed
    begin
      result := (countColor(13417668, 1007, 423, _w-1, _h-1) > 80);
    end;

    function isRange(): boolean; //Changed
    begin
      result := (countColor(9539985, 1007, 499, _w-1, _h-1) > 120);
    end;

    function isMagic(): boolean; //Changed
    begin
      result := (countColor(2639976, 1007, 575, _w-1, _h-1) > 460);
    end;

    function validTile(const box: TBox): boolean;
    //Count and Return the number of poxels in the tile
    var
      i, c: integer;
    begin
      for i := 0 to high(tile_colors) do c += countColor(tile_colors[i], box.x1, box.y1, box.x2, box.y2);
      result := (c > 2592); //if the number of pixels in the tile more than 2592 then return the result
    end;

    function validTile(slot: Integer): boolean; overload;
    //Check if the tile valid or not
    var
      box: TBox;
    begin
      box := getTile(slot); //Take the tile's slot
      result := validTile(box); //Take the result from function above and apply it to tile slot.
      //Basically it checks the number of pixels in the specific slot and if that number is 2592 then the slot is valid
    end;

    //SETUP
    function getDirectionTile(): Integer;
    var
      i, n: Integer;
      tt: TIntegerArray;
    begin
      result := -1;
      repeat
        case _d of
          1: tt := [22, 23, 21, 24, 20, 25, 19, 26, 18, 27, 17, 28, 16];              // north
          2: tt := [73, 88, 58, 103, 42, 118, 28];                                    // east
          3: tt := [112, 113, 111, 114, 110, 115, 109, 116, 108, 117, 107, 118, 106]; // south
          4: tt := [61, 76, 46, 91, 31, 106, 16];                                     // west
        end;
        for i := 0 to high(tt) do
          if validTile(tt[i]) then //check the tile
            exit(tt[i]);
            _d := (_d mod 4) + 1;
            inc(n);
            until (n > 4);
    end;

    function slotFromCR(const col, row: integer): integer;
    //get slot from col and row
    begin
      result := (row * 15) + col;
    end;

    function getTileTPA(const c1, r1, c2, r2: Integer): TPointArray;
    var
      minR, minC, maxR, maxC, n, i, j: Integer;
    begin
      minR := min(r1, r2); maxR := max(r1, r2);
      minC := min(c1, c2); maxC := max(c1, c2);
      setLength(result, (maxR-minR+1)*(maxC-minC+1));
      for i := minC to maxC do
      begin
        for j := minR to maxR do
        begin
          result[n] := [i, j];
          inc(n);
        end;
      end;
    end;

    function getTileTPA(const t1, t2: Integer): TPointArray; overload;
    begin
      result := getTileTPA(getTileCol(t1), getTileRow(t1), getTileCol(t2), getTileRow(t2));
    end;

    function getValidTileNear(const slot: Integer): Integer;
    var
      i: Integer;
      tiles: TPointArray;
    begin
      tiles := getTileTPA(player_tile, slot);
      sortTPAFrom(tiles, [getTileCol(slot), getTileRow(slot)]);
      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));
    end;

    procedure clickTile(var box: TBox);
    begin
      box.shrink(2);
      mouseBox(box, mouse_left);
    end;

    procedure clickTile(slot: Integer); overload;
    var
      box: TBox;
    begin
      box := getTile(slot);
      clickTile(box);
    end;

    procedure randomWalk();
    var
      i, j: integer;
      valid, cc: TIntegerArray;
      tiles: TBoxArray;
    begin
      tiles := getTiles();
      setLength(cc, length(tiles));
      for i := 0 to high(tiles) do if validTile(tiles[i]) then valid := valid + i;
      if (length(valid) < 1) then exit();
      mouse(middleBox(tiles[valid[random(length(valid))]]), mouse_left);
      wait(345);
      while isWalking() do wait(234);
    end;

    function getManaPercent(): integer; //Changed
    begin
      result := 100 * countColor(mana_blue, 0, 32, 336, 42) div 2656;
    end;

    function hasArrows(): boolean; //Changed
    begin
      result := (countColor(text_white, 930, 640, 931, _h-1) > 44);
    end;

    function followDirections(): boolean;
    var
      t: integer;
    begin
      t := getDirectionTile();
      if (t < 0) then exit(false);
      clickTile(t);
      wait(345);
      while isWalking() do
      begin
        loot();
        if clickClosestNPC() then
        begin
          wait(234);
          break;
        end;
        wait(121);
      end;
      result := true;
    end;

    function isTraining(): boolean;
    begin
      result := (countColor(text_red, 217, 440, 860, 463) > 3100);
    end;

    function hasMPot(): boolean;
    begin
      result := (countColor(8871435, 0, 443, 100, 543) > 1); //Changed
    end;

    procedure clickMPot(); //Changed
    begin
      mouse([50, 500]);
    end;

    procedure mainloop();
    var
      tempTile: integer;
    begin
      while inCombat(tempTile) do
      begin
        if (isMagic() or isRange()) then
        begin
          if (not isInRange(tempTile)) then
          begin
            clickTile(getValidTileNear(tempTile)); wait(121);
            while isWalking() do
            begin
              loot();
              wait(121);
            end;
          end;
        end else if ((tileDist(player_tile, tempTile) > 2) and (not isWalking())) then
        begin
          if clickClosestNPC() then wait(345);
        end;
        loot();
        wait(121);
      end;

      if (isMagic and (getManaPercent() < 50) and hasMPot()) then clickMPot();

      while isTraining() do
      begin
        followDirections();
        wait(234);
      end;

      if close() then wait(345);
      if loot() then wait(345);

      if ((not isTraining) and clickClosestNPC()) then
      begin
        wait(121);
      end else if (not followDirections()) then randomWalk();

      wait(121);
    end;

    begin
      clearDebug();
      getAndSet();
      while true do mainloop();
    end.
    Simba Code:
    program cc;
    begin
       writeln(IntToStr(countColor(8871435, 0, 443, 100, 543))); // just put the x1,y1, x2,y2 and color and it will calculate the number of pixels (specific color) located in this box
    end.

    Simba Code:
    program getTileSlot;
    const
      grid_point: TPoint = [36, 36]; //your start grid point

    var
     _w, _hh, _h: integer;

    procedure getAndSet();
    var
      pp: TSysProcArr;
      i, w, h: integer;
    begin
      getClientDimensions(w, h);
      pp := client.getIOManager.getProcesses;
      for i := 0 to high(pp) do
      begin
        if pos('NoxPlayer', pp[i].title) then
        begin
          setTarget(pp[i]);
          _hh := pp[i].handle;
          getClientDimensions(_w, _h);
          if ((w = _w) and (h = _h)) then
          begin
            writeln('Do not target the game directly!');
            terminateScript;
          end;
          exit();
        end;
      end;
      writeln('game not found');
      terminateScript();
    end;

    function gridBox(slot, columns, rows, w, h, diffX, diffY: integer; startPoint: TPoint): TBox;
    begin
      if (slot > (columns * rows)) then
      begin
        writeln('gridBox: Invalid slot: '+toStr(slot));
        exit;
      end;

      result.x1 := (startPoint.x + ((slot mod columns) * diffX) - (w div 2));
      result.y1 := (startPoint.y + ((slot div columns) * diffY) - (h div 2));
      result.x2 := (result.x1 + w);
      result.y2 := (result.y1 + h);
    end;

    function grid(columns, rows, w, h, diffX, diffY: integer; starTPoint: TPoint): TBoxArray;
    var
      i: integer;
    begin
      setLength(result, (columns * rows));

      for i := 0 to high(result) do
        result[i] := gridBox(i, columns, rows, w, h, diffX, diffY, starTPoint);
    end;

    function getTiles(): TBoxArray;
    begin
      result := grid(15, 9, 72, 72, 72, 72, grid_point); // put here your grid ditails
    end;

    function getTile(slot: integer): TBox;
    begin
      result := gridBox(slot, 15, 9, 72, 72, 72, 72, grid_point); // put here your grid ditails
    end;

    function pointToTile(p: TPoint): integer;
    var
      i: integer;
      bb: TBoxArray;
    begin
      result := -1;
      bb := getTiles();
      for i := 0 to high(bb) do if pointInBox(p, bb[i]) then exit(i);
    end;

    function getslot(): Integer;
    var
      p: TPoint;
      i: Integer;
    begin
      p := Point(540, 390); //put here middle point of your character
      i := pointToTile(p);
      writeln('The slot number is ' + i);
    end;

    begin
      getAndSet();
      getslot();
    end.
    Last edited by Relentless; 01-26-2018 at 05:04 PM.

  8. #58
    Join Date
    Feb 2018
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Hello guys,
    The script is working good however there are some things i would like to ask if citrus or someone else could edit/add them:

    -The Mana% doesnt work pretty well as it pots all the time after killing a mob (when ussing mage)
    -The training function works only sometimes and only if it have another enemy arround
    -Would be good to have a Exhaust function similar to training one.
    -The movement (randomwalks) is slow in my opinion as it have to go first to the random tile then it waits for atleast 1 sec then move to another tile
    -Sometimes it loops between targets for example if the 1º target is behind a wall and he goes there to attack it but it dissapear he tries to choose another target and if the other target is in other position he goes back to that 2º target but when he see the 1º target he moves back to it and sometimes its looping for atleast 20 - 30 secs
    -Also would be great to have a function to avoid KSing ( for example all the mobs that are attacking a player 1 tile away of him)


    I know the script is outdated and you are probably not gonna update it anymore. I'm trying to learn to edit it but i cant make it work thats why im posting it here if Citrus or someone else can edit it.

    Thank you so much for your time

  9. #59
    Join Date
    Feb 2018
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    PD: I could make most of the things work except creating a function to ignore player tiles...
    Could anyone help me with that?

    I need to make a function to ignore the X player tile + all the tiles arround him

    Thank you

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

    Default

    Quote Originally Posted by face View Post
    Hello guys,
    The script is working good however there are some things i would like to ask if citrus or someone else could edit/add them:

    -The Mana% doesnt work pretty well as it pots all the time after killing a mob (when ussing mage)
    -The training function works only sometimes and only if it have another enemy arround
    -Would be good to have a Exhaust function similar to training one.
    -The movement (randomwalks) is slow in my opinion as it have to go first to the random tile then it waits for atleast 1 sec then move to another tile
    -Sometimes it loops between targets for example if the 1º target is behind a wall and he goes there to attack it but it dissapear he tries to choose another target and if the other target is in other position he goes back to that 2º target but when he see the 1º target he moves back to it and sometimes its looping for atleast 20 - 30 secs
    -Also would be great to have a function to avoid KSing ( for example all the mobs that are attacking a player 1 tile away of him)


    I know the script is outdated and you are probably not gonna update it anymore. I'm trying to learn to edit it but i cant make it work thats why im posting it here if Citrus or someone else can edit it.

    Thank you so much for your time
    Okay, I fixed the mana function.
    The script isn't meant to be used with training weapons.
    As for the rest: I am aware of those issues, but I'm not at all interested in adding to this script. Anyone is welcome to butcher it to their heart's content.

  11. #61
    Join Date
    Feb 2018
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Thank Citrus but i would ask you if you could help me to make the function to ignore the X player tile + all the tiles arround him. I know you dont have intend to update it but you would really make me a big favour

    PD: i was able to edit the isTraining fuction to work properly and not get stuck.

    Still need someone help me to make a logic for not attacking the 1tile area of a player that is killing mobs.
    Someone please?
    Last edited by face; 03-08-2018 at 10:47 AM.

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

    Default

    Quote Originally Posted by face View Post
    Thank Citrus but i would ask you if you could help me to make the function to ignore the X player tile + all the tiles arround him. I know you dont have intend to update it but you would really make me a big favour

    PD: i was able to edit the isTraining fuction to work properly and not get stuck.

    Still need someone help me to make a logic for not attacking the 1tile area of a player that is killing mobs.
    Someone please?
    Sure thing. You can approach it the same way I find monsters in the script: with the text over everyone's head. You'll need to use FindColors() for each unique color text that a player can have and combine the TPAs. Then you can exclude all the tiles around it from the search for monsters.

  13. #63
    Join Date
    Feb 2018
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    i wonder if i can contact you via discord so it would be easier, or somewhere else

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

    Default

    Quote Originally Posted by face View Post
    i wonder if i can contact you via discord so it would be easier, or somewhere else
    pm'd

  15. #65
    Join Date
    Dec 2017
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    pm'd

    Your script works beautifully citrus thank you for creating this.

    The only issue I have is with HP. Is this not included in the script?
    Last edited by Toejam; 04-05-2018 at 02:01 AM. Reason: forgot quote.

  16. #66
    Join Date
    Jun 2018
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Your script works fine but it can't use hp pots and use skill.
    Last edited by jesuistonami; 06-12-2018 at 10:12 AM.

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

    Default

    Quote Originally Posted by jesuistonami View Post
    Your script works fine but it can't use hp pots and use skill.
    Sure it can.

  18. #68
    Join Date
    Jun 2018
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    Sure it can.
    So I don't understand why their functions included on script doesn't work.

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

    Default

    Quote Originally Posted by jesuistonami View Post
    So I don't understand why their functions included on script doesn't work.
    All of the necessary functions should already be in the script. You just have to implement the logic in the mainloop.

  20. #70
    Join Date
    Sep 2017
    Posts
    1
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Citrus i using you script and is perfect, i need only add useAbility in script, it's possible? you help me? i pay you for it.

  21. #71
    Join Date
    Mar 2019
    Posts
    1
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I need to train melee but i start the script change to magic only train magic

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

    Default

    Hey guys..if anyone can help me please...iam trying to use this script in another game (Lawl Online) but nothing runs correctly..i wonder if anyone here can help me, just to develop a script for kill mobs, just to click on the mob and walk around the map..i dont know if we can edit this script from the post to do it or make another one script from zero...anyone can help?

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

    Default

    Quote Originally Posted by xulegos View Post
    Hey guys..if anyone can help me please...iam trying to use this script in another game (Lawl Online) but nothing runs correctly..i wonder if anyone here can help me, just to develop a script for kill mobs, just to click on the mob and walk around the map..i dont know if we can edit this script from the post to do it or make another one script from zero...anyone can help?
    This new game looks like a pretty blatant copy of Rucoy, so I'm guessing most of the logic would be the same. Maybe 98% of the script is already written. You'd just have to fix a few colors and coordinates.
    Unfortunately, I have zero interest in working on this, so it's up to you.

  24. #74
    Join Date
    Jun 2017
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    thanks anyway

  25. #75
    Join Date
    Jun 2017
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Citrus View Post
    This new game looks like a pretty blatant copy of Rucoy, so I'm guessing most of the logic would be the same. Maybe 98% of the script is already written. You'd just have to fix a few colors and coordinates.
    Unfortunately, I have zero interest in working on this, so it's up to you.
    My frieND,Tile_stone is the ground color or the mob color? When i set the tile_stone to a ground color (where it clicks to run, its go walking over the map, perfect, but not killing the mob. Can you help me please?
    Last edited by xulegos; 05-13-2019 at 06:14 PM.

Page 3 of 4 FirstFirst 1234 LastLast

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 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
  •