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
  • My First Script


    slavedriver

    Recommended Posts

    Hello everyone!

     

    I am attempting to make my first combat script and jumping in full tilt to try to build it bottom up.

    I was making Area's like:

    Area bankArea = new Area(new Tile(3097,3497,0), new Tile(3094,3494,0)); //DONE
    Area canoeArea = new Area(new Tile(3243,3238,0), new Tile(3246,3235,0)); //DONE
    Area canoeafterArea = new Area(new Tile(3128,3503,0), new Tile(3130,3502,0)); //DONE NOT NEEDED?
    

    How do I use web-walking to make a custom route using tiles to move to said Area's?

    private final Tile NPCTile = new Tile(2565,3356,0);
    	/*Tile[] NPCToBank = new Tile[]{new Tile(2565,3356,0),new Tile(2567,3356,0),
    			new Tile(2569,3356,0),new Tile(2570,3355,0),new Tile(2571,3354,0),
    			new Tile(2572,3353,0),new Tile(2573,3352,0),new Tile(2574,3351,0),
    			new Tile(2575,3350,0),new Tile(2577,3350,0),new Tile(2579,3350,0),
    			new Tile(2580,3351,0),new Tile(2582,3351,0),new Tile(2582,3353,0),
    			new Tile(2582,3355,0),new Tile(2582,3357,0),new Tile(2582,3359,0),
    			new Tile(2582,3361,0),new Tile(2582,3363,0),new Tile(2582,3365,0),
    			new Tile(2582,3367,0),new Tile(2583,3368,0),new Tile(2585,3368,0),
    			new Tile(2587,3368,0),new Tile(2589,3368,0),new Tile(2591,3368,0),
    			new Tile(2593,3368,0),new Tile(2595,3368,0),new Tile(2597,3368,0),
    			new Tile(2599,3368,0),new Tile(2601,3368,0),new Tile(2603,3368,0),
    			new Tile(2605,3368,0),new Tile(2607,3368,0),new Tile(2608,3367,0),
    			new Tile(2609,3366,0),new Tile(2610,3365,0),new Tile(2610,3363,0),
    			new Tile(2610,3361,0),new Tile(2610,3359,0),new Tile(2610,3357,0),
    			new Tile(2611,3355,0),new Tile(2612,3354,0),new Tile(2613,3353,0),
    			new Tile(2613,3351,0),new Tile(2613,3349,0),new Tile(2613,3347,0),
    			new Tile(2613,3345,0),new Tile(2613,3343,0),new Tile(2613,3341,0),
    			new Tile(2614,3339,0),new Tile(2615,3338,0),new Tile(2599,3378,0),
    			new Tile(2615,3338,0),new Tile(2616,3337,0),new Tile(2616,3335,0),
    			new Tile(2617,3334,0)};*/
    
    
    //This is out of someone elses code from a combat scipt, should I be using something along those lines and call for it later?
    

    Another issue I can't seem to overcome is I want my script to teleport out to bank when >4 food left. I can't seem to find the wording to get that to work.

    if(getInventory().???????
    

    I think that's the major issues holding me back for now!

    I'll be back with more questions for-sure!

    Link to comment
    Share on other sites

    Hello everyone!

     

    I am attempting to make my first combat script and jumping in full tilt to try to build it bottom up.

    I was making Area's like:

    Area bankArea = new Area(new Tile(3097,3497,0), new Tile(3094,3494,0)); //DONE
    Area canoeArea = new Area(new Tile(3243,3238,0), new Tile(3246,3235,0)); //DONE
    Area canoeafterArea = new Area(new Tile(3128,3503,0), new Tile(3130,3502,0)); //DONE NOT NEEDED?
    

    How do I use web-walking to make a custom route using tiles to move to said Area's?

    private final Tile NPCTile = new Tile(2565,3356,0);
    	/*Tile[] NPCToBank = new Tile[]{new Tile(2565,3356,0),new Tile(2567,3356,0),
    			new Tile(2569,3356,0),new Tile(2570,3355,0),new Tile(2571,3354,0),
    			new Tile(2572,3353,0),new Tile(2573,3352,0),new Tile(2574,3351,0),
    			new Tile(2575,3350,0),new Tile(2577,3350,0),new Tile(2579,3350,0),
    			new Tile(2580,3351,0),new Tile(2582,3351,0),new Tile(2582,3353,0),
    			new Tile(2582,3355,0),new Tile(2582,3357,0),new Tile(2582,3359,0),
    			new Tile(2582,3361,0),new Tile(2582,3363,0),new Tile(2582,3365,0),
    			new Tile(2582,3367,0),new Tile(2583,3368,0),new Tile(2585,3368,0),
    			new Tile(2587,3368,0),new Tile(2589,3368,0),new Tile(2591,3368,0),
    			new Tile(2593,3368,0),new Tile(2595,3368,0),new Tile(2597,3368,0),
    			new Tile(2599,3368,0),new Tile(2601,3368,0),new Tile(2603,3368,0),
    			new Tile(2605,3368,0),new Tile(2607,3368,0),new Tile(2608,3367,0),
    			new Tile(2609,3366,0),new Tile(2610,3365,0),new Tile(2610,3363,0),
    			new Tile(2610,3361,0),new Tile(2610,3359,0),new Tile(2610,3357,0),
    			new Tile(2611,3355,0),new Tile(2612,3354,0),new Tile(2613,3353,0),
    			new Tile(2613,3351,0),new Tile(2613,3349,0),new Tile(2613,3347,0),
    			new Tile(2613,3345,0),new Tile(2613,3343,0),new Tile(2613,3341,0),
    			new Tile(2614,3339,0),new Tile(2615,3338,0),new Tile(2599,3378,0),
    			new Tile(2615,3338,0),new Tile(2616,3337,0),new Tile(2616,3335,0),
    			new Tile(2617,3334,0)};*/
    
    
    //This is out of someone elses code from a combat scipt, should I be using something along those lines and call for it later?
    

    Another issue I can't seem to overcome is I want my script to teleport out to bank when >4 food left. I can't seem to find the wording to get that to work.

    if(getInventory().???????
    

    I think that's the major issues holding me back for now!

    I'll be back with more questions for-sure!

     

    Okay for your first issue, you can create a array of the tiles you want to walk, and use a loop to make it walk, example:

            Tile[] NPCToBank = new Tile[]{new Tile(2565,3356,0),new Tile(2567,3356,0),
                    new Tile(2569,3356,0),new Tile(2570,3355,0),new Tile(2571,3354,0),
                    new Tile(2572,3353,0)};
            for (int index = 0; index < NPCToBank.length; index++) {
                if (getLocalPlayer().getTile() != NPCToBank[index]) {
                    getWalking().walk(NPCToBank[index]);
                }
            }
    

    For your second issue you can use this:

            if (getInventory().count("FOODNAME") < 4) {
                //do stuff
            }
    
    Link to comment
    Share on other sites

    Use getWalking().walk(bankArea.getRandomTile()) to walk to an area. You dont need to make a custom path unless that area isnt mapped in the web walking path included in the client. For the teleporting use if(getInventory().count("Lobster") < 4){

    getInventory().interact("Teleport to house", "Break");}

    You'll have to change it up a bit to fit your script but the components are there. Should get discord and ask on there. Usually a faster response than on the forum.

    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.