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.

Is it possible to hold key on osbot?

Featured Replies

Hello i really need help to make script type letter without pressing enter.I tried robot class but  that affects user input so its shit Next i tried press key which did nothing :/ but maybe i'm  not doing it right?

sure it something like getKeyboard().typeString("String", false) or something along those lines

Ok but maybe is it possible to spam without delay or with really low ? Cuz thats really slow biggrin.png

 
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);
}

http://osbot.org/forum/topic/85684-finished-my-new-script-but-how-do-i-type-faster/?p=952925

Edited by Fruity

Hello i really need help to make script type letter without pressing enter.I tried robot class but  that affects user input so its shit Next i tried press key which did nothing :/ but maybe i'm  not doing it right?

 

 

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);
}

http://osbot.org/forum/topic/85684-finished-my-new-script-but-how-do-i-type-faster/?p=952925

 

 

 

I made that post a little while ago, this should be a bit more readable for you:

private void typeStringInstant(final String output){
    for(int i = 0; i < output.length(); i ++) {
        final char c = output.charAt(i);
        getBot().getKeyEventHandler().generateBotKeyEvent(KEY_TYPED, System.currentTimeMillis(), 0, KeyEvent.getExtendedKeyCodeForChar(c), c);
    }
    getBot().getKeyEventHandler().generateBotKeyEvent(KEY_TYPED, System.currentTimeMillis(), 0, VK_ENTER, '\n', KEY_LOCATION_STANDARD);
}

Edited by Explv

  • Author

Ok thanks mate it worked :) to not create a new thread i will ask here :D now maybe there's any way to interact with object more human like ? Like spam click on 1 spot because

When interacting with object it moves mouse randombly around the object which is kinda bot like and of course it's accurate is really bad :D

Ok thanks mate it worked smile.png to not create a new thread i will ask here biggrin.png now maybe there's any way to interact with object more human like ? Like spam click on 1 spot because

When interacting with object it moves mouse randombly around the object which is kinda bot like and of course it's accurate is really bad biggrin.png

 

You could so something like:

private void clickInSamePlace(final Entity entity){
    if(!getMouse().isOnCursor(entity)) entity.hover();
    else getMouse().click(false);
}

Or if you want to control the speed of the clicking, or the above doesn't work you could do:

private void clickInSamePlace(final Entity entity) throws InterruptedException {
    if(!getMouse().isOnCursor(entity)) {
        entity.hover();
    } else {
        final Point mousePos = getMouse().getPosition();
        getBot().getMouseEventHandler().generateBotMouseEvent(BUTTON1, System.currentTimeMillis(), 0, mousePos.x, mousePos.y, 1, false, BUTTON1, true);
        sleep(500); // amount to sleep between clicks
    }
}

Or if you want to click super fast all in the same spot you can do:

private void clickInSamePlace(final Entity entity, final int numClicks) {
    if(!getMouse().isOnCursor(entity)) {
        entity.hover();
    } else {
        final Point mousePos = getMouse().getPosition();
        getBot().getMouseEventHandler().generateBotMouseEvent(BUTTON1, System.currentTimeMillis(), 0, mousePos.x, mousePos.y, numClicks, false, BUTTON1, true);
    }
}

Edited by Explv

  • Author

Once again thanks  mate! But i'm facing 1 more faking problem i can't resolve.After i re-enter my house x,y changes so i can't make sure my player is near the right object.

 

Example before enter:X-10490,Y-6800,Z-0

After re-enter 11400,9540,0

 

I's it possible to fix this ;D? since i can't even walk corretly :(

Once again thanks mate! But i'm facing 1 more faking problem i can't resolve.After i re-enter my house x,y changes so i can't make sure my player is near the right object.

Example before enter:X-10490,Y-6800,Z-0

After re-enter 11400,9540,0

I's it possible to fix this ;D? since i can't even walk corretly :(

I'm not sure what you mean, can you show me your code?

  • Author

Area area = new Area(10519, 3735, 10512, 3728); inside house portal

 

And after i go outside of my house and re-enter it All cordinates changes

After:

 

Area area1 = new Area(11400, 5600, 11422, 5604); inside house portal

 

So it changes and i don't know why  :?

Area area = new Area(10519, 3735, 10512, 3728); inside house portal

And after i go outside of my house and re-enter it All cordinates changes

After:

Area area1 = new Area(11400, 5600, 11422, 5604); inside house portal

So it changes and i don't know why :?

I believe some areas in runescape are dynamic, and so using areas or fixed positions will not help you. You could either construct a relative path to wherever you are trying to walk to, or not use positions / areas at all

So how then i could walk to my room inside my house :?

 

You could do it like this, with a relative path:

Create a path from the portal to the room e.g.

 

List<Position> path = new ArrayList<>();
path.add(new Position(x, y, z));
path.add(new Position(x, y, z));

And at at the same time that you made this path store the position of the portal e.g.

 

Position portalPos = new Position(0,0,0);

Then in your script when you enter the house do something like:

 

Position currentPortalPos = getObjects().closest("portal").getPosition();

int diffX = portalPos.getX() - currentPortalPos.getX();

int diffY = portalPos.getY() - currentPortalPos.getY();

for(int i = 0; i < path.length; i++) {
    path.set(i, new Position(path.get(i).getX() - diffX, path.get(i).getY() - diffY, path.get(i).getZ());
}

And then finally walk the path

 

getWalking().walkPath(path);

Either that, or try and walk to the room using an object e.g. 

getWalking().walk(getObjects().closest("whatever"));

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.