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
  • Trump's Newbie Scripter Guide


    Donald Trump

    Recommended Posts

    ~ Under Construction, expect changes! ~

     

    Guide 1 - Setting up Intellij with basic template.
     

     

    • Download Intellij Community Edition
    • File -> New -> Project
    • Select Java
    • Ensure your Project SDK is 1.8
    • Fill Details
    • Right click src -> New -> Java Class
    • Enter main
    • Now Copy/Paste this: https://hastebin.com/cizuyoweru.java
    • File -> Project Structure -> Libraries
    • Click green plus at top
    • Click java once it appears
    • Navigate to your BotData folder inside DreamBot then select client.jar
    • Click OK
    • Bottom right click Apply
    • Click Artifacts
    • Same again click green plus
    • Jar -> Empty
    • Fill in the Name & Output directory for the .jar file of your script
    • Double click compile out so it's under the jar name you chose on the left
    • Click Apply -> OK

     


     
    Script Examples:
     
    Walking to GE ~ https://hastebin.com/ozixezemuk.java
    Killing Chickens ~ https://hastebin.com/yuforenemi.java

     

    Script Snippets:

     

    QuickStart Parameters ~ https://hastebin.com/kisoxokeko.cs

    Banking / Looting Example ~ https://hastebin.com/orisuzemav.swift

    Link to comment
    Share on other sites

    these are not examples of good code.    

     

    not following naming conventions/incorrect access modifier.  area_chickens and enum set should be in all cap case.  AREA_CHICKENS should be public static final:

     

    private Area area_chickens

     

    public enum State {

    nothing, walk

     

    probably dont understand lambdas if you name the parameter "filter"...

    getNpcs().closest(filter -> filter != null && filter.getName().equals("Chicken") && !filter.isInCombat());

     

    unecessary sleepUntil.  sleepUntil should be avoided unless necessary since its resource intensive (it polls a condition every 25ms).

     

    private boolean sleepWalk(int distance, int timeout) { // This will make the client sleep until the player isn't moving, times out or within the distance defined.
    return sleepUntil(() -> !getLocalPlayer().isMoving() || getLocalPlayer().distance(getClient().getDestination()) < distance, timeout);
    }

     

    maybe you should read tutorials instead of making them

    Link to comment
    Share on other sites

    these are not examples of good code.    

     

    not following naming conventions/incorrect access modifier.  area_chickens and enum set should be in all cap case.  AREA_CHICKENS should be public static final:

     

    private Area area_chickens

     

    public enum State {

    nothing, walk

     

    probably dont understand lambdas if you name the parameter "filter"...

    getNpcs().closest(filter -> filter != null && filter.getName().equals("Chicken") && !filter.isInCombat());

     

    unecessary sleepUntil.  sleepUntil should be avoided unless necessary since its resource intensive (it polls a condition every 25ms).

     

    private boolean sleepWalk(int distance, int timeout) { // This will make the client sleep until the player isn't moving, times out or within the distance defined.

    return sleepUntil(() -> !getLocalPlayer().isMoving() || getLocalPlayer().distance(getClient().getDestination()) < distance, timeout);

    }

     

    maybe you should read tutorials instead of making them

     

    These are things I would have found useful on day 1 of starting to script. The lambdas named filter was just a way to express its a filter to the new user not understanding that. The naming conventions is just nitt picking, if you have anything actually constructive to contribute then I'm all ears.

    Link to comment
    Share on other sites

    These are things I would have found useful on day 1 of starting to script. The lambdas named filter was just a way to express its a filter to the new user not understanding that. The naming conventions is just nitt picking, if you have anything actually constructive to contribute then I'm all ears.

     

    I think the point he's trying to make is that if you teach people, it should be code that is actually functional in the bigger scheme of things (access modifiers aren't naming conventions, they're a pivotal element that every scripter and/or programmer should know), and code that teaches them good (naming) habits :)

    Link to comment
    Share on other sites

    these are not examples of good code.    

     

    not following naming conventions/incorrect access modifier.  area_chickens and enum set should be in all cap case.  AREA_CHICKENS should be public static final:

     

    private Area area_chickens

     

    public enum State {

    nothing, walk

     

    probably dont understand lambdas if you name the parameter "filter"...

    getNpcs().closest(filter -> filter != null && filter.getName().equals("Chicken") && !filter.isInCombat());

     

    unecessary sleepUntil.  sleepUntil should be avoided unless necessary since its resource intensive (it polls a condition every 25ms).

     

    private boolean sleepWalk(int distance, int timeout) { // This will make the client sleep until the player isn't moving, times out or within the distance defined.

    return sleepUntil(() -> !getLocalPlayer().isMoving() || getLocalPlayer().distance(getClient().getDestination()) < distance, timeout);

    }

     

    maybe you should read tutorials instead of making them

     

    Most new scripters aren't set out to become software developers. I learned at a young age off poorly documented and poorly conventioned code and honestly feel like it helped because I wasn't trying to absorb so much information that didn't matter at the time. I didn't care if a constant was in all caps as long as the damn thing worked. If they are trying to take it that seriously, they need to be doing more learning than the tutorials section on DreamBot lmfao.

     

    If this is presented in a way that someone will learn from it, who cares if they aren't learning damn conventions. They are learning concepts that are 10x more important in the beginning to understand and get something working.

    Link to comment
    Share on other sites

    How would I go about making code from OSBot work with dreambot API?

     

     

     


    import org.osbot.W;
    import org.osbot.rs07.api.map.Area;
    import org.osbot.rs07.api.map.Position;
    import org.osbot.rs07.api.model.NPC;
    import org.osbot.rs07.api.ui.EquipmentSlot;
    import org.osbot.rs07.api.ui.MagicSpell;
    import org.osbot.rs07.api.ui.Skill;
    import org.osbot.rs07.api.ui.Spells;
    import org.osbot.rs07.event.WebWalkEvent;
    import org.osbot.rs07.script.Script;
    import org.osbot.rs07.script.ScriptManifest;
    import org.osbot.rs07.utility.Condition;
    import org.osbot.rs07.utility.ConditionalSleep;



    import java.awt.*;

    import static org.osbot.rs07.api.map.constants.Banks.CANIFIS;

     

    I'm a novice scripter so please help a brother out! cheers, you scripters motivate me!

    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.