emilix85 0 Posted May 2, 2013 Report Share Posted May 2, 2013 Hi guys i have to make a $comparision in a loop while: the "equal" value is "=" or "=="? run the loop while until $comparision >>> (#variabile is equal ( "=" or "==" ?) a "name") is true If the $comparision is true stay in loop and follow the instructionsIf it is false exit loop. Thanks Quote Link to post Share on other sites
UBotDev 276 Posted May 2, 2013 Report Share Posted May 2, 2013 The EQUAL operator is "=", you can find it in a drop-down: http://screencast.com/t/s56Cffsm Here is an example script: ui stat monitor("i:", #i) ui stat monitor("Var:", #variable) set(#i, 0, "Global") set(#variable, "run", "Global") loop while($comparison(#variable, "=", "run")) { wait(1) if($comparison(#i, ">=", 10)) { then { set(#variable, "stop", "Global") } else { increment(#i) } } } You could also set #variable to "$true" or "$false" and you wouldn't have to use $comparison. Quote Link to post Share on other sites
emilix85 0 Posted May 2, 2013 Author Report Share Posted May 2, 2013 (edited) yes thanks but my problem is this: i have 2 loop (Loop and Loop2): Loop() define Loop { set(#Contatore, $trim($scrape attribute(<outerhtml=w"<span id=\"*\"><span class=\"*\"> * </span></span>">, "innertext")), "Global") loop while($comparison(#Contatore, ">", 80)) { set(#Contatore, $trim($scrape attribute(<outerhtml=w"<span id=\"*\"><span class=\"*\"> * </span></span>">, "innertext")), "Global") } if($both($comparison(#Contatore, "<=", 80), $comparison(#Username, "!=", "Offerta più alta:{#Account}"))) { then { click(<outerhtml=w"<input type=\"button\" id=\"*\" onclick=\"*\" value=\"PUNTA\">">, "Left Click", "No") wait(3) Loop2() } } } Loop2() define Loop2 { set(#Username, $trim($scrape attribute(<outerhtml=w"<span id=\"*\">Offerta più alta:<br>*</span>">, "innertext")), "Global") loop while($comparison(#Username, "=", "Offerta più alta:{#Account}")) { set(#Username, $trim($scrape attribute(<outerhtml=w"<span id=\"*\">Offerta più alta:<br>*</span>">, "innertext")), "Global") } if($comparison(#Username, "=", "Ha vinto:{#Account}")) { then { stop script } else { Loop() } } } The first loop (loop) work fine (the variable "#contatore" is followed until is > 80 )The 2nd loop (loop2) don't work, even if the variable "#username" respects the condition...the strange thing is that if I use the value "=!" instead of "=" the loop work fine!It's like if don't recognize the value "="Thanks Edited May 2, 2013 by emilix85 Quote Link to post Share on other sites
UBotDev 276 Posted May 3, 2013 Report Share Posted May 3, 2013 The problem is not in recognizing the operator "=", that works just fine...I think the problem is in input. Since you didn't provide the whole code I can't test much here. Have you checked in debugger what variable username actually contains? What if you try to compare the to format #Username a bit, like: set(#Username, $replace regular expression($trim($scrape attribute(<outerhtml=w"<span id=\"*\">Offerta più alta:<br>*</span>">, "innertext")), "^[^:]*\\:", ""), "Global") Then comparison would look like: loop while($comparison(#Username, "=", #Account)) { } Also make sure that text casing is not a problem; if it is, convert both #Account and #Username to lowercase and compare afterwards. EDIT: I've just noticed that you call Loop2 from Loop, but then you also call Loop from Loop2, and just wanted to say that you should be careful with that.....if the conditions aren't meet you could get stuck inside forever, (getting deeper and deeper into the recursive loops). Quote Link to post Share on other sites
emilix85 0 Posted May 3, 2013 Author Report Share Posted May 3, 2013 EDIT: I've just noticed that you call Loop2 from Loop, but then you also call Loop from Loop2, and just wanted to say that you should be careful with that.....if the conditions aren't meet you could get stuck inside forever, (getting deeper and deeper into the recursive loops). Yes Thanks this is just what I want As for the loop I think I've figured out the problem...the value that the variabile #username extract whit $scrapeattribute is this: set(#Username, $trim($scrape attribute(<outerhtml=w"<span id=\"*\">Offerta più alta:<br>*</span>">, "innertext")), "Global") the tag "<br>" don't call a space but enter line breaks, then the function $trim don't need; for this reason does not recognize the value in the loop whileI need a function that removes the tag <br> What can I use? Thanks Quote Link to post Share on other sites
UBotDev 276 Posted May 3, 2013 Report Share Posted May 3, 2013 Nice to hear.... Just use a UBot replace function and replace <br>. 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.