Jump to content

Fanny

Members
  • Posts

    74
  • Joined

  • Last visited

  • Feedback

    0%

2 Followers

Profile Information

  • Gender
    Female

Recent Profile Visitors

892 profile views

Fanny's Achievements

Iron Poster

Iron Poster (3/10)

11

Reputation

  1. Well, when I say inside a while, I mean the other way around (contents of onloop inside while) So you have public class FightScript extends Script { private volatile boolean isHealthOK = true; private volatile boolean isPvPDetected = false; @Override public int onLoop() throws InterruptedException { while (isHealthOK && !isPvPDetected) { // While health is okay, perform main script logic } if (!isHealthOK) { // Eat logic } if (isPvPDetected) { // PvP logic } } } Should work I think? (untested) It is good learning for me to be honest, I'd have just extended my sleep class to include a health check by default and auto-eat, but I like this multithreaded approach, plus it's more learning
  2. Just a thought... You could put the whole onloop method inside a while loop on a volatile marked boolean private volatile boolean isHealthOK = true; while(isHealthOK){ //logic } This would break it for food logic, which could mark it true again after eating Should be able to control this boolean from the other thread too because volatile I'm trying to collect data like this food healing amounts etc, to make scripts more dynamic with less GUI/setup generally I'm not a 1337 programmer either We are all learning, even the best still learn!
  3. Yeah exactly that! You could filter the inventory based on the list too, so you know what foods you have available, and how much each one heals public class FoodHealingAmount { private static final Map<String, Integer> FOOD_HEALING_MAP; static { Map<String, Integer> foodMap = new HashMap<>(); foodMap.put("Lobster", 12); foodMap.put("Swordfish", 14); foodMap.put("Shark", 20); foodMap.put("Monkfish", 16); foodMap.put("Trout", 7); foodMap.put("Salmon", 9); FOOD_HEALING_MAP = Collections.unmodifiableMap(foodMap); } public static Set<String> getAllFoodNames() { return FOOD_HEALING_MAP.keySet(); } //etc } // Get all food names Set<String> foodNames = FoodHealingAmount.getAllFoodNames(); // Filter inventory items that are food Item[] foodItems = getInventory().filter(item -> foodNames.contains(item.getName())); Regards locking logic, I'd personally be tempted to contain eating logic to the main script (or any actual actions) to keep things consistent and error-free, but I can see why you would want it in a separate thread - and where is the challenge of doing it in a single thread??!
  4. Really interesting, nice job I haven't really toyed with performing actions in a multi-threaded scenario and locking them out so I'm trying to interpret how the locking mechanism works! Looks well handled, error-wise I would be tempted to expand with an AvailableFood class which stores a list of foods and their healing values, so that you don't have to input what food type, can also dynamically eat mob dropped food that way I would also be tempted to take a range of values for eatBelowHP, so for 99HP you might say 75-40, each time you eat a food, you can set the eatBelowHP to a random value in that range until it next eats, then set the value again etc. You could combine both of these to check where your HP is within the range (higher or lower end of the range) and have AvailableFood.eatBestFood() or something if you are nearer 40hp, or AvailableFood.eatWorstFood() if you are near to 75hp in the example Alternatively, you could instead of taking eatBelowHP, take mobMaxHit, then you can dynamically leave a safety margin and create a range in which to eat using players max hp, and this would be more scalable for all levels and mobs
  5. Looks good, nice work!
  6. It depends a lot on what the onLoop() function does. if you just have simple logic such as if/else or switch then it is not going to make too much difference If you have more complex logic, or lots of variable instanciation on each loop then it will be more demanding if it loops quicker Generally, it is not going to make much difference for most people but it depends how many bots you plan to run and your system specs I guess Dunno about webwalking memory usage though, I don't have any issues with memory usage personally
  7. Quick update: Spent a lot of time fleshing out my utility scripts Writing scripts is a breeze now, with all the complex logic handled in the utilities, no need for writing extensive checks on every action etc, Thanks for this, 10X developer overnight I just have a quick question; regards paid scripts, the guide says requires Scripter II, but it makes no indication of what that means or how to get it (but I see you have that badge) I seem to recall someone mentioning a test or something, but IDK, would be interested to know?
  8. That is a great idea It is also a good idea to keep track of this information when depositing, as it can misclick deposit equipment instead of deposit all I noticed
  9. IMHO, flawless functionality is key Should perform is required task with every possible unusual scenario handled (like mis-clicking etc) and no excessive waiting if something unusual happens Also, human-like profiling is a bonus I reckon - sleep timing perfect and the patterns associated with sleeps... Sometimes people just tab out for a minute or whatever, so script should too on occasion. I really think sleep timing is the biggest thing to stop bans once the functionality is flawless Bonus points for little extra thoughtfulness - competing with someone for a resource? Double down the timing to try and snag them first with some different logic for competitiveness to get rid of the person, or become aware of it and hop worlds
  10. This is a good idea actually, it would allow full control of the run energy It could be programmed to be impatient sometimes and run with only 3% or 5% energy, or other times patiently walk, sometimes notice it has 60% run and switch run on shortly after starting the walk, etc. A separate thread would allow repeatedly checking distance to target also, allowing further refinement to when run is switched on or not I did consider this, but I think the webwalking is pretty well written, don't want to reinvent the wheel too much - but this would be less resource intensive. Would be a lot more programming though to handle obstacles like the webwalk does If all of my async checks into a single additional thread, it shouldn't be too resource intensive hopefully, but would love to know if there is an easier way or even an existing method that we don't know about!
  11. I haven't been able to find anything about this, and I am struggling to find a way to do this other than to manually start walking in the rough direction and then toggle run energy. Is there a built in way to toggle run after a short duration of walking randomly? (like a player would realise they are only walking then turn run on)
  12. Yeah it can really imagine some stupid methods sometimes, or completely misunderstand what you asked... I find it saves time to outline the function manually and have it flesh it out with the boring bits
  13. YES! So satisfying when your script just runs first time with only minor issues!
  14. This is what I was looking for, thanks so much! Working on my utils now, hopefully better and less effort scripts result I had my environment set up so that each script is a project, when there should be one project with multiple modules for scripts - seems to work now, not tested it extensively yet
  15. Wow that does look very neat. Yeah, mine looks nothing like that. Not sure where I went wrong, the other classes are what should be my dependencies like you have it Also my script is the entire project? You seem to be able to access individual projects from the same screen Dunno about IntelliJ Idea, my setup is more like No Idea
×
×
  • Create New...