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
  • Trading Problems


    Dqtreats

    Recommended Posts

    Posted
     

    So i'm making a script, and the method I used first was broken. So we had to switch it up and use our own built method. It is suppose to trade someone after a certain action, and it does that just fine, but it scans everyone in like a 100 title radius to make sure no one else's name compares to this certain person, and then it trades that person. If I post part of my script, would you guys be able to help me turn it into a 2 or 3 block radius instead of EVERYONE around me?

    	private void tradeWithPlayer(String playerName)
    	{		
    		for(Player p : getPlayers().all()) {
    			
    			log(p.getName() + "|"+playerName+"|");
    			if (p.getName().compareTo(playerName) == 0 || p.getName().compareTo(playerName) <-127 || p.getName().compareTo(playerName) >127) {
    				log("Player not null");
    				p.interact("Trade with");
    			}
    			else {
    				log("No "+p.getName().compareTo(playerName));
    			}
    		}
    		
    	}

     

    Posted

    So this will get an list of players in a 3 tile radius and then proceed to find my player?

    Posted

    Assuming the rest of your code works fine, that'll provide you the means to using a filter to get only the desired people you want.

    Posted

    Xephy resolved my issue! Thank you so much!

    Moderator, could you please close this thread?

    Posted

    Might as well leave it open for those who don't understand how filters work using lambdas (and their anonymous inner class equivalents)

    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.