Results 1 to 4 of 4

Thread: Whats worng with my loop? Its spam click!

  1. #1
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Whats worng with my loop? Its spam click!

    Well im trying to cut a Yew tree but it keeps clicking it, why?
    Also any other coments on the code would be nice
    SCAR Code:
    program new;
    {.include SRL/SRL.scar}

    Var Debug,Info:Boolean;

    Procedure WriteDebug(Text:String);
    Begin
      If Debug Then
      writeln(Text);
    End;

    Procedure WriteInfo(Text:String);
    Begin
      If Info Then
      writeln(Text);
    End;

    //Kill = cut
    //Find = is there?
    Function Tree(what:string):Boolean;

    Var Colour,Toll,x,y:Integer;

    Begin

      SetColorToleranceSpeed(2);
      SetToleranceSpeed2Modifiers(0.04,0.51);
      Colour := 3832169   //For ease of use
      Toll   := 27        // ^^^^^^^^^^^^
      Result := False

      If FindColorSpiralTolerance(x,y,Colour,MSX1,MSY1,MSX2,MSY2,Toll) Then

      Case What Of

      'Kill':
        Begin
          MMouse(x,y,10,10);
          Wait(250+Random(750));
            If IsUpText('ew') Then
              Begin
                GetMousePos(x,y);
                Result := True
                  If Random(45) = 12 Then
                    Begin
                      Mouse(x,y,0,0,True);
                      Wait(250+Random(1500));
                      ChooseOption('ut');
                    End Else
                      Mouse(x,y,0,0,True);
              End;
        End;

      'Find': Result := True

      End;
    End;

    Procedure TreeMaster;
    Var I,B:Integer;
    Begin

      WriteDebug('Starting Tree Master');
      MarkTime(B);
      Repeat

      If InvFull Then
      Exit;

        Tree('Kill')

        If Tree('Find') Then
          WriteDebug('Function Tree(find) is True, Must be still cutting, Going in to Loop for 10 mins Max!');

          MarkTime(I);
        Repeat   // While cutting loop

          If InvFull Then
          Begin
            WriteInfo('Inv is full');
            Exit;
          End;

          If Not Tree('Find') Then
          Begin
            WriteDebug('Tree(find) is false, Tree is gone going to wait for new one');
            WriteInfo('Tree is gone');
            Break;
          End;

          I := TimeFromMark(I);

          If (I >= 6000000) Then
          WriteDebug('10 mins past, cant be cutting tree ending loop');

        Until (I >= 6000000)

        MarkTime(I);

        Repeat //Looking loop

        If Tree('Find') Then
        Begin
          WriteDebug('Found tree, exiting LOOP');
          Break;
        End;

        If Not Tree('Find') Then
        Wait(500+Random(700));

        I := TimeFromMark(I);

        If (I >= 6000000) Then
        Begin
          WriteDebug('Its been 10 mins looking for tree exiting');
          Exit;
        End;

        Until(False)

      B := TimeFromMark(B);
      Until(B >= 54000000);
      WriteDebug('Its been half an hour ending now');
    End;

    begin
    SetupSRL;
    Debug := True
    Info  := True
    ActivateClient;
    Wait(750);
    Treemaster;
    end.
    thanks
    I see Now, says the blind man

  2. #2
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    You should have a while cutting function, you can use like PixelShift() to detect if your character is moving.

    EDIT: I'll be offline for some time, so someone else can explain some more
    Last edited by Frement; 06-30-2010 at 05:46 PM.
    There used to be something meaningful here.

  3. #3
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    sorry but i might be missing something but on your tree function for 'find' you have it so if it finds the tree on the screen then it results yes
    and later in the script you use that to see if your cutting
    but just because the tree is on the screen doesn't mean that your cutting...

    ~shut

  4. #4
    Join Date
    Mar 2010
    Location
    New Hampshire, U.S.A
    Posts
    586
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol :P. I think your problem is when you try to 'Find' a tree, u find it anywhere one the screen. if there are 2 vidible yews(or even just a yew colord pixel XD) then your script assumes it has nut finished cutting the yew.

    That us exactly what shuttle saw too . lol.

    You say your script continually clicks, so im curious as to what exactly your script sees.

    To see all those pixels with the yew color, you should add this before your findcolortolerance and case statement

    SCAR Code:
    FindColorsTolerance(YewColTPA,YewColorHere,MSX1,MSY1,MSX2,MSY2,{tolerance here, u will test this to see what value works best by drawing the pixels this finds on the runescape client});

    Now that you have assigned all the pixels your pc thinks are yew trees a spot in the TPA, you can use this in a function that maybe someone else will post wich draws them on screen
    Last edited by g0tp0t; 07-07-2010 at 07:48 PM.
    Sell botted goods at mid to high prices!!! Else we lose our profit AND ruin the game!!!!

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
  •