Jump to content
UBot Underground

Value "==" in Loop While


Recommended Posts

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 instructions
If it is false exit loop.
 
Thanks

 

 

 

Link to post
Share on other sites

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.

Link to post
Share on other sites

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 by emilix85
Link to post
Share on other sites

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

Link to post
Share on other sites

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 while

I need a function that removes the tag <br>
 
What can I use? Thanks
;)
 
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...