Naton 1028 Posted August 31, 2021 Share Posted August 31, 2021 When enough accounts are using your script, you may not want every account to be behaving exactly the same. You may want to create specific preferences for each account. The TRiBot Script SDK contains a class to assist with generating player specific preferences. See the docs at https://runeautomation.com/docs/sdk/-tribot--scripting--s-d-k/org.tribot.script.sdk.antiban/-player-preferences/preference.html The class is org.tribot.script.sdk.antiban.PlayerPreferences To generate a preference, call PlayerPreferences.preference(key, generatorFunction) Ex. PlayerPreferences.preference("org.tribot.Antiban.eatPercent", g -> g.uniform(30, 60)) This above line would generate a value evenly distributed from 30-60 for all accounts. Calling this method with the same parameters always gives the same value for the same account, even if you re-run the script on another machine. Note that some level of care must be taken to not duplicate the preference key - see the preference key parameter docs for a convention to follow. Let's try a real example. Let's say we want 70% of our accounts to train mining first and get a coal bag for blast furnace, and we want 30% of our accounts to train smithing to 30 first. We could do this with the following code: int preference = PlayerPreferences.preference("scripts.blastfurnace.decisions.MineOrSmith", g -> g.uniform(1, 100)) if (preference > 30) { // mine } else { // smith } Note that the key being used doesn't really matter, it's used in combination with your in-game account name to generate a seed for the random number generator used by the generator function. This allows the preferences to be repeatable when running the script again on the same account. You just need to make sure not to use the same key for more then one preference. You can do so much more then just have 70% of accounts doing one activity, but that is a simple real-world example. This is a very powerful and easy to use feature that allows you to create customized (and most importantly, repeatable even if you re-run the script, or really just the same preference key and generator function not necessarily the same script, on another machine but on the same account) playstyles for your bots. Quote View all my bots on the TRiBot store! (premium) (free) Need assistance with any of my bots? Join the nScript support discord (link below). nScripting.com nScript Support Discord Refund Policy Automate your bot management through nRestocker and the TRiBot Bulk Launcher Link to comment Share on other sites More sharing options...
Polymorphic 116 Posted September 2, 2021 Share Posted September 2, 2021 This is awesome Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.