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
  • GameTickListener interface is not working


    botmaker_01
     Share

    Recommended Posts

    Hi everyone, 

    I've tried to use the GameTickListener interface but it didn't seem to work. Any suggestions? Other interface like ExperienceListener worked just fine.

     

    import org.dreambot.api.methods.MethodProvider;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.listener.GameTickListener;
    
    @ScriptManifest(name = "Test script", description = "this is a test script", author = "Developer Name",
            version = 1.0, category = Category.COMBAT, image = "")
    public class TestScript extends AbstractScript implements GameTickListener {
    
        @Override
        public void onStart() {
            MethodProvider.log("on start");
        }
    
        @Override
        public void onGameTick() {
            MethodProvider.log("gametick: " + System.currentTimeMillis());
        }
    
        @Override
        public int onLoop() {
            log("On Loop");
            return 1000;
        }
    
    }

     

    Link to comment
    Share on other sites

    5 hours ago, botmaker_01 said:

    Thanks for quick reply, hopefully it can be added soon. It's kinda critical for my script :(

    Now I'm curious what the script is about if knowing the exact tick is critical to it...

    Link to comment
    Share on other sites

    2 hours ago, Hosfad said:

    Problem is that he wont be in sync with the actual gametick , even if its implemented 

    You can get it pretty dang close by using 

    System.currentTimeMillis()
    

    with a method call checking xp drops / animation timing. Although its next to impossible to account for server lag / internet delay / map loading that will offset the System time slightly. I'm sure with tweaks/testing a method could account for this

    Link to comment
    Share on other sites

    20 hours ago, Hosfad said:

    Problem is that he wont be in sync with the actual gametick , even if its implemented 

    Really? I thought it uses the information of the server/client of osrs state information directly just in same way as the RuneLite does? I'm not that familiar of how the API accesses the actual game information though, not even sure how reflection and injection works.

     

    17 hours ago, Axolotl said:

    You can get it pretty dang close by using 

    System.currentTimeMillis()
    

    with a method call checking xp drops / animation timing. Although its next to impossible to account for server lag / internet delay / map loading that will offset the System time slightly. I'm sure with tweaks/testing a method could account for this

    Obviously if you keep local gameTick which occurs every 600ms it won't ever be in sync with the actual game tick? so it won't work

    Link to comment
    Share on other sites

    On 9/21/2021 at 7:15 AM, Pandemic said:

    Hey there, the GameTickListener isn't implemented yet, I've marked it as deprecated and updated the Javadocs to show that in future updates.

    It'll eventually work, it's just not added right now :(

    when this is added i will be getting that elite donor rank. i have also have a script which would really benefit from game tick listener so hoping this comes soon. 

    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.