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
  • Hosidius Favor Code


    NoLifeLogo1

    Recommended Posts

    Hey guys I just wanted to share some code. I am new and still learning but would like to share some other ideas for beginners like myself to have some ideas of different types of scripts to write other than the simple ole woodcutting script. This script is super simple and it creates sulphurous fertiliser for getting 100% hosidius favor.

    also for all the Pro's out there if you have any recommendations on stuff that I could be looking into Please let me know :) 

     

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.Category;
    
    @ScriptManifest(author = "NoLife", name = "NoLife's Hosidius Favor", version = 1.0, description = "Hosidius Favor", category = Category.FARMING)
    public class Main extends AbstractScript {
    
        public void onStart() {
    log("Thank you for using my script");
        }
    
        public void onExit() {
            log("Thank you for using my script");
    
        }
    
        @Override
        public int onLoop() {
    
            if(getInventory().isEmpty()){
                getBank().open();
                sleep(400,600);
                getBank().withdraw("Compost",14);
                sleep(700,900);
                getBank().withdraw("Saltpetre",14);
                sleep(200,900);
                getBank().close();
                sleep(300,800);
    
            }else;
    
            if(getInventory().onlyContains("Sulphurous fertiliser")){
                getBank().open();
                sleep(600,875);
                getBank().depositAllItems();
                sleep(300,400);
                getBank().withdraw("Compost",14);
                sleepUntil(()-> getInventory().contains("Compost"),3000);
                getBank().withdraw("Saltpetre",14);
                sleepUntil(()-> getInventory().contains("Saltpetre"),4000);
                getBank().close();
                sleep(600,700);
    
            }else;
    
            if(!getInventory().contains("Compost")){
                getBank().open();
                getBank().withdraw("Compost",14);
                sleepUntil(()-> getInventory().contains("Compost"),5000);
                if(getInventory().contains("Sulphurous fertiliser"));
                getBank().depositAll("Sulphurous fertiliser");
                sleepUntil(()->!getInventory().contains("Sulphurous fertiliser"),2000);
                getBank().close();
                sleep(750,950);
    
            }else;
    
            if(!getInventory().contains("Saltpetre")){
                getBank().open();
                getBank().withdraw("Saltpetre",14);
                sleepUntil(()-> getInventory().contains("Saltpetre"),5000);
                if(getInventory().contains("Sulphurous fertiliser"));
                getBank().depositAll("Sulphurous fertiliser");
                sleepUntil(()->!getInventory().contains("Sulphurous fertiliser"),2000);
                getBank().close();
                sleep(540,850);
    
            }else;
    
            if(getInventory().contains("Compost")){
                if(getInventory().contains("Saltpetre"));
                getInventory().interact("Compost","use");
                sleep(300,600);
                getInventory().interact("Saltpetre","use");
                sleep(40000,41000);
    
            }
    
    
    
            return Calculations.random(500, 600);
        }
    }
    Link to comment
    Share on other sites

    Hey, congratz on writing your first scripts.

    Some tips:

    Learn the node system (it's like states, but it's better, because you can create multiple classes and keep everything neat).

    This helped me a ton.

     

    What you have now is an abstract code. Everything is in one place, and when you're programming or debugging -- it'll get pretty confusing real fast, the more lines of code you write. It's better to have many classes with a node system in place. It'll be confusing at first, but if you put in the effort I think you'll figure this out. Just like I have.

    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.