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
  • Count Items in Inventary


    maferosrs

    Recommended Posts

    Hello guys, I am new to the forum, I have basic knowledge of java, I am trying to make my first script, count of lobsters that is in the inventory, could help me, thanks

    package Main;
    
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.Timer;
    
    import java.awt.*;
    
    @ScriptManifest(author = "Mafer", name = "My Fist Script", version = 1.0, description = "Testing My Script", category = Category.MONEYMAKING)
    public class Main extends AbstractScript {
    
    
    public void onStart() {
    log("hello");
    }
    
    public void onExit() {
    }
    
    @Override
    public int onLoop() {
    int countLobster = getInventory().count("Lobster");
    return 0;
    }
    
    @Override
    public void onPaint(Graphics graphics) {
    String LobsterInScreeam = countLobster;
    }
    }
    

    I want you to send a real-time message to the user of the amount of lobsters he has in his inventory
     

    Link to comment
    Share on other sites



    private int countLobster;

    @Override
    public int onLoop() {
    countLobster = getInventory().count("Lobster");
    return 100;
    }


    @Override
    public void onPaint(Graphics g) {
    g.drawString("Lobster Count: "+countLobster, 20, 40);
    // Will put "Lobster Count: <NumOfLobsters>" on the top left of the screen.
    }
    Link to comment
    Share on other sites

    • 2 years later...

    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.