Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Continuity with calculations.random()


    Recommended Posts

    In the snippet below

    int x = Calculations.random(1,3);
        //some code
        //some other code

    How to continue the flow of execution? Every time onLoop will iterate, a new value gets assigned to x and the codes that get executed may change. How to ensure only one segment gets executed after the first iteration. if x ==1, only some code should get executed and shouldn't flip between some other code till a new condition doesn't trigger the change.

    Link to comment
    Share on other sites

    not exactly sure if i understand you, but it sounds like you want to set x to a random number in onstart, and then dont set it again until your code is completed in the if/else statement


    psuedo code:
    onstart {
    x = Calculations.random(1,3);
    loop() {
    if(x = 1) {
    	if(//your code to execute) {
    } else {
    	if(//your other code to execute) {


    Edited by CodeNinja
    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.