- Joined
- Dec 10, 2014
- Messages
- 3,255
- Thread Author
- #1
How, and why, to use the PlayerSense API
What is PlayerSense? (Documentation link)
PlayerSense is used to prevent accounts from having the same pattern, even when they are running the same bot. By giving each account a different behaviour when it comes to certain things (such as using hotkeys for interfaces, hotkeys for the actionbar, when to enable run and much, much more) we strive to combat against some of the pattern detecting code that Jagex uses to identify bots.
How does it work?
PlayerSense holds all of it's information in a Map, using PlayerSense.put(key, value) to put information into the Map, and PlayerSense.get(key, value) to get information from it. There are two kinds of keys you can use, PlayerSense.Key (Documentation link) or String. When you get the value from PlayerSense, if it's using a PlayerSense.Key, it will get a value from the Generator. I recommend you use these predefined keys as often as possible.
How do I use it?
Depending on the different keys there are different ways to use PlayerSense. Here I have a short snippet of how I've used PlayerSense to determine whether to use the hotkey (space) or click on the interface.
Code:
public static boolean select(boolean click){
if(click || !PlayerSense.getAsBoolean(PlayerSense.Key.USE_MISC_HOTKEYS))
return getCraftButton().click();
else
return Keyboard.typeKey(KeyEvent.VK_SPACE);
}
Why should I use it?
By using PlayerSense you're adding another layer of security to your script, reducing the chances of being detected by Jagex's bot-detection systems.
When should I use it?
Whenever it makes sense to, if you have the option of making the bot either use a hotkey or click on the interface, use PlayerSense.getAsBoolean(PlayerSense.Key.USE_MISC_HOTKEYS) to determine which method to use. If there are certain mannerisms you want to reproduce, such as how some people consistently select the first item in their inventory and some just pick a random one, generate a value and put it into PlayerSense, then use that value to choose which one to do. Much of the API already uses PlayerSense, such as ActionBar activating, Chat Dialog option selection, the Camera API, and RegionPath generation.
Last edited: