Jump to content

Explv

Scripter II
  • Posts

    2314
  • Joined

  • Last visited

  • Days Won

    6
  • Feedback

    100%

Everything posted by Explv

  1. Wow sounds great!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11 Let me just find my wallet!!!! mfw greyname thinks people will pay him 25m for some bullshit
  2. Try doing this instead: g.drawPolygon(t.getPolygon(getBot()));
  3. http://osbot.org/forum/topic/66742-getting-position/
  4. But didn't you know you should maximise performance, and minimise readability
  5. Your opinion. You should learn what premature optimisation is. My solution is better. Thank you for playing, please try again!
  6. Item glory = getBank().getItem(item -> item.getName().startsWith("Amulet of glory")); FTFY.
  7. In the future if you post code, please use the code tags, otherwise it is completely unreadable: The issue in your code as far as I can see, is you have tree.interact("Chop Down") It should be tree.interact("Chop down") The interaction text must be exact. There are quite a few other errors in your Script, but I don't have the time to write down what they are.
  8. Arrays.stream(getBank().getItems()).filter(item -> item.getName().contains("Amulet of glory")).collect(Collectors.toList()); FTFY. getBank().getItems() returns an Item[]
  9. players.inventory.contains() Is wrong. It should be: getInventory().contains()
  10. https://www.cs.utexas.edu/~scottm/cs307/handouts/Eclipse%20Help/jarInEclipse.htm Ignore the .zip part at the end
  11. See my post here for a working solution: http://osbot.org/forum/topic/85684-finished-my-new-script-but-how-do-i-type-faster/?p=952925 I would paste the code but I'm on my phone Edit (pasted code here): 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); }
  12. String values are compared using .equals() not == Also the message will not contain / It should be: if(messageReceived.equals("!Test")){ log("Test received.."); getKeyboard().typeString("/Success!", true); }
  13. I think it might be ID 9 for clan chat: @Override public void onMessage(Message message){ if(message.getTypeId() == 9){ // do something } }
  14. The only MessageTypes available are: GAME PLAYER RECEIVE_TRADE So GAME will include clan chat messages.
  15. @Override public void onMessage(Message message){ if(message.getType() == Message.MessageType.PLAYER){ String text = message.getMessage(); } } That should get you started
  16. The real problem with those variables is that most of them are obsolete. Start xp doesn't need to be stored because all xp gain calculations can be accessed through ExperienceTracker. NPCs and Widgets shouldn't be stored globally because they are most likely going to need to be refreshed every time the method that uses them is called, same with run time. Let us all bow our heads and pray that he at least uses OOP. /roast
  17. Code looks clean but pretty awful
  18. Did you use any scripts from the Local section? They are not checked by OSBot staff.
  19. Shoot him! But seriously you do it in your scripts too
  20. Your states should be based on some boolean condition, not set when you think they should be. Otherwise when an action fails your script will be rekt. Also you should use the getBank().open() method. enum State{ OPEN_BANK, BANK } private State getState(){ return getBank() != null && getBank().isOpen() ? State.BANK : State.OPEN_BANK; } @Override public int onLoop() throws InterruptedException{ switch (getState()) { case OPEN_BANK: getBank().open(); break; case BANK: //Dostuff break; } return random(200, 250); }
  21. This is not correct though, as the distance between two positions is not the same as walking distance. Therefore it can easily return a bank that is further away, as it is closer, but the route is longer. Also if you are in a dungeon it will return an incorrect bank due to the way the map is laid out.
  22. Well it has no impact on performance. If imgur fucks up your script will still work. onPaint runs on a separate thread so I think there could also be a point at the start where img is null
  23. Not relevant to your problem but in your onPaint you should also do a null check for your image. if(img != null) g.drawImage(img, null, 0, 335);
×
×
  • Create New...