anyone else have this problem?

Discussion in 'RuneScape 3 Cheating' started by blink182bob, Jan 16, 2009.

anyone else have this problem?
  1. Unread #1 - Jan 16, 2009 at 9:00 PM
  2. blink182bob
    Joined:
    Dec 8, 2008
    Posts:
    309
    Referrals:
    1
    Sythe Gold:
    0

    blink182bob Forum Addict

    anyone else have this problem?

    [19:58:46][ BreakHandler] After 02:55:59, taking break for 00:15:04
    [19:58:51][ BreakHandler] After 02:55:59, taking break for 00:10:59
    [19:58:56][ BreakHandler] After 02:55:59, taking break for 00:14:47
    [19:59:00][ BreakHandler] After 02:55:59, taking break for 00:18:51
    [19:59:05][ BreakHandler] After 02:55:59, taking break for 00:15:34
    [19:59:09][ BreakHandler] After 02:55:59, taking break for 00:13:47

    when running rsbot and when it activates the break handler it just randomly does this, anyone know whats wrong?
     
  3. Unread #2 - Jan 16, 2009 at 9:57 PM
  4. `Denis
    Joined:
    Nov 24, 2007
    Posts:
    476
    Referrals:
    0
    Sythe Gold:
    0

    `Denis Forum Addict

    anyone else have this problem?

    Hmm You need to change the breakhandler script, Ill edit post in few mints.
    Edit -
    Code:
    import com.speljohan.rsbot.script.Random;
    import com.speljohan.rsbot.bot.Bot;
    import com.speljohan.rsbot.event.listeners.PaintListener;
    import com.speljohan.rsbot.script.Methods;
    
    import java.awt.Graphics;
    import java.awt.Color;
    
    import java.util.ArrayList;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.Comparator;
    import java.util.Collections;
    import java.util.Enumeration;
    
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Properties;
    
    public class BreakHandler extends Random implements PaintListener {
    
        private final String confFile = "Settings/breaks.txt";
    
        private long startTime = System.currentTimeMillis();
        private ArrayList<Break> breaks = new ArrayList<Break>();
        private Iterator it;
        private Break curBreak;
        private boolean reset;
        
        private boolean setConfigs = true;
        private long curTime = System.currentTimeMillis();
        private long tookBreakAt = 0;
        long breakLength = 0;
        
        public String getName() {
            return "Break Handler";
        }
    
        public String getAuthor() {                //ported to RSBot by ngovil21
            return "regex, sean, pd";
        }
        
        public double getVersion() {
            return 1;
        }
        
        public void onRepaint(Graphics render) {    
            if (tookBreakAt>0 && System.currentTimeMillis() - tookBreakAt < breakLength) {
                render.setColor(Color.yellow);
                long time = breakLength - (System.currentTimeMillis() - tookBreakAt);
                render.drawString("Break Ends in " + cTime(time),420,15);
                return;
            }
            if(tookBreakAt>0) tookBreakAt = 0;
            if (!reset && !checkForActiveScripts()) {
                reset = true;
                log("No Scripts Running. Reset...");
            }
        }
        
        private boolean checkForActiveScripts() {
            try {
                return !Bot.getScriptHandler().getRunningScripts().isEmpty();
            } catch(Exception e) { }
            return false;
        }
        
    
        public void getConfig() {
            Configuration conf = new Configuration(confFile);
    
            for (Enumeration e = conf.propertyNames(); e.hasMoreElements();) {
                String prop = (String) e.nextElement();
                String val = conf.get(prop);
                String breakVal = val.substring(0, val.indexOf(',')).trim();
                String lengthVal = val.substring(val.indexOf(',') + 1).trim();
                long breakAtMin, breakAtMax, lengthMin, lengthMax;
    
                try {
                    if (breakVal.indexOf('|') != -1) {
                        breakAtMin = Long.parseLong(
                                breakVal.substring(0, breakVal.indexOf('|')).trim());
                        breakAtMax = Long.parseLong(
                                breakVal.substring(breakVal.indexOf('|') + 1).trim());
                    } else {
                        breakAtMax = Long.parseLong(breakVal);
                        breakAtMin = breakAtMax - breakAtMax / 4;
                    }
    
                    if (lengthVal.indexOf('|') != -1) {
                        lengthMin = Long.parseLong(
                                lengthVal.substring(0, lengthVal.indexOf('|')).trim());
                        lengthMax = Long.parseLong(
                                lengthVal.substring(lengthVal.indexOf('|') + 1).trim());
                    } else {
                        lengthMax = Long.parseLong(lengthVal);
                        lengthMin = lengthMax / 2;
                    }
                } catch (Exception ex) {
                    log("Exception loading BreakHandler config (" + prop + " = " + val + ")");
                    ex.printStackTrace();
                    continue;
                }
    
                // convert to ms
                breakAtMin *= 60000;
                breakAtMax *= 60000;
                lengthMin *= 60000;
                lengthMax *= 60000;
    
                Break b = new Break(breakAtMin, breakAtMax, lengthMin, lengthMax);
                breaks.add(b);
            }
    
            Collections.sort(breaks,
                new Comparator<Break>() {
                        public int compare(Break b1, Break b2) {
                            return (int) (b1.getBreakAtMin() - b2.getBreakAtMin());
                        }
                });
    
            it = breaks.iterator();
        }
        
        
        public boolean activateCondition() {
            if (setConfigs) {
                getConfig();
                startTime = System.currentTimeMillis();
                setConfigs = false;
            }
            if (breaks.isEmpty())
                return false;
            if (reset) {
                it = breaks.iterator();
                startTime = System.currentTimeMillis();
                reset = false;
            }
            if (curBreak == null)
                curBreak = (Break) it.next();
            curTime = System.currentTimeMillis();
            if (curBreak.shouldBreak(startTime, curTime))
                return true;
    
            return false;
        }
        
        public int loop() {
            if (curBreak == null)
                return -1;
            if (curBreak.getLengthMin() <= 0) {
                log("After " + cTime(curTime - startTime) + ", shutting down.");
                logout();
                reset = true;
                stopAllScripts();
                return -1;
            } else {
                breakLength = curBreak.randLength();
                log("After " + cTime(curTime - startTime)
                        + ", taking break for " + cTime(breakLength));
                while(getMyPlayer().isInCombat()) {wait(random(5000,6000));}
                wait(random(5000,6000));
                log("Logging out..");
                logout();
                curBreak = null;
                if (!it.hasNext())
                    reset = true;
                tookBreakAt = System.currentTimeMillis();
                return (int)breakLength;
            }
            //return random(1000,2000);
        }
    
        private String cTime(long eTime) {
            long hrs = eTime / 1000 / 3600;
            eTime -= (hrs * 3600 * 1000);
            long mins = eTime / 1000 / 60;
            eTime -= (mins * 60 * 1000);
            long secs = eTime / 1000;
            return String.format("%1$02d:%2$02d:%3$02d", hrs, mins, secs);
        }
        
        public void waitNoException(long t) {
            try {
                Thread.sleep(t);
            } catch (Exception e) {}
        }
    
        protected class Break {
            private final long breakAtMin;
            private final long breakAtMax;
            private final long lengthMin;
            private final long lengthMax;
            private long randBreak=0;
    
            Break(long breakAtMin, long breakAtMax, long lengthMin, long lengthMax) {
                this.breakAtMin = breakAtMin;
                this.breakAtMax = breakAtMax;
                this.lengthMin = lengthMin;
                this.lengthMax = lengthMax;
                this.randBreak = randBreakAt();
            }
    
            private long randLong(long min, long max) {
                return min + (long) (java.lang.Math.random() * (max - min));
            }
    
            public long getBreakAtMin() {
                return breakAtMin;
            }
    
            public long getBreakAtMax() {
                return breakAtMax;
            }
    
            public long getLengthMin() {
                return lengthMin;
            }
    
            public long getLengthMax() {
                return lengthMax;
            }
    
            public long randBreakAt() {
                return randLong(breakAtMin, breakAtMax);
            }
    
            public long randLength() {
                return randLong(lengthMin, lengthMax);
            }
    
            public boolean shouldBreak(long startTime, long curTime) {
                if ((curTime - startTime) > randBreak) {
                    randBreak = randBreakAt();
                    return true;
                } else
                    return false;
            }
        }
        
        public class Configuration {
            private File loadedFrom;
            private Properties props;
            private boolean xml;
    
            /**
             * Reads and parses the specified file; can parse as both
             * XML and standard Properties syntax. If fileName ends with
             * .xml, XML format is assumed.
             *
             * @param fileName The name of the file to parse
             */
            public Configuration(String fileName) {
                loadedFrom = new File(fileName);
                if (fileName.toLowerCase().endsWith(".xml"))
                    xml = true;
                props = new Properties();
                if (loadedFrom.exists()) {
                    FileInputStream fis = null;
                    try {
                        fis = new FileInputStream(loadedFrom);
                        if (xml)
                            props.loadFromXML(fis);
                        else
                            props.load(new FileInputStream(loadedFrom));
                    } catch (IOException ioe) {
                        ioe.printStackTrace();
                    } finally {
                        try {
                            if (fis != null)
                                fis.close();
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
    
            /**
             * Saves the configuration
             */
            public void save() {
                save(loadedFrom, xml);
            }
    
            /**
             * Saves the configuration to specified filename; if the
             * filename ends with .xml, saves in XML format.
             *
             * @param fileName Filename to save to.
             */
            public void save(String fileName) {
                File f = new File(fileName);
                save(f);
            }
    
            /**
             * Saves the configuration to specified File; if the name of
             * the file ends with .xml, saves in XML format.
             *
             * @param f File object to save to
             */
            public void save(File f) {
                save(f, f.getName().toLowerCase().endsWith(".xml"));
            }
    
            /**
             * Saves the configuration to specified File
             *
             * @param f   File object to save to
             * @param xml Whether to save in XML format
             */
            public void save(File f, boolean xml) {
                FileOutputStream fos = null;
                try {
                    if (f.exists())
                        f.delete();
                    f.createNewFile();
                    fos = new FileOutputStream(f);
                    if (xml)
                        props.storeToXML(fos, null);
                    else
                        props.store(fos, null);
                } catch (IOException ioe) {
                    ioe.printStackTrace();
                } finally {
                    try {
                        if (fos != null)
                            fos.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
    
            /**
             * Gets the value of a key
             *
             * @param key The key to retrieve
             * @return The String value of the given key
             */
            public String get(String key) {
                String rv = props.getProperty(key);
                return rv == null ? "" : rv;
            }
    
            /**
             * Gets the value of a key, with a default value to fall back on
             *
             * @param key          The key to retrieve
             * @param defaultValue The default value to use if no such key was available
             * @return The String value of the given key, or the default value
             */
            public String get(String key, String defaultValue) {
                return props.getProperty(key, defaultValue);
            }
    
            public int getInt(String key) {
                String l = get(key);
                if (!l.equalsIgnoreCase("")) {
                    return Integer.parseInt(l);
                } else {
                    return -1;
                }
            }
    
            /**
             * Gets an Enumeration of available property names
             *
             * @return Enumeration object containing available properties
             */
            public Enumeration propertyNames() {
                return props.propertyNames();
            }
    
            /**
             * Puts a key/value pair into the configuration
             *
             * @param key   The key to assign a value to
             * @param value The value to assign
             * @return The previous value of the key, or null if it did not have one
             */
            public Object put(String key, String value) {
                return props.setProperty(key, value);
            }
    
            /**
             * Returns the number of available properties
             *
             * @return The number of properties
             */
            public int size() {
                return props.size();
            }
    
        }
    }
    Save this as breakhandler.java Instead the old one.
     
  5. Unread #3 - Jan 17, 2009 at 1:17 AM
  6. blink182bob
    Joined:
    Dec 8, 2008
    Posts:
    309
    Referrals:
    1
    Sythe Gold:
    0

    blink182bob Forum Addict

    anyone else have this problem?

    mmk thans dude
     
  7. Unread #4 - Jan 17, 2009 at 2:05 AM
  8. Donatas92
    Joined:
    Jan 13, 2009
    Posts:
    26
    Referrals:
    0
    Sythe Gold:
    0

    Donatas92 Member

    anyone else have this problem?

    I have seen these posts with scripts typed inside but what should i do with them? Save those numbers and everyting in the notepad and put it to the script folder?
     
  9. Unread #5 - Jan 17, 2009 at 2:32 AM
  10. Koot
    Joined:
    Oct 23, 2008
    Posts:
    612
    Referrals:
    0
    Sythe Gold:
    0

    Koot Forum Addict

    anyone else have this problem?

    Yes, save it as a .java and then compile it.
     
< Unsolvable RSBot Randoms | Last chance appeal >

Users viewing this thread
1 guest


 
 
Adblock breaks this site