Ask Experts Questions for FREE Help !
Ask
    nobodyman1's Avatar
    nobodyman1 Posts: 1, Reputation: 1
    New Member
     
    #1

    Dec 18, 2008, 04:50 PM
    What is wrong with this script?
    Code:
    import java.awt.*;
    import com.speljohan.rsbot.script.*;
    import com.speljohan.rsbot.script.wrappers.*;
    import com.speljohan.rsbot.bot.Bot;
    import com.speljohan.rsbot.script.wrappers.RSObject ;
    
    public class SwampScavenger extends Script {
    
    
        long                             lastCheck = 0;
        public long                     time = System.currentTimeMillis();
        public long                     startTime = System.currentTimeMillis();
        int                             checkTime;
        int                             GambleInt;
        int                             randomRunValue = 30;
        public int                         tar = 1939;
    
    
    
        @Override
        public String getScriptCategory() {
            return "HtsTigers03/Money Making";
        }
    
        public double getVersion() {
            return 1.0;
        }
    
    
        public String getName() {
            return "SwampScavenger";
        }
    
        public String getAuthor() {
            return "HtsTigers03";
        
    
    
        public boolean onStart(String[] args) {
        return true;
    
        }
    
    
        public int loop() {
            runEnable();
            if (getMyPlayer( ).isInCombat( )) {
                runAway();
                }
            RSItemTile TAR = getNearestGroundItemByID(25,tar);
            if (TAR != null){
                if (goTo(TAR)){
                    if(getMyPlayer().isMoving())return random(200,500);
                    if(atTile(TAR,"Take")){
                        log("Got Tar!");
                    }
                }
            }
    
    
            return random(500,1000);
        }
    
    
    
          public boolean goTo(RSTile t){
                return goTo(t,5);
            }
            // walks in strait line to tile, returns True when within set range of tile.
           public boolean goTo(RSTile t,int range) {   //Walking method by Bug5532
               if (distanceTo(t) < range) return true;
    
                  if (distanceTo(t) < 13){
                      walkTileMM(t);
                      wait(random(500,1000));
                      return false;
                  }
    
                  while(true){
                         t = new RSTile( ((t.getX()+getMyPlayer().getLocation().getX())/2)+random(-1,1) , ((t.getY()+getMyPlayer().getLocation().getY())/2)+random(-1,1) ) ;
                         if (distanceTo(t) < 15){
                             walkTileMM(t);
                             wait(random(500,1000));
                             break;
                         }
                 }
    
               return false;
           }
    
    
        public RSItemTile getNearestGroundItemByID( int[] ids) {
            return getNearestGroundItemByID(50,ids);
        }
        public RSItemTile getNearestGroundItemByID( int range, int id) {
            int[] j = {id};
            return getNearestGroundItemByID(range,j);
        }
    
        public RSItemTile getNearestGroundItemByID(int range, int[] ids) {
            int pX = getMyPlayer().getLocation().getX();
            int pY = getMyPlayer().getLocation().getY();
            int minX = pX - range;
            int minY = pY - range;
            int maxX = pX + range;
            int maxY = pY + range;
            int dist = 100;
            RSItemTile nItem = null;
            for (int x = minX; x <= maxX; x++) {
                for (int y = minY; y <= maxY; y++) {
                    if (Calculations.canReach(new RSTile(x,y), false)){
                        RSItemTile[] items = getGroundItemsAt(x, y);
                        for (RSItemTile item : items) {
                            int iId = item.getItem().getID();
                            for (int id : ids) {
                                if (iId == id) {
                                //    log(""+id+" at "+x+","+y);
                                    if (distanceTo(new RSTile(x,y)) < dist){
                                        dist = distanceTo(new RSTile(x,y));
                                        nItem = item;
                                    }
    
    
    
                                }
                            }
                        
                    }
                }
            }
            return nItem;
        }
    
    
    
            public void runEnable() {
                    if(getEnergy() > random(60, 100)) {
                setRun(true);
                }
            }
    //AELIN'S ANTIBAN
            public int AntiBan() {
            GambleInt = random(1, 5);
            if (GambleInt == 1) {
                wait(random(2000, 2000));
            }
            if (GambleInt == 2) {
                int xA = random(0, 750);
                int yA = random(0, 500);
                moveMouse(0, 0, xA, yA);
            }
            if (GambleInt == 3) {
                if (getCurrentTab() != TAB_INVENTORY) {
                    openTab(TAB_INVENTORY);
                }
            }
            if (GambleInt == 4) {
                if (getMyPlayer().isMoving()) {
                    return (random(500, 1750));
                }
    
                if ((System.currentTimeMillis() - lastCheck) >= checkTime) {
                    lastCheck = System.currentTimeMillis();
                    checkTime = random(300000, 600000);
    
                    if (getCurrentTab() != TAB_STATS) {
                        openTab(TAB_STATS);
                    }
                    moveMouse(627, 240, 52, 29);
                    return (random(3000, 6000));
                }
            }
    
            return (random(500, 1000));
        }
    
            public void runAway() {
    
            RSTile Foo;
            RSTile Bar;
    
            Foo = getMyPlayer().getLocation();
            setRun(true);
    
            Bar = new RSTile(Foo.getX() + random(8, 10), Foo.getY() + random(8, 10));
    
            walkTileMM(Bar);
            wait(random(4000, 5000));
            walkTileMM(Foo);
        
    
    }

    What is wrong with it?

    Thanks.

Check out some similar questions!

I want to use this Script but how do I [ 2 Answers ]

I have a Div called rtsidebar <div> <div/> I have tried putting the script in to the div but then couldn't work out how to set the script, thought it would be easy, might be me being a biff. Please help If some one could fill it out and get it to work so I could then edit it. Thanks

Need to know the name of the script [ 3 Answers ]

Hello, I have seen a pop over script that disables the whole website until the visitor enters their information. YOu can see that script on this website Forced Money Can anyone tell me the name of the script or any other script that lets me get the same effect? Thanks in advance... SA

TV script or book? [ 2 Answers ]

Ok, so I've been writing my whole life. And the main problem I've always had was the fact that I'm torn about what format it should be in. Book or movie/tv script. I personally love writing in script format. However, it's probably easier to get it made into a book. And recently I came up with...

Vbs script [ 1 Answers ]

I need to link up 2 sheet and they should update auto.Tried =sheet2!a3 but did not work tried =Vlookup(b2,sheet2!B2:c22 false) did not work. Example. Information in sheet 1 is the same in sheet 2 has date,number etc,If I update cell A4 in sheet1 Sheet2 A5 must be updated.I will use sheet 2...

Help with script [ 2 Answers ]

Hey it's me again about my script. I'm writing out of my element about magic and witches and stuff like that. The way i'm writing it sounds very corny and fake. Maybe it's just that i am horrible at writing. Can anybody read it and tell me how to make it sound less fake and stupid? Also, I need a...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.