earthlingj 13 Posted June 26, 2012 Report Share Posted June 26, 2012 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? Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted June 26, 2012 Report Share Posted June 26, 2012 Hi, Please post your code here so we can understand it more. Quote Link to post Share on other sites
earthlingj 13 Posted June 26, 2012 Author Report Share Posted June 26, 2012 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). Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted June 26, 2012 Report Share Posted June 26, 2012 Something like this? set(#position, 0, "Global") ui stat monitor("Position: ", #position) loop while($comparison(#position, "!=", 5)) { wait(1) increment(#position) } Quote Link to post Share on other sites
earthlingj 13 Posted June 26, 2012 Author Report Share Posted June 26, 2012 Yes thats what i have but i am trying to make it match EITHER 1 condition or the other. and whenever i use the EITHER and put in both conditions in NEVER works out. Quote Link to post Share on other sites
malefic 48 Posted June 26, 2012 Report Share Posted June 26, 2012 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) } Quote Link to post Share on other sites
JohnB 255 Posted June 26, 2012 Report Share Posted June 26, 2012 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 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.