Results 1 to 3 of 3

Thread: script doesent go to the next part

  1. #1
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default script doesent go to the next part

    Code:
    //auto theiver by thehatered(rjj95)
    program Autotheiver;
      Procedure LootCakes;
      Var
        X,Y,I: Integer;
      begin
        wait(800);
        if FindColorTolerance(X,Y,5231294,185,134,208,173,12) then
        begin
          wait(500);
          movemouse(x, y);
          wait(500);
          for i := 0 to High(9) do  //This means repeat the code below 9 times
          begin
            ClickMouse(x, y, Mouse_Left);
            wait(1700);
          end;
          //Now that we've done that 9 times, let's continue the script
          wait(3000);
        end else
          writeln('Failed to find color (table color)');
      end;
      Procedure SellCakes;
      Var
        X,Y: Integer;
      begin
        //find NPC
        wait(1000);
        if FindColorTolerance(x,y,3689566,166,195,194,213,12) then
        begin
          wait(500);
          ClickMouse(x, y, Mouse_Left);
          wait(1200);
        end else
          writeln('Failed to find color (find NPC)');
        //find cake
        if FindColorTolerance(x,y,207164,607,211,635,240,12) then
        begin
          wait(500);
          ClickMouse(x, y, Mouse_Left);
          wait(1200);
        end else
          writeln('Failed to find color (find cake)');
        //sell cake
        if FindColorTolerance(x,y,2070783,550,295,608,311,50) then
        begin
          wait(500);
          ClickMouse(x, y, Mouse_Left);
          wait(1200);
        end else
          writeln('Failed to find color (sell cake)');
    
        //close out
        if FindColorTolerance(x,y,3358280,419,24,501,52,50) then
        begin
          wait(500);
          ClickMouse(x, y, Mouse_Left);
          wait(1200);
        end else
          writeln('Failed to find color (close out)');
        //find square
        if FindColorTolerance(x,y,942420,288,115,321,151,50) then
        begin
          wait(500);
          ClickMouse(x, y, Mouse_Left);
          wait(1200);
        end else
          writeln('Failed to find color (find square)');
      end;
      begin
        LootCakes;
        SellCakes;
      end.
    my script only does the first part were it it suposed to loop 9 times then continue but instead of just loops for ever until i stop the script. btw thanks to flight for cleaning up my original script to make it working

  2. #2
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    for i := 0 to High(9) do

    should be

    for i := 0 to 9 do

    High is only used on arrays(sort of lists). That would return the highest number out of the array, but since 9 is an integer, you should just use 9.
    Working on: Tithe Farmer

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

    Default

    Quote Originally Posted by masterBB View Post
    for i := 0 to High(9) do

    should be

    for i := 0 to 9 do

    High is only used on arrays(sort of lists). That would return the highest number out of the array, but since 9 is an integer, you should just use 9.
    I've never used a static integer for such a loop, so I've always used High() + a given array. I feel dumb.

    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..."


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •