Results 1 to 3 of 3

Thread: How do I make when else happens it repeats the if?

  1. #1
    Join Date
    Mar 2013
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    22 Post(s)

    Default How do I make when else happens it repeats the if?

    When I tried to make it work it fails me. Could someone please correct this so it works out good
    thank you

    Simba Code:
    program new;

    //{.include srl/srl.scar}
    {$I SRL/SRL.Simba}

    var
      LogBalance1, LogBalance2, LogBalance3, LogBalance4, LogBalance5, LogBalance6, LogBalance7, LogBalance8 : integer;


    Procedure LoadColor;
    begin

      LogBalance1 := 605282;
      LogBalance2 := 604509;
      LogBalance3 := 605798;
      LogBalance4 := 602190;
      LogBalance5 := 606571;
      LogBalance6 := 603480;
      LogBalance7 := 603219;
      LogBalance8 := 601162;


    end;

    procedure CrossLogBalance;

    var
      x, y : integer;
      aFound : extended;

    begin

    if  FindColorSpiralTolerance( x, y, LogBalance1, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance2, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance3, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance4, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance5, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance6, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance7, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance8, 180, 160, 327, 226, 1) then
        begin
          writeln('Found Log Balance');
          Mouse( x, y, 1, 1, True);
        end else
          Writeln('Log Balance NOT found... Attempting to retry...');
          Wait(1000);
          CrossLogBalance;

    end;

    begin
      LoadColor;
      SetAngle(SRL_ANGLE_HIGH);
      MouseSpeed:= 20;
      MakeCompass('n');
      CrossLogBalance;
    end.

  2. #2
    Join Date
    Sep 2012
    Location
    Australia.
    Posts
    839
    Mentioned
    16 Post(s)
    Quoted
    225 Post(s)

    Default

    My guess is that you need a begin..end after the end else.

    Simba Code:
    procedure CrossLogBalance;
    var
      x, y : integer;
      aFound : extended;
    begin
    if  FindColorSpiralTolerance( x, y, LogBalance1, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance2, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance3, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance4, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance5, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance6, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance7, 180, 160, 327, 226, 1) or
        FindColorSpiralTolerance( x, y, LogBalance8, 180, 160, 327, 226, 1) then
        begin
          writeln('Found Log Balance');
          Mouse( x, y, 1, 1, True);
        end else
        begin
          Writeln('Log Balance NOT found... Attempting to retry...');
          Wait(1000);
          CrossLogBalance;
        end;
    end;

    Remember, if there's more than one action after the else, it needs a begin. Same with if..then's.

  3. #3
    Join Date
    Mar 2013
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    22 Post(s)

    Default

    Thank You very much. That did the trick.

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
  •