Everything posted by Botre
-
how to spam?
- Count To 10,000!
- Problems defining Position[]
Dw it's a common mistake, glad you solved it- Count To 10,000!
- Problems defining Position[]
Make sure you are using the OSBot API import. That is: org.osbot.rs07.api.map.Position and not: javax.swing.text.Position- Count To 10,000!
- Count To 10,000!
- Another question
Why would you even make a thread about this, ever heard about PMs?- OSBot 2.3.38 - Mirror Client BETA + more
- Count To 10,000!
- OSBot 2.3.37 - Further migrations to the widget system
Appreciative of your recent burst of activity and overall work in general :--)- getting position
If you use this, make sure you only call this method when clicking. Not the kind of method you want to call every couple of ms.- OSBot 2.3.36 - Widget optimisations
This release seems extremely CPU extensive / laggy indeed, even when not running a script :-/- New :)
- A nice long vacation
- HEY!
- Botre AIO Woodcutting devlog
- Well, my name is Rutsy.
Welcome young padawan.- Count To 10,000!
- How does someone farm with osbot and proxies ?
I'm pretty sure it's something they are working on (one proxy / tab)- MGFighter: Melee [Combat] [Simple]
Yes looks good, I recommend you do the same for the bones cheers- MGFighter: Melee [Combat] [Simple]
//IMPORTS public class main extends Script { private NPC one_goblin_per_scan; // GLOBAL GOBLIN VARIABLE private long timeBegan; private long timeRan; //... private State getState() { one_goblin_per_scan= npcs.closest("Goblin"); // STORE GOBLIN // ... } @Override public int onLoop() throws InterruptedException { switch (getState()) { //... case KILL: if (one_goblin_per_scan!= null && !myPlayer().isAnimating() && !(one_goblin_per_scan.isUnderAttack()) { (one_goblin_per_scan.interact("Attack"); sleep(random(800, 1000)); //... }- MGFighter: Melee [Combat] [Simple]
Sure: 1. The WAIT state doesn't require a sleep, this just makes your script slower and less responsive which I wouldn't call desirable. I suggest you leave that state blank. Keep in mind every time the script loops it already sleeps for the onLoop()'s return value (in your case 200-300 ms). 2. Every time getState() is called you look for both the closest goblins and the closest bones. I suggest you look first for the goblin to check if the KILL state is valid. If the KILL state is not valid, then and only then look for the closest bones. Only try and get a value when that value is required. Like so: // mhm let's search the closest goblin to see if the KILL state is valid. NPC goblin = npcs.closest("Goblin"); if (goblin != null && !myPlayer().isAnimating() && !goblin.isUnderAttack()) return State.KILL; // if the code reaches this point it means the KILL state isn't valid. // what should I do next? mhm perhaps I should try and find the closest bones now. GroundItem bones = groundItems.closest("Bones"); if (bones != null && !myPlayer().isUnderAttack()) return State.PICKUP; 3. This one is also related to goblins and bones. I'm going to demonstrate the issue with the goblin case. In your getState() you scan all NPCs and try to get the closest goblin, you then store the value of that goblin locally and when the method has finished the value is discarded. Ok so a goblin was found, you are ready to kill but... you already forgot which one to kill (the previously locally stored value is already gone *sadface*). You rescan all NPCs again for the closest goblin and now you can finally attack it. That's two scans for one goblin. If you were to store the closest goblin found in the getState() method in a global value then you could just re-use that value in your onLoop(), boom: one goblin, one scan. 4. These are small errors, you are doing a great job and you might not even notice the difference when fixing these inefficiencies ;)- Prepare yourself...
You just can't resist a gentle tease eh... :$- MGFighter: Melee [Combat] [Simple]
I've seen a lot of scripts and I can tell you that this one is really clean / easy to read, especially for a first one! There are a few things that are redundant / could be more efficient but overall this is really nice Gratz!