Results 1 to 4 of 4

Thread: whats so bad about 'until(false)'

  1. #1
    Join Date
    Feb 2012
    Posts
    212
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default whats so bad about 'until(false)'

    Hey guys, just a general question.

    Is using until(false) bad scripting practice? Like take a look at my code below. Just wanted multiple peoples opinions.

    Is there anyway that my code could create an infinite loop?

    THANX

    Simba Code:
    Repeat
      FindNormalRandoms;
        if FindDTM (burner, x, y, 109, 14, 317, 196) then
          begin
            mouse(x, y, 2, 2, true);
            AntiBan;
            MarkTime(t);
            Repeat
              if TimeFromMark(t) > 5000 then
                break;
              wait(1)
            Until(ExistsItem(2) = false);
          end;
        if ExistsItem(2) then
          begin
            i:= i + 1
          end else
          begin
            Break;
          end;

        if i = 5 then
          begin
            WriteLn('Unable to light burnner 1, Logging Out');
            Logout;
            TerminateScript;
          end;
      Until(false);
    Previously known as sockz
    - Dwarven Stout buyer (F2P MONEYMAKER) http://villavu.com/forum/showthread....45#post1001045
    - G-Altar script, tons of failsafes. (Flawless for me) http://villavu.com/forum/showthread.php?t=79454

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

    Default

    Nothing wrong with using (false) to trigger a constant loop, as long as there's failsafes (which you have) to break the loop no matter what. I cleaned it up a bit for ya so it's easier to understand.

    Simba Code:
    Repeat
        FindNormalRandoms;

        if FindDTM (burner, x, y, 109, 14, 317, 196) then
        begin
          mouse(x, y, 2, 2, true);
          AntiBan;

          MarkTime(t);
          Repeat
            if TimeFromMark(t) > 5000 then
              break;
            wait(1)
          Until(not ExistsItem(2));

        end;

        if ExistsItem(2) then
          Inc(i)
        else
          Break;

        if (i = 5) then
        begin
          WriteLn('Unable to light burnner 1, Logging Out');
          Logout;
          TerminateScript;
        end;

      Until(false);

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


  3. #3
    Join Date
    Jul 2009
    Location
    Australia
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    The only time that a loop becomes 'bad' is when there is a circumstance that will cause the loop to never break.
    An example of this would be using a loop that waits for a boolean value, maybe the existence of a colour, before breaking the loop, the issues occurs when the scripter has not put in a failsafe if this colour should randomly not appear.

    ~Caotom

  4. #4
    Join Date
    Feb 2012
    Posts
    212
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks a heap guys, updated my script, gonna release... V1
    Previously known as sockz
    - Dwarven Stout buyer (F2P MONEYMAKER) http://villavu.com/forum/showthread....45#post1001045
    - G-Altar script, tons of failsafes. (Flawless for me) http://villavu.com/forum/showthread.php?t=79454

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
  •