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
  • GameObject cannot be resolved to a type


    KMW

    Recommended Posts

    	GameObject chest = getGameObjects().closest("Bank chest"); 

    Hi,

     

    FIrst ever time trying to script (well thats not some boring SQL for analysis), been following some guides on here but have fallen at what i imagine is a very simple step.

     

    The above code gets the error: "GameObject cannot be resolved to a type"

     

    Seen everyone uses it so don't understand what is going on.

     

    Have the client.jar as the referenced library and all that.

     

    Any help greatly appreciated.

    Link to comment
    Share on other sites

    • 9 months later...

    Hate to dig up old threads but I'm still having the same issue with the following code:

    GameObject stall = getGameObjects().getClosest("Tea stall");

    .getClosest is underlined in red, and when hovered over it reads:

    The method getClosest(String) is undefined for the type GameObjects

    I've made sure that it is imported by using the following code as you said, yet to no avail.

    Import org.dreambot.api.wrappers.interactive.GameObject;

    Also getting the same error for:

    getInventory().dropItem("Cup of tea");

    Says:

    The method dropItem(String) is undefined for the type Inventory.

    Any help would be so appreciated.

     

    Link to comment
    Share on other sites

    • 3 weeks later...

    It's because there is no method .getClosest(string) so your "Tea stall" parameter is invallid.

    Try:

     GameObject stall = source.getGameObjects().closest(object -> object != null && object.hasAction("Steal"));

    or find the propper method on object to find by name:

    for that you can try:

     GameObject stall = source.getGameObjects().closest(object -> object != null && object.getName().equals("Tea stall")); didn't use it that way yet though so you will have to test

    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.