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
  • Weird issue


    DontGetBanned

    Recommended Posts

    Ive got a few scripts made or playing around with type of thing.. CORRECT code, it DOES work, but for 1 script only IT DOES NOT WORK but the code is COPY PASTE like a skeleton of the code id use so i dont have to retype 1/2 the beginning/generic stuff.. the RUNTIME doesnt appear, the entire paint doenst show up and i do //g.drawstring blah blah.... blacking out that line... and press play, and the rest of the paint will appear.

    Variable:    private Timer timer;

    onStart:     timer = new Timer();

    onloop:   Loop { if (player = condition) { clicking something, sleeping 5 minutes } return 1; }

    paint:      g.drawString("Running for: " + timer.formatTime(), 340, 365);

    whenever i use the combat/mining/etc it seems to all work fine and the paint will show up 100% with Runtimer working as should, this same code is also used across all scripts but it doesnt work on this 1 script and the code is relatively so simple that its performing 1 click action per ~5 minutes. essentially to keep you logged in ...but no run timer will show up if i go // on the g.drawString for runTimer it will let the paint appear actually when starting the script. if i place the variable right into the onstart/paint the Runtimer does appear but wont start the counting..

     

    doing the system format method seems to give me 18409 days: 18 hours : 47 minutes : 00 seconds, the numbers are random but it will count up from there, or random numbers.. but not start at 00:00:01..

    which these codes would be System.currentTimeMillis()  and etc to format the time.. i used PUGS paint tutorial to get the codes.  link for code i used by him. or google it. "pug paint tutorial dreambot"

     

    anyone can help me get this figured out that would be great... like i said, my paint works normally on other scripts using the most basic of line of code...but i cant seem to do it for a script with literally 1 action and etc. i dont know exactly why it wont appear with this script and ONLY this one..

    https://pastebin.com/46zGh9Gp
    
    Link to comment
    Share on other sites

    2 hours ago, Pandemic said:

    It sounds like you aren't initializing your timeBegan variable. Make sure you're setting that to the current time in your script's onStart method :)

    like i said. the code i use... it does work, ANY other script i have i use this and it works flawless for timeand this is method 1 its short simple and works:

    Variable:    private Timer timer;

    onStart:     timer = new Timer();

    onloop:   Loop { if (player = condition) { clicking something, sleeping 5 minutes } return 1; }

    paint:      g.drawString("Running for: " + timer.formatTime(), 340, 365);

    does work, its just for this 1 script i  that doesnt seem to want to let it run.... however if i used all the System.currentmilli etc it doesnt work properly, it gives me a random days hours and minutes without starting at 00:00:00.... so tell me what im doing wrong because i been at this for long enough and cant figure it out....

    either time doesnt appear, time does appear but doesnt count which i do have a "new Timer(); within the code, timeBegin, etc."  and or time does appear/count but gives me a ridiculous number at first

    ive used PUG ultimate paint tutorial as i have in the pastiebin link... this is a 2nd method but you need to have all this time formating + timebegan stuff and System.blah blah blah

    variable: private long timeBegan, timeRan;

    onstart: timeBegan = System.currentTimeMillis();

    Method:

            private String ft(long duration) {

                    String res = "";

                    long days = TimeUnit.MILLISECONDS.toDays(duration);

     long hours = TimeUnit.MILLISECONDS.toHours(duration)  - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));

      long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration));

      long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration));

                    if (days == 0) {res = (hours + ":" + minutes + ":" + seconds);

                    } else {

                    res = (days + ":" + hours + ":" + minutes + ":" + seconds);

                    }

                    return res;

            }

    Paint:  g.DrawString("Running for:  " +  ft(timeRan) ,340,365);

    Paint Variable:      timeRan = System.currentTimeMillis() - this.timeBegan;

     

    so again, please tell me what im doing wrong. these are 2 different methods to make "Time" work on the paint but they dont work, or work properly on my paint with my BASIC OF BASIC scripts. even my powerMining/chopping scripts work with the first method and im not having problems... this script does JACK SHHHHHEEEEETTT really almost a splashing script really but its not gaining xp, targeting anything or doing anything

    it seems those scripts that are gaining exp, walking, banking or doing SOMETHING the timer will work for it normally 

    Link to comment
    Share on other sites

    nevermind- i got it somewhat figured on my own... 

    problem is i have no idea whats wrong with my 1 script, its short sweet and to the point... but i moved the code to my scripts that DO work, removed the "actions" mining/chopping, placed the "click here" instead, and now it shows up with still the basic code, timers work as should, even got a countdown timer before it forces an action which makes my script "run forever"

    Link to comment
    Share on other sites

    8 hours ago, DontGetBanned said:

    nevermind- i got it somewhat figured on my own... 

    problem is i have no idea whats wrong with my 1 script, its short sweet and to the point... but i moved the code to my scripts that DO work, removed the "actions" mining/chopping, placed the "click here" instead, and now it shows up with still the basic code, timers work as should, even got a countdown timer before it forces an action which makes my script "run forever"

    Hey noobie scripter here, trying to get a countdown timer to work for my mining script. Would you mind sharing the script for your countdown timer? Trying to make mine count down random time between 20-25min and then start State "worldhopping", which stops the mining/banking process and hops.

    Link to comment
    Share on other sites

    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.