Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Interact with NPC without walking


    atgp42

    Recommended Posts

    The .interact() method will walk towards the target in some cases. I would like to individually call the 'camera rotation' and 'mouse move/clicking' portions of the interact() function, so there is no chance of this function walking the player towards the entity.

     

    Edit: I figured out how to do the mouse move and clicking part, use 'InteractionSetting.EMPTY'.

    boolean customInteract(String action, Entity name) {
    
            EntityDestination ed = new EntityDestination(ctx.getClient(), name);
    
            InteractionEvent ie = new InteractionEvent(ed);
    
            if (ie.interact(action, InteractionSetting.EMPTY)) {
    
                return true;
    
            }
    
            return false;
    
        }
    

    Any help would be much appreciated, thanks.

    Link to comment
    Share on other sites

    thanks for the quick reply. here is a bigger snippet of the attacking method

    if (ctx.getLocalPlayer().isInteracting(ctx.getNpcs().closest(npcName))){
    			return true;
    		} else {
    			if (!ctx.getNpcs().closest(npcName).isOnScreen()) {
    				ctx.getCamera().mouseRotateToEntity(ctx.getNpcs().closest(npcName));
    			} else {
    				if (customInteract("Attack", ctx.getNpcs().closest(npcName))) {
    					return true;
    				}
    			}
    			return false;
    		}
    
    	
    
    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.