Results 1 to 12 of 12

Thread: Loop Help

  1. #1
    Join Date
    May 2007
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Loop Help

    SCAR Code:
    Count := 0;
    repeat
      Wait(200 + (Random(500)));
      AntiRandom;
      Int(Count);
    until(Count = 20);

    could anyone offer an explanation on why this loop doesn't end before i log out automatically?

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

    Default

    Shouldn't it be

    SCAR Code:
    inc(count)

    not

    SCAR Code:
    int(count)
    “Ignorance, the root and the stem of every evil.”

  3. #3
    Join Date
    May 2007
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Let me try, thanks for the reply.

    edit: yeah that was my problem i think, thanks!

  4. #4
    Join Date
    May 2007
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Now I've come across another problem that i didn't encounter last night when i was testing/debugging.

    SCAR Code:
    Function FindFountain : boolean;
    Var
      Bx, By : Integer;
      Full : Integer;
      Empty : Integer;
      count : Integer;
      x1, y2 : Integer;
    Begin                     //////////////INSERT FOUNTAIN COLOR////////////////
      if(FindColorTolerance(Bx,By,14198672,MSX1,MSY1,MSX2,MSY2,25)) then
        Begin
          Full := DTMFromString('78DA633CCBC4C050C7C8800C162F3F08A661A' +///////full Vial
          '28CB7806AAA50D5C064E16AAE02D5141250731DA82687809A8B40' +
          '356904D49C02AAA924C29C66FC6A00E5E10B2B');
          Empty := DTMFromString('78DA633CCFC4C030879101199495578069982' +///////empty Vial
          '8E30DA09AD9A86A60B27035B7816A1613507316A86619116AA613' +
          '500372731F0135D7816A26E0570300E43A0B86');
          WriteLn('Found Fountain');
          if(FindDTM(Empty, x1, y2, MIX1, MIY1, MIX2, MIY2))then
            begin
              WriteLn('Filling Vials...')
              Mouse(x1, y2, 5, 5, true);
              Mouse(Bx, By, 5, 5, true);
              Count := 0;
              repeat
                Wait(200 + (Random(500)));
                AntiRandom;
                Inc(Count);
              until(Count = 20);
            end;
        end else
          Result := False;
          WriteLn('Couldnt Find Fountain')
          Exit;

    end;

    When it walks to the fountain it says both Found Fountain and Couldn't Find Fountain so i'm having trouble seeing where the problem is .

  5. #5
    Join Date
    Aug 2008
    Posts
    196
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    For one thing, There aren't any semicolons after the writelns.
    Nice script though.

  6. #6
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes, there are semi-colons after pretty much every line.
    SCAR Code:
    Function FindFountain : boolean;
    Var
      Bx, By : Integer;
      Full : Integer;
      Empty : Integer;
      count : Integer;
      x1, y2 : Integer;
    Begin                     //////////////INSERT FOUNTAIN COLOR////////////////
      if(FindColorTolerance(Bx,By,14198672,MSX1,MSY1,MSX2,MSY2,25)) then
        Begin
          Full := DTMFromString('78DA633CCBC4C050C7C8800C162F3F08A661A' +///////full Vial
          '28CB7806AAA50D5C064E16AAE02D5141250731DA82687809A8B40' +
          '356904D49C02AAA924C29C66FC6A00E5E10B2B');
          Empty := DTMFromString('78DA633CCFC4C030879101199495578069982' +///////empty Vial
          '8E30DA09AD9A86A60B27035B7816A1613507316A86619116AA613' +
          '500372731F0135D7816A26E0570300E43A0B86');
          WriteLn('Found Fountain');
          if(FindDTM(Empty, x1, y2, MIX1, MIY1, MIX2, MIY2))then
            begin
              WriteLn('Filling Vials...');
              Mouse(x1, y2, 5, 5, true);
              Mouse(Bx, By, 5, 5, true);
              Count := 0;
              repeat
                Wait(200 + (Random(500)));
                AntiRandom;
                Inc(Count);
              until(Count = 20);
            end;
        end else
          begin //This
            Result := False;
            WriteLn('Couldnt Find Fountain');
            Exit;
          end; //This
    end;

    You need a begin/end after your end else :]

  7. #7
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    end else
          Result := False;
          WriteLn('Couldnt Find Fountain')
          Exit;
    Should be:
    SCAR Code:
    end else
          Begin
            Result := False;
            WriteLn('Couldnt Find Fountain')
            Exit;
          End;


  8. #8
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lawlz. I beat j00 Cazax =]

    Are you making a clay softener yvw?

  9. #9
    Join Date
    May 2007
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm making a VEB vial filler and i've encountered another problem. Fixing the end else showed that something was wrong with the dtm part of the function. any tips? sorry for all the hassle!

  10. #10
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by yvw master View Post
    I'm making a VEB vial filler and i've encountered another problem. Fixing the end else showed that something was wrong with the dtm part of the function. any tips? sorry for all the hassle!
    Make the DTM's again? add tolerance? also use end else when you are searching for the DTM's.

    Remember to use:
    SCAR Code:
    FreeDTM(dtmName);
    So you won't get a memory leak


  11. #11
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Try this

    SCAR Code:
    Function FindFountain : boolean;
    //credits to noidea
    Var
      Bx, By : Integer;
      Full : Integer;
      Empty : Integer;
      count : Integer;
      x1, y2 : Integer;
    Begin                     //////////////INSERT FOUNTAIN COLOR////////////////
      Full := DTMFromString('78DA633CCBC4C050C7C8800C162F3F08A661A' +///////full Vial
          '28CB7806AAA50D5C064E16AAE02D5141250731DA82687809A8B40' +
          '356904D49C02AAA924C29C66FC6A00E5E10B2B');
      Empty := DTMFromString('78DA633CCFC4C030879101199495578069982' +///////empty Vial
          '8E30DA09AD9A86A60B27035B7816A1613507316A86619116AA613' +
          '500372731F0135D7816A26E0570300E43A0B86');
      if(FindColorTolerance(Bx,By,14198672,MSX1,MSY1,MSX2,MSY2,25)) then
      Begin
        WriteLn('Found Fountain');
        if(FindDTM(Empty, x1, y2, MIX1, MIY1, MIX2, MIY2))then
        begin
          WriteLn('Filling Vials...')
          Mouse(x1, y2, 5, 5, true);
          Mouse(Bx, By, 5, 5, true);
          repeat
            Wait(200 + (Random(500)));
            AntiRandom;
          until(not(FindDTM(Empty, x1, y2, MIX1, MIY1, MIX2, MIY2)))
        end;
      end else
      begin
        Result := False;
        WriteLn('Couldnt Find Fountain')
        freeDTM(Empty)
        freeDTM(Full)
        Exit;
      end;
      freeDTM(Empty)
      freeDTM(Full)
      Result := True;
    end;
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  12. #12
    Join Date
    Aug 2008
    Posts
    196
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    There weren't any semicolons after the writelns for the couldnt find fountains
    in the script that HE posted..

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. need for to do loop help
    By Raskolnikov in forum OSR Help
    Replies: 6
    Last Post: 07-02-2008, 03:21 AM
  2. Need help with Loop
    By Brenth in forum OSR Help
    Replies: 2
    Last Post: 12-31-2007, 05:35 PM
  3. Loop help?
    By Becks in forum OSR Help
    Replies: 3
    Last Post: 10-23-2007, 10:32 AM
  4. Help with loop
    By skullbr00d in forum OSR Help
    Replies: 0
    Last Post: 05-29-2007, 09:23 PM
  5. loop
    By macromacro123 in forum OSR Help
    Replies: 4
    Last Post: 03-18-2007, 07:50 PM

Posting Permissions

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