Jump to content

lisabe96

Members
  • Posts

    821
  • Joined

  • Last visited

  • Feedback

    100%

Posts posted by lisabe96

  1. 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

  2. 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 :)

  3. 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;
    }
    
  4. 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

  5. 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

  6.  

      • 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.

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

    I win for readable oldschool code

  8. Since yesterday the "notifications dropdown" doesn't seem to work anymore for me.

     

    yVVciYv.png

     

    This is what I see ^

     

    The number displaying the amount of notifications will be gone after clicking but I wasn't actually able to see them

    because it just displays this small gray border.

     

    OS: Windows 7 x64

    Browser: Opera 35.0

     

     

    EDIT:

    Excuse me, I just saw there is already a topic running on this issue.

     

    http://osbot.org/forum/topic/92959-notifications-bug/

  9. java.lang.NoSuchMethodError: org.osbot.rs07.api.Walking.webWalk(Lorg/osbot/rs07/api/map/Position;)

     

    webWalk(position) was deprecated and now removed. You might want to update to  webWalk (Area) or similar

     

    Best wishes

     

    Thanks for noticing.

    However as it isn't on the SDN it's not urgent.

     

    I am in the process of reworking most of my scripts currently,

    so eventually this one and all my other ones will be updated.

    Just give me a little :)

  10. script is great but there's 1 big issue. At Draynor whenever the bot goes to bank whether it was custom or a set area, he enters the bank and spams click multiple times left side of the door  and sit there for a bit, then walks to the bank booth. The issue is, it's too obvious it's a bot. IF it went straight for the banking counter it'd have been better. What it does is, it clicks on the door's frame, then spams click on the left by those 4 booths by the wall instead of going straight for the banking booth. I hope I made it clear tongue.png

    To visualize it, imagine you are at the bank's door and the camera is poiting towards the fishing area/willow area. Now the left spot right by the door's entrance inside bank is the culprit.

     

     

    great script.

    As mentioned before, it's a webwalking issue. Hope it will be fixed with the next API update. :)

    • Like 2
×
×
  • Create New...