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
  • getLocalPlayer and sleepuntil is not working


    Puhson

    Recommended Posts

    I am trying to make a combat script and trying to figure out whats wrong.

    getLocalPlayer gives me this = Cannot resolve symbol 'getLocalPlayer'

    And sleepuntil gives me this: Cannot resolve method 'sleepUntil(<lambda expression>, int)'

    My code:
     

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.interactive.NPCs;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.NPC;
    
    @ScriptManifest(author = "Puh", name = "Revenant Imp Killer", version = 1.0, description = "Kills Revenant Imps", category = Category.COMBAT)
    public class RevenantImpKiller extends AbstractScript {
    
        @Override
        public void onStart() {
            log("Script started!");
        }
    
        @Override
        public int onLoop() {
            if (!(getLocalPlayer).isInCombat()) {
                NPC imp = NPCs.closest("Revenant imp");
                if (imp != null && imp.interact("Attack")) {
                    sleepUntil(() -> getLocalPlayer().isInCombat(), Calculations.random(3000, 5000));
                }
            }
            return Calculations.random(200, 600);
        }
    
        @Override
        public void onExit() {
            log("Script stopped!");
        }
    }

     

    Link to comment
    Share on other sites

    4 hours ago, Puhson said:

    I am trying to make a combat script and trying to figure out whats wrong.

    getLocalPlayer gives me this = Cannot resolve symbol 'getLocalPlayer'

    And sleepuntil gives me this: Cannot resolve method 'sleepUntil(<lambda expression>, int)'

    My code:
     

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.interactive.NPCs;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.NPC;
    
    @ScriptManifest(author = "Puh", name = "Revenant Imp Killer", version = 1.0, description = "Kills Revenant Imps", category = Category.COMBAT)
    public class RevenantImpKiller extends AbstractScript {
    
        @Override
        public void onStart() {
            log("Script started!");
        }
    
        @Override
        public int onLoop() {
            if (!(getLocalPlayer).isInCombat()) {
                NPC imp = NPCs.closest("Revenant imp");
                if (imp != null && imp.interact("Attack")) {
                    sleepUntil(() -> getLocalPlayer().isInCombat(), Calculations.random(3000, 5000));
                }
            }
            return Calculations.random(200, 600);
        }
    
        @Override
        public void onExit() {
            log("Script stopped!");
        }
    }

     

    your code or chat gpts?

    Link to comment
    Share on other sites

    On 8/9/2023 at 9:02 AM, Diggington said:

    Would it be like this then?

     

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.combat.Combat;
    import org.dreambot.api.methods.interactive.NPCs;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.impl.Condition;
    import org.dreambot.api.wrappers.interactive.Character;
    import org.dreambot.api.wrappers.interactive.NPC;
    import org.dreambot.api.wrappers.interactive.Player;
    
    import java.util.Objects;
    
    @ScriptManifest(author = "Puh", name = "Revenant Imp Killer", version = 1.0, description = "Kills Revenant Imps", category = Category.COMBAT)
    public class RevenantImpKiller extends AbstractScript {
    
        public Character getLocal;
    
        @Override
        public void onStart() {
            log("Script started!");
        }
    
        public static Player getLocal() {
            return null;
        }
    
        @Override
        public int onLoop() {
            if (!(getLocal).isInCombat()) {
                NPC imp = NPCs.closest("Revenant imp");
                if (imp != null && imp.interact("Attack")) {
                    sleepUntil(() -> (getLocal()).isInCombat(), Calculations.random(3000, 5000));
                }
            }
            return Calculations.random(200, 600);
        }
    
        private void sleepUntil(Object o, int random) {
    
        }
    
        @Override
        public void onExit() {
            log("Script stopped!");
        }
    }

     

    Link to comment
    Share on other sites

    On 8/12/2023 at 9:05 PM, Puhson said:

    Would it be like this then?

     

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.combat.Combat;
    import org.dreambot.api.methods.interactive.NPCs;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.utilities.impl.Condition;
    import org.dreambot.api.wrappers.interactive.Character;
    import org.dreambot.api.wrappers.interactive.NPC;
    import org.dreambot.api.wrappers.interactive.Player;
    
    import java.util.Objects;
    
    @ScriptManifest(author = "Puh", name = "Revenant Imp Killer", version = 1.0, description = "Kills Revenant Imps", category = Category.COMBAT)
    public class RevenantImpKiller extends AbstractScript {
    
        public Character getLocal;
    
        @Override
        public void onStart() {
            log("Script started!");
        }
    
        public static Player getLocal() {
            return null;
        }
    
        @Override
        public int onLoop() {
            if (!(getLocal).isInCombat()) {
                NPC imp = NPCs.closest("Revenant imp");
                if (imp != null && imp.interact("Attack")) {
                    sleepUntil(() -> (getLocal()).isInCombat(), Calculations.random(3000, 5000));
                }
            }
            return Calculations.random(200, 600);
        }
    
        private void sleepUntil(Object o, int random) {
    
        }
    
        @Override
        public void onExit() {
            log("Script stopped!");
        }
    }

     

    bro its Sleep.sleepUntil and Players.getLocal actual brainlet

    Link to comment
    Share on other sites

    • 2 weeks later...

    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.