futurepasts Posted May 11, 2016 Share Posted May 11, 2016 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? Quote Link to comment Share on other sites More sharing options...
Solution Posted May 11, 2016 Share Posted May 11, 2016 Create a TypeKeyEvent with the boolean enter set to false. Quote Link to comment Share on other sites More sharing options...
Fruity Posted May 11, 2016 Share Posted May 11, 2016 sure it something like getKeyboard().typeString("String", false) or something along those lines Quote Link to comment Share on other sites More sharing options...
futurepasts Posted May 11, 2016 Author Share Posted May 11, 2016 Ok but maybe is it possible to spam without delay or with really low ? Cuz thats really slow Quote Link to comment Share on other sites More sharing options...
DragonAlpha Posted May 11, 2016 Share Posted May 11, 2016 You want to hold down the key or type it? Type the key = hold down, tiny delay, then release Quote Link to comment Share on other sites More sharing options...
Fruity Posted May 11, 2016 Share Posted May 11, 2016 (edited) Ok but maybe is it possible to spam without delay or with really low ? Cuz thats really slow 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 May 11, 2016 by Fruity Quote Link to comment Share on other sites More sharing options...
Explv Posted May 11, 2016 Share Posted May 11, 2016 (edited) 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 May 11, 2016 by Explv 1 Quote Link to comment Share on other sites More sharing options...
futurepasts Posted May 11, 2016 Author Share Posted May 11, 2016 Ok thanks mate it worked to not create a new thread i will ask here 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 Quote Link to comment Share on other sites More sharing options...
Explv Posted May 11, 2016 Share Posted May 11, 2016 (edited) Ok thanks mate it worked to not create a new thread i will ask here 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 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 May 17, 2016 by Explv 2 Quote Link to comment Share on other sites More sharing options...
futurepasts Posted May 11, 2016 Author Share Posted May 11, 2016 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 Quote Link to comment Share on other sites More sharing options...
Explv Posted May 11, 2016 Share Posted May 11, 2016 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? Quote Link to comment Share on other sites More sharing options...
futurepasts Posted May 11, 2016 Author Share Posted May 11, 2016 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 :? Quote Link to comment Share on other sites More sharing options...
Explv Posted May 11, 2016 Share Posted May 11, 2016 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 Quote Link to comment Share on other sites More sharing options...
futurepasts Posted May 11, 2016 Author Share Posted May 11, 2016 So how then i could walk to my room inside my house :? Quote Link to comment Share on other sites More sharing options...
Explv Posted May 11, 2016 Share Posted May 11, 2016 (edited) 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 May 11, 2016 by Explv 1 Quote Link to comment Share on other sites More sharing options...