Results 1 to 3 of 3

Thread: If..Then...Begin...End Else loop help

  1. #1
    Join Date
    Mar 2012
    Location
    Over there
    Posts
    840
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default If..Then...Begin...End Else loop help

    Here is a segment of code from a procedure that im not sure is working correctly.

    Simba Code:
    if FindDTMRotated(PathToAltarDTMs[0], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
      begin
        Mouse(x, y, 3, 3, True);
        FFlag(8);
        MarkTime(T1);
        repeat
          Wait(50 + Random(25));
        until FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(T1) > 10000);
      end else
      begin
        if not FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
        begin
        RadialWalkTolerance(4482162, 114, 130, 40, 1, 1, 23)
          Writeln('Failsafe radial walking 0');
          MarkTime(T1);
          FFlag(8);
          repeat
            Wait(50 + Random(25));
          until FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(T1) > 10000);
        end else
      end;
      if (Not FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound)) then
      begin
        Writeln('Couldnt find path to altar');
        Players[CurrentPlayer].Loc := 'Logout';
      end;

    What its supposed to do if find the dtm, and if it doesnt, then it failsafes to radialwalk, and then if it fails to radialwalk then it logs out. Is the code correct for this or am I doing it wrong?

  2. #2
    Join Date
    Nov 2007
    Location
    Nowhereville
    Posts
    1,155
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Simba Code:
    if FindDTMRotated(PathToAltarDTMs[0], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
    begin
      Mouse(x, y, 3, 3, True);
      FFlag(8);
      MarkTime(T1);
      repeat
        Wait(50 + Random(25));
      until FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(T1) > 10000);
      end else if RadialWalkTolerance(4482162, 114, 130, 40, 1, 1, 23) then
      begin
        Writeln('Failsafe radial walking 0');
        MarkTime(T1);
        FFlag(8);
        repeat
          Wait(50 + Random(25));
        until FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(T1) > 10000);
      end else
      if (Not FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound)) then
      begin
        Writeln('Couldnt find path to altar');
        Players[CurrentPlayer].Loc := 'Logout';
      end;
    Formerly known as Cut em2 it

  3. #3
    Join Date
    Feb 2012
    Posts
    119
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Cut em2 it View Post
    Simba Code:
    if FindDTMRotated(PathToAltarDTMs[0], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
    begin
      Mouse(x, y, 3, 3, True);
      FFlag(8);
      MarkTime(T1);
      repeat
        Wait(50 + Random(25));
      until FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(T1) > 10000);
      end else if RadialWalkTolerance(4482162, 114, 130, 40, 1, 1, 23) then
      begin
        Writeln('Failsafe radial walking 0');
        MarkTime(T1);
        FFlag(8);
        repeat
          Wait(50 + Random(25));
        until FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(T1) > 10000);
      end else
      if (Not FindDTMRotated(PathToAltarDTMs[1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound)) then
      begin
        Writeln('Couldnt find path to altar');
        Players[CurrentPlayer].Loc := 'Logout';
      end;

    I feel like i just learned a lot from reading that code. lol thanks.

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
  •