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
  • Timer


    kamilo

    Recommended Posts

    Posted

    Creating my own break handler, so since i have a Timer timer = new Timer() running i was wondering how could pause this timer during the break; ofcourse i would manually disable login etc.. but i also want to pause/resume this Timer from dreambot api, but nothing in the api has a pause button etc..

     

    can someone help

    Posted

    also is the timer.elapsed() in milliseconds? i know its a long value but not sure its is ms 

    Posted

    save the remaining in a double... stop the timer.. create a new timer with the double amount.

    //Start a timer
    Timer timer = new Timer(1000); //1 second
    
    //Pause
    double remaining = timer.remaining(); //milliseconds
    timer = null;
    
    //Resume
    timer = new Timer(remaining);

     

    Posted
    7 minutes ago, Defiled said:

    save the remaining in a double... stop the timer.. create a new timer with the double amount.

    
    //Start a timer
    Timer timer = new Timer(1000); //1 second
    
    //Pause
    double remaining = timer.remaining(); //milliseconds
    timer = null;
    
    //Resume
    timer = new Timer(remaining);

     

    That's a cool trick. I'm sure I'll make use of this, thanks

    Posted
    59 minutes ago, Succulent said:

    That's a cool trick. I'm sure I'll make use of this, thanks

    enjoi 😛

    Posted
    8 hours ago, Defiled said:

    enjoi 😛

    i love the brilliant people on this forum :)

    Posted
    10 hours ago, Defiled said:

    save the remaining in a double... stop the timer.. create a new timer with the double amount.

    
    //Start a timer
    Timer timer = new Timer(1000); //1 second
    
    //Pause
    double remaining = timer.remaining(); //milliseconds
    timer = null;
    
    //Resume
    timer = new Timer(remaining);

     

    why are u doing new Timer(1000) instead of new Timer(); does it make a difference

    or does it set the increment in milliseconds

    Posted
    35 minutes ago, kamilo said:

    why are u doing new Timer(1000) instead of new Timer(); does it make a difference

    or does it set the increment in milliseconds

    1000 is the parameter for the countdown amount in milliseconds.. so if you set it to 1000 it'll count 1 second then it'll return finished() 

    Posted
    19 minutes ago, Defiled said:

    1000 is the parameter for the countdown amount in milliseconds.. so if you set it to 1000 it'll count 1 second then it'll return finished() 

    got it!, what if i start a timer counting upwards, just new Timer();, for checking how long the script is run for

    how would i go about pausing that, cuz the code seems to be like a stop watch and counts down, but i want to count upwards (duration of the sript running), then pause (for break so its not included in total time ran), then resume choosing my own conditions

    Archived

    This topic is now archived and is closed to further replies.

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