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
  • How to detect player in area and log out?


    zorichy
     Share

    Recommended Posts

    So, I'm trying to make a script that logs you out if there's another player in a certain area (for semi-legit AFK-ing).

    I'm testing this in the chicken area in Lumbridge, this is my script so far:

    package Main;
    
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.tabs.Tabs;
    import org.dreambot.api.wrappers.interactive.Player;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    
    @ScriptManifest(category = Category.MISC, name = "LJS Logout", author = "LJS", version = 0.1)
    
    public class Main extends AbstractScript {
    
        @Override
        public void onStart() {
            log("LJS Logout started");
        }
    
    Area chickArea = new Area(3224, 3302, 3239, 3286); // Chicken Area
    
        @Override
        public int onLoop() {
        if (chickArea.contains((Player) getTabs()).logout());
            return 5;
        }
    
        @Override
        public void onExit() {
            log("LJS Logout ended");
    
        }
    }
    

    Is that somewhat correct? This is the very first time trying to make a script. I just checked some tutorials on the forum & Youtube and that's all. Sorry for being a total noob in this, but this is all kinda cool!

    Getting this error: Error:(23, 44) java: incompatible types: org.dreambot.api.methods.tabs.Tabs cannot be converted to org.dreambot.api.wrappers.interactive.Player
    What can I do?

    Cheers!

    Edited by zorichy
    Link to comment
    Share on other sites

    Thanks a lot for the quick reply!

    I'll be checking out what you've send. Just wanted to make this work, run it and in the meanwhile check some more tutorials. Got a bit too excited I guess ;)

    Link to comment
    Share on other sites

    So... IT WORKS!

    First got another error, but that was because the area was called chickArea and you used chickenArea, but that's all ok now.

    Just one more question: is there a way to make the action faster? Like log out faster. 'Cause the mouse movement isn't the fastest and it's all the way up in the bot.

    Link to comment
    Share on other sites

    3 minutes ago, zorichy said:

    So... IT WORKS!

    First got another error, but that was because the area was called chickArea and you used chickenArea, but that's all ok now.

    Just one more question: is there a way to make the action faster? Like log out faster. 'Cause the mouse movement isn't the fastest and it's all the way up in the bot.

    What you could do is make the mouse hop instantly by using getMouse().setAlwaysHop(true);

    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.