Results 1 to 9 of 9

Thread: Fail help

  1. #1
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Fail help

    I finished my mining procedure. But i'm working on my chopping procedure that's giving me the problem.(I think i nailed Tboxes). All it does is move the mouse to the top left and just sits there.(I think it tries to find it up there because it moves a little bit?)

    SCAR Code:
    program PMOW;
    {.Include SRL/SRL.SCAR}
    {.Include SRL/SRL/Skill/WoodCutting.SCAR}

    //Global Vars
    Var Mined, Chopped, loads :integer;
    Var XPG :string;

    procedure DeclarePlayers;
    begin
      HowManyPlayers:= 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
               ///// fill all of below in
      Players[0].Name    := 'f'; // username
      Players[0].Pass    := 'y'; //password
      Players[0].Nick    := 'i';   //3-4 letters of your name. No first letter or caps
      Players[0].Active  := true; //if it's active
      Players[0].strings[0]:= 'copper'; //what rock you mining? copper, iron or tin(If mining)
      Players[0].strings[1]:= 'chop';  // chop or mine
      Players[0].integers[0]:= 50; // ore/logs to mine/chop
    end;

    Procedure Anti;
    begin
      case random(40) of
       0:HoverSkill('Random',false);

       1:SleepAndMoveMouse(1000+random(500));

       2:RandomRClick;

       3:PickUpMouse;

       4:RandomMovement;
      end;
      wait(500+random(500))
    end;

    function ACIron: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 1711918, MSX1, MSY1, MSX2, MSY2, 24);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 3.83) and (H <= 4.92) and (S >= 28.55) and (S <= 29.65) and (L >= 8.80) and (L <= 19.24) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 0.81) and (X <= 3.20) and (Y >= 0.74) and (Y <= 2.85) and (Z >= 0.57) and (Z <= 1.99) then
          begin
            Result := arC[i];
            Break;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    function ACCopper: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 4621284, MSX1, MSY1, MSX2, MSY2, 32);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 6.33) and (H <= 6.46) and (S >= 56.89) and (S <= 97.79) and (L >= 51.74) and (L <= 64.92) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 31.45) and (X <= 52.03) and (Y >= 25.38) and (Y <= 41.71) and (Z >= 7.78) and (Z <= 12.53) then
          begin
            Result := arC[i];
            Break;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    function ACtin: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);

      FindColorsSpiralTolerance(MMCX, MMCY, arP, 9671834, MMX1, MMY1, MMX2, MMY2, 24);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 0.00) and (H <= 2.40) and (S >= 2.52) and (S <= 4.42) and (L >= 53.71) and (L <= 64.33) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 23.62) and (X <= 35.26) and (Y >= 24.33) and (Y <= 36.37) and (Z >= 25.98) and (Z <= 38.43) then
          begin
            Result := arC[i];
            Break;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    Procedure DropIt;
    Var Log, Ore, X, Y, O :integer;
    begin
      Log := DTMFromString('78DA63DCCDC4C0B089910119B899CA318840D' +
           '9FF8180713350CD4A54350C0C4C601226CAB81FC85F4E40CD5120' +
           '7F35AA1A517E365435A7806AB61261D72E026A3611A1662D90BF1' +
           '1BF1A00F16E1068');
      If(Not(InvFull))then exit;
      If Not (FindDtm(Log, X, Y, MIX1, MIY1, MIX2, MIY2)) or
             (FindDtm(Ore, X, Y, MIX1, MIY1, MIX2, MIY2)) then exit;
    ////////////////////////////////////////////////////////////////
      If(FindDtm(Log, X, Y, MIX1, MIY1, MIX2, MIY2)) or
        (FindDtm(Ore, X, Y, MIX1, MIY1, MIX2, MIY2)) then
      begin
        marktime(O)
        repeat
           mouse(x,y,3,3,false)
           wait(25+random(50))
           WaitOption('rop', 100+Random(50))
         until(not(FindBitmapToleranceIn(Ore, x, y, MIX1, MIY1, MIX2, MIY2, 20))) and (FindDtm(Ore, X, Y, MIX1, MIX1, MIX2, MIY2)) or (TimeFromMark(O) >= 30000)
         loads:=loads+1
      end;
    end;

    procedure MineIt;
    var X, Y, I, E :integer;
    begin
      if(not(loggedin))then exit;
      if(invfull) then dropit;
        case Lowercase(Players[currentplayer].strings[0]) of
          'iron':findcolorspiraltolerance(x,y,ACIron,msx1,msy1,msx2,msy2,20);
          'copper':findcolorspiraltolerance(x,y,ACCopper,msx1,msy1,msx2,msy2,20);
          'tin':findcolorspiraltolerance(x,y,ACtin,msx1,msy1,msx2,msy2,20);
        end;
        mmouse(x,y,3,3);
        if(waituptext('ine',300+random(300)))then
          begin
            GetMousePos(x, y);
            mouse(x,y,3,3,true);
            i := InvCount;
            MarkTime(E);
            while (InvCount = i) and (TimeFromMark(E) < Players[currentplayer].integers[1]) do Anti;
            if(not(invcount = i)) then Mined:=Mined+1
          end;
    end;

    function ACTree: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.06, 1.53);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 2056014, MSX1, MSY1, MSX2, MSY2, 11);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);

        if (X >= 2.99) and (X <= 13.21) and (Y >= 4.08) and (Y <= 16.52) and (Z >= 0.96) and (Z <= 6.51) then
        begin
          Result := arC[i];
          Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    Procedure Chopping;
    Var x,y :integer;
    Var MTB :Tbox;
    begin
      if(not(loggedin))then exit;
      if(invfull) then dropit;
        If(FindColorSpiralTolerance(x, y, ACTree, MSX1,MSY1,MSX2,MSY2, 20)) then
        mmouse(x,y,3,3);
        if(waituptext('ree',50+random(75))) or (waituptext('ak',300+random(300))) then
          begin
            mouse(x,y,3,3,true);
            Wait(2037+Random(13))
            MTB.X1:= MSCX-40;
            MTB.Y1:= MSCX-40;
            MTB.X2:= MSCX+40;
            MTB.Y2:= MSCX+40;
            while (PixelShift(MTB, 947+Random(53)) < 800) do Anti;
            Chopped := Chopped +1
          end;
    end;


    Procedure ScriptTerminate;
    begin
    Writeln('|===Junkj"s [P]ower [M]iner [Or] [W]oodcutter');
    Writeln('|Ran for ' + TimeRunning);
    Case Lowercase(Players[0].strings[1]) of
     'mine': Writeln('|Mined ' + IntToStr(Mined) + ' ore and gained ' + IntToStr(Mined*(StrToInt(XPG))) + ' XP');
     'chop': Writeln('|Chopped ' + IntToStr(Chopped) + ' and gained ' + IntToStr(Chopped*25) + ' XP');
    end;
    Writeln('|Did ' + IntToStr(Loads) + ' Loads');
    Writeln('|CopyRighted PMOW© by the original creater: JunkJ®');
    Writeln('========THANK-JOO-FOR-USING-MY-SCRIPT========');
    end;

    Procedure DeclareXP;
    begin
      case Lowercase(Players[currentplayer].strings[0]) of
        'iron': XPG := '35';
        'copper': XPG := '17.5';
        'tin': XPG := '17.5';
      end;
    end;

    Procedure DeclareA;
    begin
      Case (Lowercase(Players[CurrentPlayer].Strings[1])) of
        'chop' : Chopping;
        'mine' : MineIt;
      end;
    end;


    begin
      SetUpSRL;
      ActivateClient;
      ClearDebug;
      Disguise('PMOW© by JunkJ®')
      DeclarePlayers;
      GraphicsSet:= True;
      DeclareXP;
      If(Not(Loggedin))Then loginplayer;
      Repeat
        DeclareA;
        DropIt;
      Until(Mined >= Players[CurrentPlayer].integers[0]) or (Chopped >= Players[CurrentPlayer].integers[0])
    end.

    Hate posting my currently working on scripts.

  2. #2
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    its not finding the tree, I assuming because of a failed autocolor. But why are you autocoloring in the first place? It's uneeded, takes up time, and will probably end up being just as accurate, or more inaccurate then just static numbers.
    “Ignorance, the root and the stem of every evil.”

  3. #3
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    O.K. I thought it would work for trees since it worked nicely for the rocks(Maybe because of the exotic color?). I'll use regular color, post it up.

    Edit: Yep that was the problem Stupid I am. How would I find the tree now? Manual color?
    Last edited by Mr. Doctor; 01-15-2010 at 02:15 AM.

  4. #4
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Just put static colors in FindColorsSpiralTolerance(); and search with a Tolerance.

  5. #5
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    You can shorten your autocolor to just this:
    SCAR Code:
    tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.06, 1.53);
      FindColorsSpiralTolerance(MSCX, MSCY, arP, 2056014, MSX1, MSY1, MSX2, MSY2, 11);
       ColorToleranceSpeed(tmpCTS);
       SetColorSpeed2Modifiers(0.2, 0.2);

    XYZ and HSL are too excessive and unnecessary IMO, Icefire (He taught me) and I both just "SetColorSpeed2Modifiers" and then do the search, and get great results from just that, makes the code A LOT less bulky and huge. .

    Also, which procedure exactly is the problem? Based on just your explanation though, seems like you're just missing a GetMousePos(x, y); in your code somewhere.

  6. #6
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Just put static colors in FindColorsSpiralTolerance(); and search with a Tolerance.
    More info on static colors please?

  7. #7
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Junkj View Post
    More info on static colors please?
    Just use Scar's color picker to pick the color, then fill it in FindColorsSpiralTolerance.

  8. #8
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Just use Scar's color picker to pick the color, then fill it in FindColorsSpiralTolerance.
    Oh wow. Thought it was just color, not static

  9. #9
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Junkj View Post
    Oh wow. Thought it was just color, not static
    Static just means that it doesn't change, where as Dynamic colors would be like an AutoColor.

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
  •