Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Keylistener breaking after a while?

Featured Replies

Hi there, like the title suggests, is there a bug where key listener's breaks after a while?
I have found that when minimizing the osbot client and opening it (sometimes after few times) and after (some amount of time) the hot keys stopped working.
When I kept the game open and not minimized it also occurred but way later, this happens to my script and other scripts I tested using hotkeys.

My testing methods are not that amazing or consistent but so is this supposed bug, I can't reproduce it at a constant state. Online minimizing and waiting seems to do the trick.

Maybe I am just implementing it wrong, here is my code:

@Override
    public void onStart() {
       //GUI stuff
        getBot().getCanvas().addKeyListener(new KeyListener() {
            @Override
            public void keyTyped(KeyEvent e) {
                //int key = e.getKeyCode();
            }

            @Override
            public void keyPressed(KeyEvent e) {
                int key = e.getKeyCode();
                if (key == KeyEvent.VK_H && !hidePaint){
                    log("Hiding Paint");
                    hidePaint = true;
                } else if (key == KeyEvent.VK_H){
                    log("Un-hiding Paint");
                    hidePaint = false;
                }
            }

            @Override
            public void keyReleased(KeyEvent e) {
                //int key = e.getKeyCode();

            }
        });

This is my setup to hide the onPaint.
Maybe I am doing it wrong, or maybe it is a bug, all feed back is welcome!

Even feedback not related to this whole "bug" is welcome, if this code snippet can be improved please, let me know, I am learning here.
 

  • Author

Thanks to the off site replies, this code isn't the best way of doing it.
The alternatives fixed the issues for me. If somehow other people have issues,
don't do :

getBot().getCanvas().addKeyListener(new KeyListener()

but do for example:
getBot().getKeyListeners().add(hotkeySensor);

 

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.