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
  • GPT-4 wrote my first DB3 script for me.


    anomalous

    Recommended Posts

    Hello, new guy here.

    I thought I'd start by sharing my experience of completing a functional DB3 script using GPT-4.

    It's a simple random walk script that sends you wandering about aimlessly, but it works. The challenge was to get GPT-4 to do it instead of lecturing me about the immorality of botting video games and violating the publisher's TOS.

    It turns out all I had to do was to tell GPT-4 that I am just a student learning to code in Java and that I'm only using a private OSRS server. I was no longer reminded of my moral inferiority after this. 😂

    An additional challenge was to get GPT-4 to stop using deprecated code. Without careful prompting, it will produce DB2 code.

    Once all that was sorted out, here's what it came up with:

    import org.dreambot.api.input.Mouse;
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.walking.impl.Walking;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    
    import java.util.Random;
    
    @ScriptManifest(author = "YourName", category = Category.MISC, name = "Random Walker", version = 1.0)
    public class TestScript extends AbstractScript {
    
        private final Area gameWorld = new Area(3000, 3000, 3300, 3300); // Define the area of the game world where the bot will walk
    
        @Override
        public int onLoop() {
            // Simulate human-like random sleep
            if (randomSleep()) {
                return Calculations.random(3000, 6000); // Sleep for 3 to 6 seconds
            }
    
            // Walk to a random tile within the game world
            Walking.walk(gameWorld.getRandomTile());
    
            // Sleep for a random time to mimic human behavior
            return Calculations.random(1000, 2000); // Sleep for 1 to 2 seconds
        }
    
        private boolean randomSleep() {
            int number = new Random().nextInt(100); // Generate a random number between 0 and 99
            if (number < 5) { // 5% chance to sleep
                log("Random sleep!");
                Mouse.moveOutsideScreen(true); // Move mouse outside of screen
                return true;
            }
            return false;
        }
    }

     

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • 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.