-
Posts
439 -
Joined
-
Last visited
-
Days Won
1 -
Feedback
100%
Posts posted by Xerion
-
-
Just now, Polymorphism said:
So assuming threshold=1 would be exact position or threshold=0 would be? I'm giving this a go, still new to this API so haven't learned the ins and outs
Use 0
- 1
-
Use the walking event. This way you can set the minimal distance threshold. I believe the default is 3 so that's why the method returns true when you are not standing on the exact position.
-
I would suggest using https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Callable.html instead of using that interface.
- 1
-
Feel free to modify it.
Okay. Gimme a few minutes
I don't want to spoon feed everything, but this should be a good basis.
Also note that this class extends the API so you wont have to use script.client or script.inventory.
The thread will automatically stop after a script has stopped.
import org.osbot.rs07.Bot; import org.osbot.rs07.script.API; import java.util.ArrayList; import java.util.List; /** * Created by Xerion on 16-1-2017. */ public class InventoryObserver extends API { private List<InventoryListener> listeners = new ArrayList<>(); /** * * @param bot */ public InventoryObserver(Bot bot){ this.exchangeContext(bot); new Thread(() -> { logger.debug("Started: InventoryWatcher"); while (isRunning()) { try { sleep(loop()); } catch (InterruptedException e) { e.printStackTrace(); } } logger.debug("Stopped: InventoryWatcher"); }).start(); } @[member=Override] public void initializeModule() { } /** * * @[member=Return] */ private int loop(){ /** * Add your code here to check if item is added/removed */ return 100; } /** * * @[member=Return] True if a script is running */ private boolean isRunning(){ return bot.getScriptExecutor().getCurrent() != null; } /** * * @param listener */ public void addListener(InventoryListener listener) { listeners.add(listener); } /** * * @param listener */ public void removeListener(InventoryListener listener) { if(listener != null && listeners.contains(listener)) { listeners.remove(listener); } } }
- 6
-
while (true) {
Really??
Just don't do that.
- 2
-
I don't have a clue on how to setup linux. If there are any guides out there please help me out.
Well it depends on with distro you are using (CentOS, Ubuntu, etc). Secondly there should be a lot of tutorials on the internet.
-
-
-
You have several options.
- If you know what items you want to buy, just hardcode the item ids
- Write your own buy method that uses item names instead of ids
- Use an existing buy method that uses item names instead of ids, there are already snippets around on the forum, for example: http://osbot.org/forum/topic/90148-simple-ge-api
Additionally you also do an API suggestion here:
http://osbot.org/forum/forum/102-client-bugs-suggestions/
Could be useful for everybody else if an method is added that supports item names.
-
Why do you want to know it? Well in most cases there are multiple items that have the same name. The easiest example to mention is noted and unnoted items.
You can use the ItemDefinition class, but I believe you have to load the items first.
-
It just has a different name. I believe it's "rock"
- 4
-
Had the same issue, but did this and it worked for me:
private boolean isNoted(GroundItem item) { return item != null && item.getDefinition() != null && item.getDefinition().getUnnotedId() != -1 && item.getId() > item.getDefinition().getUnnotedId(); } private int getUnnotedID(GroundItem item) { if(item != null) { if(isNoted(item)) { return item.getDefinition().getUnnotedId(); } return item.getId(); } return -1; }
I know this is for ground items, but may apply to items too.
I know how I can get the correct results (which I already did). The problem is that variables don't return results you expect. The noted id of a noted (oak) log shouldn't be 799 and the unnoted id of an unnoted item shouldn't be the noted item.
I'm kinda surprised that nobody has reported this before. I'm also afraid if this bug is resolved that some scripts will break, because scripters decided work around this bug incorrectly instead of reporting it and getting it fixed.
EDIT: Ground items use the item definitions so you are correct that they are the same.
-
I'm getting a different id for oak logs:
Sorry, in the original post I used normal logs instead of oak logs. I tested it again today with both normal and oak logs and I get same strange and odd results
item id: 1511 Noted id: -1 Unnoted id: 1512 item id: 1512 Noted id: 799 Unnoted id: 1511 item id: 1521 Noted id: -1 Unnoted id: 1522 item id: 1522 Noted id: 799 Unnoted id: 1521
When I use the inventory debugger everything seems to be alright, yet I still have messed up noted and unnote ids when using the kotlin code.
I'm using the latest osbot client (2.4.84) running stealth injection mode.
-
Why don't you just increase the counter every time you buy the item?
-
I'm getting some really strange results for noted and unnoted ids using the item definition API.
Using the following code I got the following results:
import org.osbot.rs07.api.def.ItemDefinition import org.osbot.rs07.script.Script import org.osbot.rs07.script.ScriptManifest /** * Created by .... */ @ScriptManifest(author = "Xerion", name = "Secret project", version = 0.0, info = "", logo = "") class StakerScript : Script() { @Throws(InterruptedException::class) override fun onLoop(): Int { try { val definition1 = ItemDefinition.forId(1511) System.out.println("item id: 1511") System.out.println("Noted id: " + definition1.notedId) System.out.println("Unnoted id: " + definition1.unnotedId) val definition2 = ItemDefinition.forId(1512) System.out.println("item id: 1512") System.out.println("Noted id: " + definition2.notedId) System.out.println("Unnoted id: " + definition2.unnotedId) }catch (e : Exception){ e.printStackTrace() } return 150 } override fun onStart() { } }
Please note this is coded in Kotlin.
Results:
item id: 1511 Noted id: -1 Unnoted id: 1512 item id: 1512 Noted id: 799 Unnoted id: 1511
The item used was an oak log and both the items (noted & unnoted) were in my inventory. The noted and unnoted ids seem to be completely wrong and not give the results back I expected.
ps. Additionally it might be handy to add an isNoted method to the item definition class.
-
I would consider adding random sleeps in between target selection perhaps after a mouse hover off screen to simulate afk for a few secs.
What would be considered more realistic? When I'm playing legit I always choose the closest NPC. Why run past one target to get to another one?
A human would not always pick the closest NPC.
For example:
NPC A is 6 tiles away from the player and is visible on the screen.
NPC B is 5 tiles away from the player and not visible
If a bot would pick the closest NPC it will turn the screen and interact with NPC B. A human would interact with NPC A because that one is already visible. If you let the bot always chose the closest NPC you will get a pattern that does not happen with normal players. I agree that humans will mostly interact with the closest NPC, but that is not guaranteed.
- 3
-
Technically those things can be detected on Jagex end. I'm not going to say it matters but they will know of you do those things.
First of all I want to say to most of the things you mention should be in your script. Hovering the next monster or food to eat will make your script faster so in my opinion it's worth the development time to add those things.
In my opinion the most important thing for a combat script is target selection. If you always attack the closest target you will get banned eventually. My advice is to create a method that will select your next target in a more realistic way.
- 1
-
Last time I read an article about it they said they haven't spotted one in the wild. The easiest way to check if it was legitimate was to check the permissions. The legit one only needs Camera, contacts, location and storage.
I downloaded mine from APKmirror and everything was fine.
- 2
-
Read quote below. Jagex updated some st00f so the bot needs to be checked/updated. If Jagex does stuff like this every Thursday, then yes it will be every Thursday, but no one knows what/when/if Jagex will change things.
Besides Jagex
Thanks! How did you acquire this info?
I assume he ran some test code and the return values were off.
I have my private updater. An updater searches for bytecode patterns to search for fields, classes and methods.
- 2
-
Some background info for some people that might like it:
Jagex changed some hooks regarding Character.getHealth() and Character.getMaximumHealth(). From now it's not possible anymore to get the precise amount of health a character has, you can only get the a health percentage instead.
I assume that Character.getHealth() and Character.getMaximumHealth() will be removed from the API. Some scripts might also be broken after this update so don't expect everything to work flawless when the bot goes live again.
- 5
-
Too bad that veteran rank isn't permanent
- 3
-
The completion of quests are also registered as configs. If you only need the completion status of a few quests you can try to use configs instead.
So for example for sheep shearer the config ID is 179. If the value is 1 it has started and if the value is 21 it's completed.
Ideally Osbot should also use configs instead of their current system, but I can imagine that it can be tricky to get all the configs right. I have gathered a big list myself with most the configs for every quests, but cbf to share it here.
-
-
Using lambda would make your first method a lot cleaner.
For the second method you could change the boolean from the statement to Callable<Boolean>. The thing you are doing wrong is that currently the statement will never change. The value is assigned when the method is called and will never change.
Anyway more info here: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Callable.html
downloading the client
in General Help
Posted
You can run it though the command line:
java -jar "Path to .jar file"