Results 1 to 14 of 14

Thread: :( im stumpt, cant wait while chopping

  1. #1
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default :( im stumpt, cant wait while chopping

    i'm having trouble with this procedure, which is suposed to wait until i'm done chopping a tree, but it doesnt and keeps clicking the tree, which means its detectable

    SCAR Code:
    procedure Wait_Tree;
    var
      a, b: integer;
      tpa: TPointArray;
    begin
      marktime(b);
      A_Debug('started chopping');
      repeat
        if not FindColorsSpiralTolerance(MSCX, MSCY, Tpa, TA.color, MSX1, MSY1, MSX2, MSY2, 7) then
        begin
          A_Debug('cannot find tree');
          exit;
        end;
        a:= length(tpa);
        A_Debug(inttostr(a));
        wait(100);
        antiban;
        if invfull then exit;
      until (a < a - 50) or (timefrommark(b) > Max_Cut_Time); //maby it has something to do with (a < a - 50)?
      A_Debug('finished chopping');
    end;

    inb4 search button
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  2. #2
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    (a < a - 50)

    You know that result will never change... its always going to be false.

    Also I suggest are you searching in the area of the current tree your cutting? Otherwise if another tree is on screen it'll just keep waiting once you get this right.

    Whats yor MAX Cut time set to?
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  3. #3
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    What I do in my wcer, I track the tree, as the player moves to it. Create a search area, then constantly check the colour count/width & height until it changes a large amount.

    Well, best of luck anyways.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  4. #4
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by Narcle View Post
    (a < a - 50)

    You know that result will never change... its always going to be false.

    Also I suggest are you searching in the area of the current tree your cutting? Otherwise if another tree is on screen it'll just keep waiting once you get this right.

    Whats yor MAX Cut time set to?
    1:
    2: yes, im thinking an ATPA/ pie filtering?
    3: its a const, set by the user. i had it as 30k mili seconds
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  5. #5
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Ya thats what I would do Nava, just helping out his scripting bit. :P
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  6. #6
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    SCAR Code:
    function Wait_Tree(SL: integer): boolean;
    var
      a : Tintegerarray;
      tpa : TPointArray;
    begin
      if not loggedin then exit;
      colortolerancespeed(3);
      findcolorstolerance(tpa, TA.color, mscx - 20, mscy - 20, mscx + 20, mscy + 20, TA.Tol);
      a[0] := length(SL);
      a[1] := length(tpa);
      result:= a[1] < (a[0] - 15);
      colortolerancespeed(1);
    end;
    ?
    /me fails
    Last edited by Awkwardsaw; 10-14-2009 at 09:30 PM.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  7. #7
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    sorry for double post, but i dont want to make a new thread for the same problem

    i changed my method, and i am now looking for the ax when you are chopping, if it returns false then obviously you are not chopping

    SCAR Code:
    function findax:boolean; //thanks to JAD for fixing up :D
    var
      i: integer;
      tpa: TPointArray;
      c: TIntegerArray;
    begin
      if not loggedin then exit;
      colortolerancespeed(3);
      c := [5064763, 593214, 5261885, 869985];
      for i:= 0 to high(c) do
        if findcolorstolerance(tpa, c[i], mscx - 35, mscy - 35, mscx + 35, mscy + 35, 5) then
          result := true;
      colortolerancespeed(1);
    end;

    //chops the tree, repeats untill inv is full or cant find a tree
    Function ChopTree(uptext: string; color : integer) : boolean;
    var time: integer;
    begin
      if not loggedin then exit;
      A_Debug('started ChopTree proc');
      repeat
        A_Debug('starting to chop');
        result:= A_FindObj(color, 7, uptext, true);
        A_Debug('waiting');
        antiban;
        marktime(time);
        while findax do
        begin
          antiban;
          if (timefrommark(time) > max_cut_time + random(1000)) or
            invfull or (not findax) then break;
        end;
        A_Debug('done chopping');
      until invfull or not result;
      A_Debug('ended ChopTree proc');
    end;

    BUT my problem is, the function always results true, even when i am not cutting,

    if there is no problem with the function(s) then i guess i'll just have to get better colors, since it might be finding my character and not my ax
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  8. #8
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Add a wait to your for loop in case the script cannot see that part of the ax at that moment:

    SCAR Code:
    for i:= 0 to high(c) do
    begin
        if findcolorstolerance(tpa, c[i], mscx - 35, mscy - 35, mscx + 35, mscy + 35, 5) then
        begin
          result := true;
          break;
        end;
        wait(200+random(200));
    end;

    Something along those lines. Also increasing the tolerance could help.

  9. #9
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    BUT my problem is, the function always results true, even when i am not cutting,
    i'll try it out
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  10. #10
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Awkwardsaw View Post
    i'll try it out
    Hmm..

    Well that would be the case if the axe was weilded? Otherwise the color is just always there on your players shirt or something.

  11. #11
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by JAD View Post
    Hmm..

    Well that would be the case if the axe was weilded? Otherwise the color is just always there on your players shirt or something.
    snap, i forgot about people who weild their hatchets

    it must be the colors on my char then :\
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  12. #12
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    What I did for chopping procedures was:

    1. Checking if the invcount() changes
    2. Checking if the tree is still there.

    1) Is Simple.

    2) A bit harder.
    a) Getting Tree Colors with FindColors
    b) Making Boxes with splittpaex
    c) Killing not neccesarry boxes with my own function
    d) the Result will be only boxes that contain trees.

    ~caused

  13. #13
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    What I did in my chopper was after the click to chop the axe it would check for the UpText for the tree it was chopping. When the UpText was no longer there then it went to the next tree.

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  14. #14
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by caused View Post
    What I did for chopping procedures was:

    1. Checking if the invcount() changes
    2. Checking if the tree is still there.

    1) Is Simple.

    2) A bit harder.
    a) Getting Tree Colors with FindColors
    b) Making Boxes with splittpaex
    c) Killing not neccesarry boxes with my own function
    d) the Result will be only boxes that contain trees.

    ~caused
    i sort of like that idea

    and then with the atpa, when the length of it is about 1 less, that means a tree has been chopped?
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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
  •