Jump 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.

Finished my new script, but how do I type faster?

Featured Replies

Hello!

 

I've been working hard on learning how to use OSBot and i've just finished my latest script, HOWEVER, I am using getKeyboard().typeString and realised how slow it types. I am looking for something that types a lot faster, and was wondering how I would make it type a lot faster than it currently does (which isn't fast at all).

 

ANY help is appreciated as always, and I thank you for helping me learn Java and the OSBot api

Hello!

I've been working hard on learning how to use OSBot and i've just finished my latest script, HOWEVER, I am using getKeyboard().typeString and realised how slow it types. I am looking for something that types a lot faster, and was wondering how I would make it type a lot faster than it currently does (which isn't fast at all).

ANY help is appreciated as always, and I thank you for helping me learn Java and the OSBot api

Wouldnt you change something like the sleeping condition? Lower the time before it re-starts that part.

  • Author

Wouldnt you change something like the sleeping condition? Lower the time before it re-starts that part.

 

The sleeping condition won't affect how fast the keys are pressed

  • Author

 

Thanks for the idea. I will have a look at it, however, I doubt this is going to make it type fast, this is more making the typing look human (by making mistakes), I don't want mistakes in mine, I want it to type really fast (almost instant), as this is going to be ran on trash accounts so I don't care about how human-like it looks :)

Thanks for the idea. I will have a look at it, however, I doubt this is going to make it type fast, this is more making the typing look human (by making mistakes), I don't want mistakes in mine, I want it to type really fast (almost instant), as this is going to be ran on trash accounts so I don't care about how human-like it looks smile.png

 

Someone had the source for an instant typer once upon a time, not sure how it was done but try looking into KeyEvents?

Try something like this? (This is probably what typeString does, but with a substantial delay between each key)

void typeFast(String str) {
    for(char c : str.toCharArray()) {
        getKeyboard().typeKey(c);
    }
    getKeyboard().typeKey((char)KeyEvent.VK_ENTER);
}

Edited by FrostBug

 

Try something like this? (This is probably what typeString does, but with a substantial delay between each key)

void typeFast(String str) {
    for(char c : str.toCharArray()) {
        getKeyboard().typeKey(c);
    }
    getKeyboard().typeKey((char)KeyEvent.VK_ENTER);
}

 

typeKey() still has the delay afaik (hence why my SmartKeyboard is still pretty slow).

Also, when pressing enter, you want to send 13 & 10 in rapid succession (\r\n):

getKeyboard().typeKey((char)13);
getKeyboard().typeKey((char)10);

 

typeKey() still has the delay afaik (hence why my SmartKeyboard is still pretty slow).

Also, when pressing enter, you want to send 13 & 10 in rapid succession (\r\n):

getKeyboard().typeKey((char)13);
getKeyboard().typeKey((char)10);

 

if typekey has a delay, just simulate it instead

getKeyboard().pressKey(c);
getKeyboard().releaseKey(c);

I'll assume typekey does the same, but with a delay inbetween the two

 

Also, do you have a source for the \r\n thing? I really kind of doubt it's necessary. What reason would the game applet have to not simply listen for the VK_ENTER keypress? That's all the actual keyboard key triggers.

 

Edited by FrostBug

if typekey has a delay, just simulate it instead

getKeyboard().pressKey(c);
getKeyboard().releaseKey(c);

I'll assume typekey does the same, but with a delay inbetween the two

 

Also, do you have a source for the \r\n thing? I really kind of doubt it's necessary. What reason would the game applet have to not simply listen for the VK_ENTER keypress? That's all the actual keyboard key triggers.

 

For some reason

getKeyboard().pressKey(c);
getKeyboard().releaseKey(c);

Does not work for me (maybe I am doing something wrong)

 

However this does:

private void typeStringInstant(String output){

    for(int i = 0; i < output.length(); i ++){

        char c = output.charAt(i);
        int code = KeyEvent.getExtendedKeyCodeForChar(c);
        // Type the character
        getBot().getKeyEventHandler().generateBotKeyEvent(400, System.currentTimeMillis(), 0, code, c);
    }

    // Press enter
    getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000', 1);
    // Release enter
    getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000', 1);
}

Edit: GIF demonstration: https://gyazo.com/36757b8e49c1abbcc4b0a4090bb6322e

 

Edited by Explv

For some reason

getKeyboard().pressKey(c);
getKeyboard().releaseKey(c);

Does not work for me (maybe I am doing something wrong)

 

However this does:

private void typeStringInstant(String output){

    for(int i = 0; i < output.length(); i ++){

        char c = output.charAt(i);
        int code = KeyEvent.getExtendedKeyCodeForChar(c);
        getBot().getKeyEventHandler().generateBotKeyEvent(400, System.currentTimeMillis(), 0, code, c);
    }

    // Press the enter key
    getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000', 1);
}

Edit: GIF demonstration: https://gyazo.com/36757b8e49c1abbcc4b0a4090bb6322e

You might want to generate a release key event as well (See TypeKeyEvent, which also acquires exclusive access to the KeyEventHandler, that could be a good idea as well). 

You might want to generate a release key event as well (See TypeKeyEvent, which also acquires exclusive access to the KeyEventHandler, that could be a good idea as well). 

 

Oops didn't even notice. Corrected my post, thanks for pointing it out.

 

Edited by Explv

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

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.