Jump to content
UBot Underground

Is There A Command Like Break/continue In Uot?


Recommended Posts

Im new here and I used loop a lot, just wonder what did you guys do when you need a break/continue operation.

 

If you have a large amount of code you need to place several check points.

on load("Bot Loaded") {
    set(#Running,$false,"Global")
}
ui button("Start") {
    if($not(#Running)) {
        then {
            Run()
        }
        else {
        }
    }
}
ui button("Pause") {
    set(#LoopPause,$true,"Global")
}
ui button("Resume") {
    set(#LoopPause,"false","Global")
}
set(#LoopPause,"true","Global")
ui button("Stop") {
    set(#Stop,$true,"Global")
    set(#Running,"false","Global")
}
ui stat monitor("Number: ",#Num)
define Run {
    set(#Running,"true","Global")
    set(#LoopPause,$false,"Global")
    set(#Num,0,"Global")
    set(#Stop,"false","Global")
    loop(10) {
        PauseCheckPoint()
        wait(1)
        increment(#Num)
        PauseCheckPoint()
    }
    set(#Running,"false","Global")
}
define PauseCheckPoint {
    if(#Stop) {
        then {
            stop script
        }
    }
    loop while(#LoopPause) {
        wait(1)
    }
}
  • Like 2
Link to post
Share on other sites

 

If you have a large amount of code you need to place several check points.

on load("Bot Loaded") {
    set(#Running,$false,"Global")
}
ui button("Start") {
    if($not(#Running)) {
        then {
            Run()
        }
        else {
        }
    }
}
ui button("Pause") {
    set(#LoopPause,$true,"Global")
}
ui button("Resume") {
    set(#LoopPause,"false","Global")
}
set(#LoopPause,"true","Global")
ui button("Stop") {
    set(#Stop,$true,"Global")
    set(#Running,"false","Global")
}
ui stat monitor("Number: ",#Num)
define Run {
    set(#Running,"true","Global")
    set(#LoopPause,$false,"Global")
    set(#Num,0,"Global")
    set(#Stop,"false","Global")
    loop(10) {
        PauseCheckPoint()
        wait(1)
        increment(#Num)
        PauseCheckPoint()
    }
    set(#Running,"false","Global")
}
define PauseCheckPoint {
    if(#Stop) {
        then {
            stop script
        }
    }
    loop while(#LoopPause) {
        wait(1)
    }
}

Terrific! Thanks for your replay, I just browsed the plugins that you've built for ubot. I think they were hardcore coder's work.

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