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.

lisabe96

Members
  • Joined

  • Last visited

Posts posted by lisabe96

  1. ·

    Edited by lisabe96

    I understand that it is quite intensive to load them every paint, but the problem is that the client uses more and more memory + cpu when the script is ran for more than a couple of hours. it runs smoothly when ran initially.

     

    I don't know what exactly you need that method for every onpaint.

    But try updating outside the paint and store the data to re-use it in the paint.

    This way it will be a lot less heavy.

    private var someVar;
    
    
    private void update() {
      for (Player player : getPlayers().getAll()) {
        if (condition) {
          someVar = x;
        }
      }
    }
    
    onLoop() {
      if (System.currentTimeMillis() - lastUpdate > 1500) {
        update();
      }
    }
    
    onPaint() {
      draw(someVar);
    }
    
    
  2. 1. OSBot Version (do NOT put "current version", be specific)

    2.4.41

     

    2. A description of the issue. Include relevant logs.

    getWorlds().isMembersWorld() 

    returns true when in a free world.

     

    3. Are you receiving any errors in the client canvas or the logger? 

    No

     

    4. How can you replicate the issue?

    By printing the return of the code posted above

     

    5. Has this issue persisted through multiple versions? If so, how far back?

    I can't say as It's the first time I'm using it

  3. Agreed I see how much time this would save the average person not to mention its kinda a dummy proof system(no such thing exist). Looking through I can't find a solution like you suggested without shutting down the mouse click on the game canvas. You could block mouse clicks at the time of selection and make the click itself void. I have few other ideas but not ones i'm sure that could be pulled off without testing.

     

    Currently the best I could come up with to keep it user friendly :p :

    aDi50ue.png

     

    giphy.gif

  4. I'd say use your code you posted in your other help post. Instead of using mouse clicked and drag listener, do one for key input. Possibly add a command that enables this sequence to be activated. Then do something to the extent of every time you press a key it will grab the tile the move is hovering over. Does that make sense? 

    It makes sense but it's not as user friendly as I'd want it to be.

     

    In case knowing the purpose would help to find ideas:

    It's for a firemaking script where I'd like the user to be able to select the tiles to use.

    This way I can allow them to make fire wherever they are, not limited by locations, also avoid the same patterns for everybody to be used.

    Based on the selected tiles I internally build lines and patterns.

  5. Can't you just bind the selection processes to a key like s instead of a mouse click? I don't think the API supports mouse inhibition without the keyboard being in the same state. At least in the current build.

     

    Maybe a way to enable input then programatically so the user doesn't have to bother about it.

    Then maybe block mouse clicks from the game so the character doesn't move?

  6. ·

    Edited by lisabe96

    While input is disabled on the client, I'd like camera movement to be enabled.

     

    The reason is that I want to reach more tiles by moving the camera, but I don't want my character start

    running around like a tard when clicking the tiles. Which happens with input is enabled.

    So I'd only want camera input enabled.

     

    f94GdNC.png

  7. I'm not sure drawPolygon will work if the position's Z coordinate is not 0 (could be wrong).

     

    If this is the case you could use:

    Polygon p = position.getPolygon(getBot(), myPosition().getZ());
    if(p != null) g2d.draw(p);
    

    Which I can confirm DOES work on with all planes.

     

    Cheers

    Thanks, will use.

    Better avoid possible problems :)

  8. Got it working :D

    It doesn't look good when the camera is tilted as it draws the screen and not the game world obviously.

    But it works.

     

    MQ0IhH1.png

    private List<Position> tiles = new ArrayList<>();
    
    
    @Override
    public void mouseDragged(MouseEvent e) {
    	handle(e);
    }
    
    @Override
    public void mouseClicked(MouseEvent e) {
    	handle(e);
    }
    
    private void handle(MouseEvent e) {
    	log(e.getX() + ", " + e.getY());
    		
    	Position pos = getPosition(e.getPoint());
    		
    	if (exists(pos)) {
    		tiles.remove(pos);
    		return;
    	}
    	tiles.add(pos);
    }
    
    @Override
    public void onPaint(Graphics2D graphics) {
    	Graphics2D g = (Graphics2D) graphics;
    	g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF));
    		
    	g.setColor(Color.GREEN);
    		
    	if (!tiles.isEmpty()) {
    		for (Position t : tiles) {
    			if (t.isVisible(getBot())) {
    				g.draw(t.getPolygon(getBot()).getBounds());
    			}
    		}
    	}
    }
    
    private Position getPosition(Point mousePosition) {
    	for(int x = 0; x < 104; x++) {
    		for(int y = 0; y < 104; y++) {
    			Position pos = new Position(getMap().getBaseX()+x, getMap().getBaseY()+y, getMap().getPlane());
    			if(pos.isVisible(getBot()) && pos.getPolygon(getBot()).contains(mousePosition)) {
    				return pos;
    			}
    		}
    	}	
    	return null;
    }
    	
    private boolean exists(Position pos) {
    	if (!tiles.isEmpty()) {
    		for (Position tile : tiles) {
    			if (tile.equals(pos)) {
    				return true;
    			}
    		}
    	}
    	return false;
    }
    
  9. Perhaps you can do something like:

     

    for each tile in myplayer.getArea(radius):

      if tile.polygon contains (mx, my):

        return tile

    not the most efficient solution tho

    I hope to find something more efficient, but I'll give it a try if I can't figure out anything else

     

     

    Not 100% since im not where I can freely test. The solution might be 

    mouse().getArea();

    As I said I recall doing this at one point in scripting but I'd have to test it.

    This would return java.awt.geom.Area

  10. ·

    Edited by lisabe96

    Entity hover debug shows you which tile you are hovering over if thats what you need.

     

    That's exactly what I need but I need it in code.

    Maybe this example will be more clear:

    void mouseMoved(MouseEvent e) {
      Tile tile = new Tile(mouseX, mouseY);
      log(tile.getPosition());
    }
    

    This obvious doesn't work, I'm after how I would get this working within osbot

  11.  

      • Bad Example:
      • public RS2Object entrance;
            public RS2Widget wait;
            public RS2Widget cont;
            public NPC guard;
            public NPC tzkih;
            public NPC tzkek;
            public NPC tokxil;
            public NPC ytmejkot;
            public NPC ketzek;
            public NPC jad;
            public NPC ythurkot;
            String state;
            int startHPExp;
            int startATTExp;
            int startDEFExp;
            int startSTRExp;
            int completed;
            long startTime;
            long runTime;
        

        This is an example of bad code! Most of us have probably defined our variables like this before and thought it is correct. Though it is correct and will work, it is not the most efficient and clean way to define them.

     

    • Good Example:
    • int profit, age;
      int a = 4, b = 6;
      long startTime, timeRun
      RS2Object guard, target, chicken;
      RS2Widget selectX, makeAll;
      ..... so forth
      

      Fewer lines of your code, all your variables are still there and it looks neater and easier on the eyes.

     

     

    I personally find the first example a lot cleaner and easier on the eyes.

  12. ·

    Edited by lisabe96

    for (Item item : script.getInventory().getItems()) {
      if (item != null && item.getName().startsWith("Amulet of glory")) {
        return item;
      }
    }
    

    I win for readable oldschool code

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.