Jump to content
UBot Underground

kate

Members
  • Content Count

    35
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by kate

  1. I'm trying to test how ubot treat boolean value, this is WIP, hope it helps

     

    CONCLUSION:

    - if somehow ubot skip your "if" command then maybe the condition is wrong

    - WIP

     

    set(#log,"","Global")
    ui html panel("<html><body><div variable='#log' fillwith='innerhtml'></div></body></html>",700)
    comment("python, TODO")
    
    comment("ubot")
    set(#test,"false","Global")
    purpose("Testing false string from variable")
    if(#test) {
        then {
            log("true")
        }
        else {
            log("false")
        }
    }
    set(#test,"true","Global")
    purpose("Testing true string from variable")
    if(#test) {
        then {
            log("true")
        }
        else {
            log("false")
        }
    }
    set(#test,"true","Global")
    purpose("Testing #test = \"true\"")
    if(#test="true") {
        then {
            log("true")
        }
        else {
            log("false")
        }
    }
    set(#test,"true","Global")
    purpose("Testing #test = $true")
    if(#test=$true) {
        then {
            log("true")
        }
        else {
            log("false")
        }
    }
    purpose("Testing string \"true\"")
    if("true") {
        then {
            log("true")
        }
        else {
            log("false")
        }
    }
    purpose("Testing string \"false\"")
    if("false") {
        then {
            log("true")
        }
        else {
            log("false")
        }
    }
    purpose("Testing 1")
    if(1) {
        then {
            log("1 is true")
        }
        else {
            log("1 is false")
        }
    }
    purpose("Testing 1=1")
    if(1 = 1) {
        then {
            log("1=1 is true")
        }
        else {
            log("1=1 is false")
        }
    }
    purpose("Testing \"1\"")
    if(1) {
        then {
            log("1 is true")
        }
        else {
            log("1 is false")
        }
    }
    purpose("Testing $true")
    if($true) {
        then {
            log("$true is true")
        }
        else {
            log("$true is false")
        }
    }
    purpose("Testing $false")
    if($false) {
        then {
            log("$false is true")
        }
        else {
            log("$false is false")
        }
    }
    comment("javascript")
    purpose("Testing $eval(\"true\")")
    if($eval("true")) {
        then {
            log("$eval(\"true\") is true")
        }
        else {
            log("eval(\"true\") is false")
        }
    }
    purpose("Testing $eval(\"false\")")
    if($eval("false")) {
        then {
            log("$eval(false) is true")
        }
        else {
            log("$eval(false) is false")
        }
    }
    purpose("Testing $eval(\"TRUE\")")
    if($eval("TRUE")) {
        then {
            log("$eval(TRUE) is true")
        }
        else {
            log("$eval(TRUE) is false")
        }
    }
    purpose("Testing $eval(\"True\")")
    if($eval("True")) {
        then {
            log("$eval(1) is true")
        }
        else {
            log("$eval(1) is false")
        }
    }
    purpose("Testing $eval(\"1\")")
    if($eval(1)) {
        then {
            log("$eval(1) is true")
        }
        else {
            log("$eval(1) is false")
        }
    }
    
    
    
    RESULT:

    Purpose: Testing false string from variable
    Log: false
    Purpose: Testing true string from variable
    Log: true
    Purpose: Testing #test = "true"
    Log: true
    Purpose: Testing #test = $true
    Log: true
    Purpose: Testing string "true"
    Log: true
    Purpose: Testing string "false"
    Log: false
    Purpose: Testing 1
    Purpose: Testing 1=1
    Log: 1=1 is true
    Purpose: Testing "1"
    Purpose: Testing $true
    Log: $true is true
    Purpose: Testing $false
    Log: $false is false
    Purpose: Testing $eval("true")
    Log: $eval("true") is true
    Purpose: Testing $eval("false")
    Log: $eval(false) is false
    Purpose: Testing $eval("TRUE")
    Purpose: Testing $eval("True")
    Purpose: Testing $eval("1")
    
    missing "Log: false / Log: true" it means ubot skip that "if" command
  2. Hi

     

    Code:

    ui text box("Test Value",#test)
    ui button("Test 1") {
        if($is number(#test)) {
            then {
                alert("Yes its number")
            }
            else {
                alert("It should be number")
                stop script
            }
        }
    }
    ui button("test 2") {
        if($comparison($is number(#test),"= Equals",$false)) {
            then {
                alert("It should be number")
                stop script
            }
            else {
                alert("Yes its number")
            }
        }
    }
    
    

    This test to prove

    $is number

    return value is not same as

    $comparison

    return value

     

    image:

    http://i.imgur.com/ANRPIkp.png

    i cant find doc on this, hope it helps others.

     

    ( btw, is it bug ? )

  3. Save your HTML template in separate file, then load it with ui html panel, if you change the html file, just edit "ui html panel" and save. Ubot will reload that html file.

    This is usefull if you have huge html, it will not clutter your code view, and make ubot studio happy(at least on my crappy comp)

    ui html panel($read file("{$special folder("Application")}\\template2.html"),350)
    

    ???

    sorry too fast to hit enter

  4. Hi
     
    First, if its not right place feel free to move it
     
    As ubot beginner, there's learning curve that we must pass.
    Here i'll post Miscellaneous Tips that i find usefull as ubot beginner, hope it helps other
    i'll also shamelessly post other uboter tips that i can find(offcourse, credit due where its due)
     
    TO SENIOR UBOTTER :
    Please jump in and add, we need your wisdom here
     
    #1. Save HTML Template in separate file 
    #2. Separate your work into defines, One, two
    #3. Ubot studio crash, missing some source code ? Check here
    #4. How to add JQUERY in your ubot browser

    #5. JSON Parser, One, two

    #6. Ubot custom selector : XPATH, CSS Selector

    #7. Want to test random HTML panel's without needing to compile a whole new bot ?

    #8. $false not same as $is number 's "false"

    #9. Add "wait" after "run javascript"

    10. Python boolean != Ubot boolean

×
×
  • Create New...