kamilo 7 Share Posted June 26, 2020 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 Link to comment Share on other sites More sharing options...
kamilo 7 Author Share Posted June 26, 2020 also is the timer.elapsed() in milliseconds? i know its a long value but not sure its is ms Link to comment Share on other sites More sharing options...
Defiled 423 Share Posted June 26, 2020 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); Link to comment Share on other sites More sharing options...
Succulent 18 Share Posted June 26, 2020 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 Link to comment Share on other sites More sharing options...
Defiled 423 Share Posted June 26, 2020 59 minutes ago, Succulent said: That's a cool trick. I'm sure I'll make use of this, thanks enjoi 😛 Link to comment Share on other sites More sharing options...
kamilo 7 Author Share Posted June 26, 2020 8 hours ago, Defiled said: enjoi 😛 i love the brilliant people on this forum Link to comment Share on other sites More sharing options...
kamilo 7 Author Share Posted June 26, 2020 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 Link to comment Share on other sites More sharing options...
Defiled 423 Share Posted June 26, 2020 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() Link to comment Share on other sites More sharing options...
kamilo 7 Author Share Posted June 26, 2020 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.