Jump to content
UBot Underground

Loop While issue


Recommended Posts

Hey so i am trying to use loop while..

i can use it properly with 1 condition... but lets say that condition doestn get met EVEr... then itll loop forever.. so i wanted to add a 'backup' condition..

 

so i added the EITHER command. added my first condition..

then added my 2nd condition which = #loopcount <= 5

so loop while the loop count is less than 5 and on each loop i inc #loopcount

 

anyways...

 

when i tested... after the 5 loops it would still continue to go no matter what i would try...

am i doing it wrong?

Link to post
Share on other sites

I already deleted the code because it wasnt working.. but basically...

 

I want it to loop my code until X exists ( which works fine ) OR until it loops 5 times(which wont work).

Link to post
Share on other sites

Try this (developing the code from Kreatus a bit further):

 

set(#position, 0, "Global")
ui stat monitor("Position: ", #position)
loop while($either($exists(<innertext="Whatever you are looking for">), $comparison(#position, "!=", 5))) {
   wait(1)
   increment(#position)
}

Link to post
Share on other sites

The reason for this is because Either is the wrong qualifier.

 

if you do loop while($either("A","B") it will loop while A is true OR B is true, if both of them are not true then it will stop

 

What you want to use is $both:

 

if you do loop while($both("A","B") it will loop while A is true AND B is true, so when one of those is not true then it will stop

 

 

John

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...