Snippets
Look here for useful bits of code to use with scripts.
590 topics in this forum
-
How can I get the area of the inside of a runecrafting altar? I'm currently using explv's Map plugin on github , is there a way to access the inside of an alter using this plugin? or any other way to do it in general?
-
- 2 replies
- 1.1k views
-
-
Hi I am trying to figure out how to get the current RS2Object that the bot is interacting with. I am looking for something like; myPlayer().isInteracting(getObjects().closest(getObjects().getAll()); If someone knows a way to do this, feel free to comment
-
-
- 7 replies
- 2k views
-
-
Can I use multiple classes for a script? What I essentially want to do it do a task until a condition is met, and then perform a different task, within a different java class in the same script. is this possible? and if so, how do I switch to the next class within my code? Sorry about the question, i'm a java noob xD
-
-
- 8 replies
- 2.2k views
- 1 follower
-
-
Hi everyone, I'm very new to scripting and have been messing around by splicing together open source code. I want to enter a friend's house but once it has done this once, I want to enter using the House Advertisement object, ID:29091 and 'Visit-Last', or go back to entering the host name manually if this message appears "You haven't visited anyone this session." Anyone got any tips? public void enter_house() { RS2Object portal = (RS2Object)this.getObjects().closest(this.OUTSIDE_HOUSE, new String[]{"Portal"}); if (this.OUTSIDE_HOUSE.contains(this.myPlayer().getPosition(); portal.interact(new String[]{"Friend's house"}); (new Condit…
-
-
- 4 replies
- 2k views
-
-
I used to troll a bit with my twitter by tweeting out updates when my bots would gain certain levels or I would mule a certain amount. I felt like it was kind of a funny troll to put out there so I decided to let you guys do the same if you want, who knows, maybe someone can do it on a bigger scale than I did A bit of a background about this so you have some kind of understanding. I have set up a backend listener that will listen to the sockets coming in and the Twitter API is accessed through the backend only because OSBot blocks it for some reason. The host is the IP of a server that I have and this is the only thing that will be running on that ser…
-
- 2 replies
- 1.3k views
- 2 followers
-
-
Good use-cases are for stakers to check stats of other players, pkers, etc, Mostly PvP usages. USAGE: Highscores highscores = new Highscores("Zezima"); System.out.println(highscores.getSkillLevel(Skill.HERBLORE)); CODE: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.Arrays; import org.osbot.rs07.api.ui.Skill; import java.net.MalformedURLException; import java.util.ArrayList; public class Highscores { private final ArrayList<String> stats = new ArrayList<String>(); public Highscores(final String pla…
-
- 1 reply
- 1.4k views
-
-
I was having troubles for a little bit trying to get the closest bank, then stumbled upon Chris's post on how getting the closest bank works. So all credits go to him for this one. All I did was modified the coding a little bit to make it compatible with task usage. Code: import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.stream.Stream; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.script.MethodProvider; public enum WebBank { GRAND_EXCHANGE(new Area(new Position(3161, 3493, 0), new Position(3168, 3486, 0))), VARROCK_EAST(new Area(new Position(3250, 3423, 0), n…
-
-
- 24 replies
- 8.2k views
-
-
I am able to write scripts on my PC, so far I've only made relatively basic ones that work well for cutting down willows. My issue is that when I write a script on my laptop, OSBot never recognizes the exported JAR files. I thought it may have been a problem with OSBot\Scripts directory, but I tested it by taking a JAR script that I made on my PC and putting it into my laptop's OSBot\Scripts directory and it appears and works perfectly fine. I followed that up by moving the whole project from my PC to my laptop, figuring the other scripts I was writing had issues that made them unusable. When I export the script from Eclipse on my laptop, it does not appear when I try to …
-
- 0 replies
- 815 views
-
-
Simple snippet to display how to dynamically hide a player's username. Supports standard accounts, as well as Ironman accounts *Added to the post is a zip file with the snippets in place. HiddenUsernames.zip
-
- 2 replies
- 1.4k views
- 2 followers
-
-
Hi is there any scripter out there that can implement an auto mulling system into one of my script?
-
- 5 replies
- 2.5k views
-
-
Hiya folks, Didn't immediately see a way of implementing this (I'm fairly new to the API) so I went about implementing it myself. Here's a snippet that takes a Position to minimize the distance from, as well as a String carrying the name of the NPC using Java 8 Streams. It returns a list of all NPCs that occupy the position of the NPC you've searched for. Additionally I've included an offset, so for the sake of loops (if the closest NPC isn't suitable, say it is already in combat) then you can add 1 and it will bring back the next closest position. I would imagine it is quite easy to adjust the returned object type, such as for other Entities. This is being used…
-
-
- 7 replies
- 2.8k views
-
-
https://pastebin.com/B7GexCCy Offers: - Thread Safe (same object can be used by multiple threads) - Throws lock exception if two or more distinct objects pointing to the same file try to acquire a lock (locks acquired by performing read/write) (One minor thing: Assumes EOF contains new line - you can put some hack to fix it but I didn't bother) Notes (from java lib): This file-locking API is intended to map directly to the native locking facility of the underlying operating system. Thus the locks held on a file should be visible to all programs that have access to the file, regardless of the language in which those progra…
-
- 1 reply
- 1.2k views
-
Recently Browsing 0
- No registered users viewing this page.