Results 1 to 5 of 5

Thread: Whilte not ... do multiple statements?

  1. #1
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default Whilte not ... do multiple statements?

    I want to make a simple loop that looks for either "Fail" in the chatbox or for "open" in the chatbox. Both will appear on line 8.

    The following code does not work, it only works if the chatbox has "fail" on rule 8 and it is stuck if it actually opens something and gets "open" in the chatbox.

    How can I fix this?

    Simba Code:
    begin;
      while not (FindChatBoxText('fail', 8, clBlack)) or (FindChatBoxText('open', 8, clBlack)) do
      Wait(50);
    end;

    EDIT: I've found a way to avoid this now
    Simba Code:
    begin;
        repeat
        Wait(100+random(100));
        until FindChatBoxText('fail', 8, clBlack) or FindChatBoxText('open', 8, clBlack);
      end;
    This works. If anyone has any tips though, let me know.
    Last edited by J J; 02-28-2012 at 09:01 PM.

    Script source code available here: Github

  2. #2
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    the first one the logic is off...

    You should have, "while not(this) and not(this)"

  3. #3
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    Quote Originally Posted by footballjds View Post
    the first one the logic is off...

    You should have, "while not(this) and not(this)"
    But if you do that it will be waiting until it has found BOTH? I just need to find one. "and" makes me think that the script will be waiting until finding both, or does While Not always searches for one?

    Script source code available here: Github

  4. #4
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    Quote Originally Posted by RuneScapeJJ View Post
    But if you do that it will be waiting until it has found BOTH? I just need to find one. "and" makes me think that the script will be waiting until finding both, or does While Not always searches for one?
    take what you "think" out of the equation and use logic...


    If i told you to run and to keep running while you DON'T see a fairy AND you DON'T see the Easter bunny. Would you stop running when you saw just one? Yes.

    for example, the following two have the same "logic" although they're different loops:
    Simba Code:
    while not(Thirsty) and not(Hungry) do
        StarveYourself;
     

      repeat
        StarveYourself;
      until Thirsty or Hungry;

  5. #5
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by RuneScapeJJ View Post
    But if you do that it will be waiting until it has found BOTH? I just need to find one. "and" makes me think that the script will be waiting until finding both, or does While Not always searches for one?
    OR = Can be one or the other, or both.
    XOR = Can be one or the other, not both.
    AND = Must be both.

    NOT = The opposite to the operation applied above.

    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

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
  •