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
  • Try asking for help in the chatbox
  • Read Chatbox Messages


    abdulr
     Share

    Recommended Posts

    im trying to read in messages from the game chat like an array then see if they contain certain words 

    Example word im looking for is "mining"

    e.g. Hey, what level is your mining (this contains the word so return it to me)

    Link to comment
    Share on other sites

    Implement the MessageListener interface. The method onPlayerMessage will be called every time someone speaks and you can use it to analyze the incoming messages.

    Link to comment
    Share on other sites

    16 minutes ago, Infidel said:

    If you accept my answer, please hit the Upvote button on the bottom right of my answer. Thank you!

     

    can you help me with this, onPaint doesn't work, when i use it and compile, it wont even let me run the script, but if i remove the onPaint function and compile im able to run my script and it works perfect

     

    public void onStart() {
        options();
        totalRunTime = System.currentTimeMillis();
    }

     

    public void onPaint(Graphics g) {
        long milliseconds = totalRunTime;
        long seconds = (milliseconds / 1000) % 60;
        long minutes = (milliseconds / (1000 * 60) % 60);
        long hours = (milliseconds / (1000 * 60 * 60) % 24);
    
        // setting the background color for the border box
        g.setColor(new Color(29, 29, 29));
        g.fillRect(10, 10, 200, 145);
    
        // setting the title color and name
        g.setColor(new Color(255, 255, 25));
        g.drawRect(10, 10, 200, 145);
        g.drawString("Master Fletcher", 65, 40);
    
        // setting the rest of the what i want to display to the user
        g.setColor(new Color(255, 255, 255));
        g.drawString("Running: " + String.format("%02d:%02d:%02d", hours, minutes, seconds), 35 ,70); // shows how long the bot has been running for
    }
    Link to comment
    Share on other sites

    this is my new onPaint function, still not working (bare in mind this worked absolutely perfect for me when i scripted on RsBot)

    public void onPaint(Graphics g) {
        milliseconds = totalRunTime;
        seconds = (milliseconds / 1000) % 60;
        minutes = (milliseconds / (1000 * 60) % 60);
        hours = (milliseconds / (1000 * 60 * 60) % 24);
    
        // checking how many exp i gained since i started
        expGained = getSkills().getExperience(Skill.FLETCHING) - startFletchingXp;
        levelGained = getSkills().getRealLevel(Skill.FLETCHING) - startFletchingLevel;
    
    
        // setting the background color for the border box
        g.setColor(new Color(29, 29, 29));
        g.fillRect(10, 10, 200, 145);
    
        // setting the title color and name
        g.setColor(new Color(255, 255, 25));
        g.drawRect(10, 10, 200, 145);
        g.drawString("Master Fletcher", 65, 40);
    
        // setting the rest of the what i want to display to the user
        g.setColor(new Color(255, 255, 255));
        g.drawString("Running: " + String.format("%02d:%02d:%02d", hours, minutes, seconds), 35 ,70); // shows how long the bot has been running for
        g.drawString("Exp/Hrs: " + expGained + " / " + (int)(expGained * (3600000D / milliseconds)), 35, 85); // shows the exp i gained and the exp per hour
        g.drawString("Levels: " + levelGained, 35, 100);
        g.drawString("Status: " + status, 35, 115); // shows the status of what the bot is doing (fletching, dropping, anti-ban etc...)
        g.drawString("Anti-Ban: " + totalAntiBan, 35, 130); // shows how many times the script done stuff to act like a human (to not get banned)
    }
    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
     Share

    ×
    ×
    • 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.