Jump to content

Lemons

Lifetime Sponsor
  • Posts

    620
  • Joined

  • Last visited

  • Days Won

    1
  • Feedback

    100%

Posts posted by Lemons

  1. Simply increase the memory of the JVM:

     

    java -jar OSBot.jar -mem 1000

     

    OSBot starts with 500mb of heap space by default, this is fine for 1 script most of the time. To run 2 tabs you need to basically double the heap space, hence '-mem 1000'. The CPU usage is coming from the GC cycle running constantly.

  2. Oh, sorry smile.png Never thought that publishing something that has been hiding in the internet for ages would be a bad thing, especially when there are a lot of people who have never seen this.

     

    Sorry if I seemed cynical lol, it's fine ya posted it. Just saying, its old info :p

  3. It works great on Windows. Failed to launch it on Linux, any ideas?

     

     

     

    Super easy for my own scripts. Problem when I want to launch a script that someone else made. And I find decompiling it unethical biggrin.png

     

    What Abuse said should work as well. I use the syntax I gave above on Linux though atm, no idea why it won't work. Which shell are you using?

  4. Hi, 

    I have two pieces of code which I've been trying to optimize for the last couple of hours, I've looked through the API, I've fiddled in eclipse and I just can't seem to find a logical answer. 

    In this first piece, I'm grabbing all the NPCs around the player, checking if they're a fishing spot, & if they are, I'm adding them to an arraylist called fishingSpots. (I'm doing this to detect which kind of fishing spot is the type I want to fish at, where I then iterate over the fishingSpots & check to see if they have the correct interactions)

    List<NPC> objects = main.getNpcs().getAll();
    ArrayList<NPC> fishingSpots = new ArrayList<NPC>();
    for (int i = 0; i < objects.size(); i++) {
    	if (objects.get(i).getName().equalsIgnoreCase("fishing spot")) {
    		fishingSpots.add(objects.get(i));
    	}
    		main.randSleep(8, 12); // This is just a void that sleeps(random(min,max)), I used this as an attempt to reduce CPU load, but when iterating over objects, there are some 6000, having a sleep causes incredible delay
    }
    

    & Inventory slots -- I'm checking to see if an item is in the slot x, where x is a random whole number from 0-27 inclusive.

     

    int i = (int) Math.round(Math.random() * 27);
    		while (main.getInventory().getItemInSlot(i) == null) {
    			i = (int) Math.round(Math.random() * 27);
    			main.randSleep(8, 12);
    		}
    

    These loops cause an incredible amount of CPU load, jumping from some 8% up to, what I've seen, 60% load.

    Any and all help would be appreciated. smile.png

     

    For the last loop, hard to understand what you're trying to accomplish. It seems you're trying to wait until you have caught a fish? If so, you method currently would continuously loop until it found a non-empty inventory slot, then I assume go right back into that loop again. This will ofc use a lot of CPU.

     

    Try using a conditional sleep:

    int lastSlots = getInventory().getEmptySlots();
    new ConditionalSleep(5000) { // Sleeps are in milliseconds, sleep for 5 secs
     
       @0verride
       public boolean condition() throws InterruptedException {
          return getInventory().getEmptySlots() == lastSlots;
       }
    };
    • Like 1
  5. You get 2 boxes, each has a ethernet port and an electrical plug. You plug one side to the router, plug in to wall, go to where you want internet, plug the other in to wall, press the buttons on them to sync, your ready. It'll work with standard electrical ran through the walls, nothing special required. No wifi, you just get an ethernet port at the other end, you can add a router to that tho.

     

    The only issue is these basically cause interference over the lines, so any sensitive equipment (my TV with over-the-air would become pure static when I used them, no probs with cable) will pick up the noise.

     

    I have a set of those myself, they work great. Got <1ms ping to router consitently, gamed on them fine, data transfer is good enough for most uses (I only got 90mbps internet so poor test, did no lan tests). Easier than running a wire.

  6. The problem you are facing is you are comparing fighters by their initials and combat level. If you add two "a" fighters with same combat, when you go through your loop of fighters in the second for loop (the one nested in the first), you're comparing the initial and Combat enums. This means, it will always pick the first Fighter in the Barracks with those initials/Combat enum, and will think it needs to remove that specific Fighter from the Barracks twice. This results in the -1 you are seeing, as the second time around the Fighter is already gone.
     
    If you wanna stick with your current solution, simply replace:

    if (fghtr.getInitial() == nameInChars.get(i) && fghtr.getCombatStyle().equals(combatStyle) && removedFighters  == 0)

    with

    if (fghtr == fgt)

    This will result in the correct fighter being removed. This is because we are checking if its the same fighter object, not that it just has the same initials/Combat enum. Now, you are reiterating through lists for no real reason, and I think your logic is slightly off (calling "aabb" if the array has 4 "a"s would return 4 "a"s instead of 2 a and 2 b), here is a simpler solution:

     
    http://pastebin.com/LmngC84M
     
    And from there, you could do:

    barracks.createFighters('a', Combat.MELEE, 3);
    barracks.createFighters('b', Combat.MELEE, 3);
    barracks.createFighters('c', Combat.MELEE, 3);
    barracks.callFighters("aabbcc", Combat.MELEE);

    which results in:

    We have 9 fighters.
    Removing A:MELEE from barracks
    Removing A:MELEE from barracks
    Removing B:MELEE from barracks
    Removing B:MELEE from barracks
    Removing C:MELEE from barracks
    Removing C:MELEE from barracks
    We removed 6 fighters, leaving us with 3 in the barracks.
    • Like 1
  7. Thanks, fiddled around a little bit and got the ID's. 

     

     

    This is just for information gathering right? Cause I don't believe that I'll be able to interact with a widget through the info of its' tooltip.

     

    Anyway thanks for the responses.

     

    But how about getting the widgets without hardcoding ID's?

     

    For example, the pottery interface for the "Make 1", "Make 5", "Make 10", "Make X" is all separate widgets with the "Make X" being the tooltip. Might be only on older content, but it happens (and its the action basically).

  8. What evidence suggests this? I have personally experienced this multiple times that my home IP gets me fast bans. It didnt the first time since then its been frequent.

     

    When using different Ip address my accounts last much longer

     

    Before I moved, I ran 200+ accs (lots of bans, 2-3 at a time) on same IP over the course of a few months, next script run was never significantly different than the previous.

     

    Proxies only prevent chain bans.

     

    it could have been delayed bans

     

    I believe in the ip flags too 

     

    ive seen it with my own eyes all my bots shutting off at once 

    and gettin the ban hammer!

     
    What you described is a chain ban, not a "flagged IP".
  9. Not really a problem for it going slower. Thanks for showing me how to use Filters and getItemInSlot kappa. But shouldn't it be < 27 biggrin.png

     

    What you are experiencing is the fact that the Inventory doesn't update immediately. Either loop all 28 slots in 1 onLoop, or keep an iterator between onLoops to know where to continue from.

     

    Also, its < 28 cause indexes 0-27 need to be iterated over :p

    • Like 1
  10. I don't see how this is faster, since it's the difference between locally calculating a path using whichever pathfinding algorithm the OSB team has implemented, and locally calculating a path using whichever pathfinding algorithm Jagex has implemented.

     

    Faster, no, but it would be useful in that is would be the exact path your character is going to follow before walking.

  11. A lot more than you think goes on when an update occurs. OSBot developers have to go through and figure out if hooks were changed, removed, or added. Sure, they could push a fix in 2 seconds after an update just to make the client load, but the bot would not function right at all. Just be patient, this is a great time to go outdoors and get some fresh air and check back later.

     

    It's scary out there tho

    • Like 1
×
×
  • Create New...