Jump to content

KevinHouse

Members
  • Posts

    21
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by KevinHouse

  1. You shouldn't use any methods from the API in your paint. This if often very resource intensive as these calculations would be repeated at around 50 times per second. You should assing closestObject() to a variable in your onLoop() or in a thread.This way your not doing useless calculations and you're not slowing down the fps.

    You kind of answered it in your description; it doesn't work from within your paint, but it does from outside your paint.

  2. There seems to be a possible NPE in the KeyboardController class.

    if (string == null) {

       string = "";

    }

    java.lang.NullPointerException	at org.osbot.engine.input.KeyboardController.typeString(cd:12)	at org.osbot.script.MethodProvider.type(ed:23)	at org.osbot.db.r(pd:81)	at org.osbot.db.onLoop(pd:82)	at org.osbot.nb.run(kj:103)	at java.lang.Thread.run(Unknown Source) 
  3. Hey developpers,

    it would be nice to see the stacktrace when an error is thrown when loading scripts on the osbot logger.

     

    stacktrace.png

     

    That way you can see the error without running it from the cmd! :D

  4. Player.getZ() returns the hight of the Tile fo your player on the Z axis, just like getX and getY return the X and Y coordinates of a player.

    You should open the combat tab and split the string from the widget with text "combat level: X"

  5. It all depends on the situation, I think ternary is very usefull to clean up your code in most cases.

    Following example would be alot messier if using if else statements:

    	public static Area createCubicArea(Position p1, Position p2) {		int minX = (p1.getX() < p2.getX()) ? p1.getX() : p2.getX();		int maxX = (p1.getX() > p2.getX()) ? p1.getX() : p2.getX();		int minY = (p1.getY() < p2.getY()) ? p1.getY() : p2.getY();		int maxY = (p1.getY() > p2.getY()) ? p1.getY() : p2.getY();		int minZ = (p1.getZ() < p2.getZ()) ? p1.getZ() : p2.getZ();		int maxZ = (p1.getZ() > p2.getZ()) ? p1.getZ() : p2.getZ();				Area cubicArea = new Area();				for(int i = 0; i <= (maxX - minX); i++) {			for(int j = 0; j <= (maxY - minY); j++) {				for(int k = 0; k <= (maxZ - minZ); k++) {					cubicArea.add(new Position(minX +i, minY +j, minZ +k));				}			}		}				return cubicArea;	}
×
×
  • Create New...