Results 1 to 6 of 6

Thread: Pixel-Shift PowerChopper

  1. #1
    Join Date
    Jul 2017
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default Pixel-Shift PowerChopper

    Right now im trying to make a PowerChopper. But I cant figure out how to use Pixel shift or how it works.

    Simba Code:
    program woodcutter;
    {$i AeroLib/AeroLib.Simba}
    var
    WillowTree:TMSObject;

    procedure LoadItem;
    begin
     WillowTree.create('Chop down Willow', ['Chop', 'down','Willow'], [createCol(2771022, 13, 0.20, 0.07)], 50, 0, 0, 0);

    end;

    procedure cutting;
    var
    pntTree:Tpoint;
    begin
       if WillowTree.find(pntTree) then
         HumanMMouse(pntTree,5,5);
          if IsUpTextMulti(['Chop', 'down','Willow']) then
           FastClick(Mouse_LEFT);
    end;

    function IsWoodcutting: Boolean;
    var
      PBox: TBox;
    begin
      PBox := IntToBox(245, 130, 285, 195);               //this is the box that it is going to check
      Result := (AveragePixelShift(PBox, 250{it checks the box every 250 ms}, 500{it stops checking after this long}) > 750);
    while IsWoodcutting do
    Wait(20);
    end;

    procedure Cutting2;
    var
    pntTree:Tpoint;
    begin
    if (IsWoodcutting) then
    begin
    writeln('Waiting  to stop Cutting');
    wait(100);
    end else
    begin
    writeln('Lets look for a Tree');
    if WillowTree.find(pntTree) then
         HumanMMouse(pntTree,5,5);
          if IsUpTextMulti(['Chop', 'down','Willow']) then
           FastClick(Mouse_LEFT);
    end;
    end;

    {Procedure MainLoop;
    begin
    cutting();
     IsWoodcutting;
     cutting2();
    end;
     }

    begin
    initAL;
    Loaditem;
     cutting();
     IsWoodcutting;
     cutting2();
    end.

    This is the code that i have for it so far. Please don't judge i Didn't spend to much time on because i knew i wouldn't get far without understanding pixel shift. If anyone could help that would be great.

  2. #2
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Pixelshift is a tricky one to do accurately, no question about it. In your isWoodcutting function I noticed you try calling itself within that same function, and I don't see how that would work at all. So for starters I would do this:
    Simba Code:
    function isWoodcutting(): Boolean;
    var
      PBox: TBox;
    begin
      PBox := toBox(245, 130, 285, 195);               //this is the box that it is going to check
      Result := (AveragePixelShift(PBox, 250{it checks the box every 250 ms}, 500{it stops checking after this long}) > 750);
      while Result do
        Wait(70);
    end;

    Now, if you'd like to try using TEntities and setting your player's model you can possibly have a much more accurate animation detection of your player specifically, unaltered by nearby players and/or NPCs. But for some users it's inconvenient to set the player's model and sometimes it's hard to set it accurately. But if you'd like to do that, here's an example script of setting your player's model as well as live-debugging the count & animation perfect (only to be used with the official client.
    Simba Code:
    program new;
    {$i AeroLib/AeroLib.Simba}

    begin
      initAL();
      definePlayerModel(30, 50, 20);

      Me.Model.liveDebug(450);  // 450 is the time between pixel shifts, change this accordingly
    end.


    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  3. #3
    Join Date
    Jul 2017
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    thanks for the help flight I'm trying to work though it but you right its is hard to be accurate.

    but one thing that i thought of was using Runeloader to help me tell simba that we had stopped cutting the reason that i thought this would work is because runeloader provides this window when skilling
    runeloader wc.PNG

    is there anyway i could search for that bright green color that says 'You Are WoodCutting'(also side note the text turns red when not woodcutting). and that could be my deciding factor weather or not im cutting. for example something like this
    Simba Code:
    program woodcutter;
    {$DEFINE WALKER}
    {$i AeroLib/AeroLib.Simba}
    var
    RSW:TRSWalker;
    path:TPointArray;
    WillowTree:TMSObject;
    WeridGreenCol:TColEx;
    procedure LoadItem;
    begin
     WillowTree.create('Chop down Willow', ['Chop', 'down','Willow'], [createCol(2771022, 13, 0.20, 0.07)], 50, 0, 0, 0);
    WeridGreenCol.create(5275409, 22, 1.10, 0.60);
      RSW.Init('WorldMap');
    end;

    procedure cutting;
    var
    pntTree:Tpoint;
    i:Integer;
    begin
       for i:=1 to 5 do
      begin
       if WillowTree.find(pntTree) then
         HumanMMouse(pntTree,5,5);
          if IsUpTextMulti(['Chop', 'down','Willow']) then
           FastClick(Mouse_LEFT);
           writeln('cutting1');
            if didRedClick() then
         break;
    end;
    end;

    procedure isWoodCutting;
    var
    i:Integer;  
    begin
    if WeridGreenCol.find then
    begin
    for i:=1 to 1000 do
    begin
      wait(300);
      if not WeridGreenCol.find then
      break;
    end;
    writeln('couldnt find werid Green color so breaking loop/means done cutting');
    end;
    end;


    procedure Cutting2;
    var
    pntTree:Tpoint;
    i:Integer;
    begin
    for i:=1 to 5 do
      begin
       wait(4000 + Random(1000));
    writeln('Lets look for a Tree');
    if WillowTree.find(pntTree) then
         HumanMMouse(pntTree,5,5);
          if IsUpTextMulti(['Chop', 'down','Willow']) then
           FastClick(Mouse_LEFT);
         if didRedClick() then
         break;
    end;
    end;



    procedure Droppinglogs;
    var
      i, SSlot: integer;
    begin
    if findBlackChatMessage('Your inventory is too full to hold any more logs.') then
    begin
    if (getRunEnergy() > randomRange(1,100)) then
        toggleRunning(True);
      RSW.walkStyle := wsSPS;
      RSW.anyAngle := True;

      path:=[Point(2680,2428),Point(2678,2461),Point(2680,2491),Point(2686,2502),Point(2705,2505),Point(2714,2500),Point(2712,2487),Point(2722,2477)];
      RSW.WalkPath(path);

    end;
     end;

    Procedure MainLoop;
    begin
    cutting();
     IsWoodcutting;
     cutting2();
     Droppinglogs;
    end;

    begin
    initAL;
    Loaditem;
    repeat
        MainLoop();
      Until(False);
    end.
    In my mind i feel like this should work but i cant get it to compile. could you please take look at and tell me what you think.
    Last edited by underforu; 08-26-2017 at 09:56 PM.

  4. #4
    Join Date
    Sep 2014
    Location
    C:\Simba\
    Posts
    565
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default

    maybe not do
    Simba Code:
    While Result Do

    @Flight;
    Feel free to ask me any questions, I will do my best to answer them!

    Previously known as YouPee.

  5. #5
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Joopi View Post
    maybe not do
    Simba Code:
    While Result Do

    @Flight;
    Yeah you're right, that's terrible logic; a recipe for disaster.

    Simba Code:
    function isWoodcutting(): Boolean;
    var
      PBox: TBox;
    begin
      PBox := toBox(245, 130, 285, 195);               //this is the box that it is going to check
      Result := (AveragePixelShift(PBox, 250{it checks the box every 250 ms}, 500{it stops checking after this long}) > 750);
    end;

    while isWoodcutting() do
      wait(70);

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  6. #6
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    I use the MSCP point and form a box form that.
    Simba Code:
    if (AveragePixelShift(ToBox(MSCX -10, MSCY -20, MSCX +10, MSCY +10), 200, 600) < 80) then

    Seems to work well in my willow chopper

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
  •