-
Posts
2314 -
Joined
-
Last visited
-
Days Won
6 -
Feedback
100%
Everything posted by Explv
-
No
-
getSettings(). https://osbot.org/api/org/osbot/rs07/api/Settings.html#setRunning-boolean- https://osbot.org/api/org/osbot/rs07/api/Settings.html#getRunEnergy--
-
o_god_pls_no.jpg all that code can be simplified to: public int onLoop() { if(getInventory().contains("Salmon")) { if(!fightArea.contains(myPlayer())) { // walk to fight area } else if(getCombat().isFighting()) { // do nada } else { // attack guard } } else if(!bankArea.contains(myPlayer())) { // walk to bank } else if(!getBank().isOpen()) { // open bank } else if(getBank().contains("Salmon")) { //bank } else { //logout } } States add nothing, REEEEEEEEEEEEEEE
-
I'm assuming that strPot is defined as a member variable. You can't do that, the API will not be setup yet. The order is as follows: Static variables are initialised Member variables are initialised Constructor is called API context is exchanged onStart() is called onLoop() is repeatedly called until script exit You are defining strPot as a member variable, if you look at the above list, you can see that it will be initialised before the API context is exchanged. This means that getInventory().getItem() will throw an NPE somewhere and your script will crash. It doesn't make sense to do it there anyway, as it will only get a strength potion from your inventory once. If you then consumed that strength potion, that Item would no longer exist and your script would fail. You need to call getInventory().getItem() every time you want to drink the potion. The code should be put inside of your if (inventory contains strength potion) check. Side note: You can make use of a Filter<Item> to reduce some code, for example: private final Filter<Item> strPotionFilter = item -> item.getName().startsWith("Strength potion("); public void someMethod() { Item strPotion = getInventory().getItem(strPotionFilter); if (strPotion != null) { strPotion.interact("Drink"); } }
-
I mean I'm pretty sure I've seen it in an update before, and I don't think I've seen widget IDs that haven't been in order. But let's just agree to disagree
-
Not really, for example lets say you had some screen with root widget 123 Inside were three buttons 123, 1 123, 2 123, 3 And lets say you hardcoded the widget for the third button: getWidgets().get(123, 3) If they then inserted another button between 2 and 3, your widget would now change to 123, 4, breaking your code (you hardcoded it to 3) The root widget 123 wouldn't change, just the child ones.
-
Widgets have 2 or 3 ids. e.g. 123, 1 or 123, 1, 2 The root id (123) is unlikely to change, but the second and third level ids may. So if you are going to use a fixed id at all, you should only use the root. For example: getWidgets().getWidgetContainingText(123, "Blah"); or getWidgets().singleFilter(123, new Filter...... You should avoid using: getWidgets().get(123, 1) and getWidgets().get(123, 1, 2)
-
I've stopped and started the script a dozen times and don't get any crashes. You really need to show me the log output & the scenario in which it crashed, otherwise there is no hope of me fixing it. If the client freezes but doesn't completely close, then open the logger before you start the script, so you can see the log output. If the client completely crashes, start the client from the command line with the -debug flag, the log output will stay in the command prompt even if it crashes: java -jar "osbot 2.4.152.jar" -debug
-
I believe it depends on the website and what it requests. Normally there is a popup telling you what information will be shared no? I think you can also check somewhere on your Google account to see what websites are linked, and what data is being shared.
-
Tricks to add external libraries GSON, JSON, Simple-JSON
Explv replied to moeotterson's topic in Scripting Help
@moeotterson It would be helpful if you posted your code and the json file, so we can see what's wrong. -
PMd /Thread
-
He doesn't want it
-
I got a BF1 incursions alpha key in my email. Not intending to use it, if anyone wants it post below. First come first served
-
Tricks to add external libraries GSON, JSON, Simple-JSON
Explv replied to moeotterson's topic in Scripting Help
time-place-dicksucking?????? o.o There are plenty of resources online of how to use the Json simple library. For example: https://www.mkyong.com/java/json-simple-example-read-and-write-json/ Just make sure your Json file is in the OSBot data directory, and you make use of the OSBot getDirectoryData() method. For example: String jsonFile = Paths.get(getDirectoryData(), "yourJsonFile.json").toString(); (Syntax may be wrong, I'm on my phone) -
@Jammer it would be helpful if you showed more code, to understand when getLocation() is being called, how you are setting up your GUI and closing your GUI etc. Also side note: I think it would make more sense for you to use a JComboBox<Location> instead of a JRadioButton. By using a JComboBox you wouldn't need the getLocation() method, you would just call comboBox.getSelectedItem().
-
Don't think LocalPathFinder accounts for Doors? Think it only generates paths to reachable positions. Might be wrong though
-
Breadth first search would probably be better, I don't think you really need to use weighted edges in this instance.
-
Well it would change something. lever would then be null, seeing as the player cannot reach it??? I'm not sure you understand the original question. He wants to know how to navigate Draynor Manor Basement without web walking (as web walking does not support it)
-
https://www.google.com/search?q=shortest+path+algorithm+java https://www.google.com/search?q=shortest+path+algorithm+java https://www.google.com/search?q=shortest+path+algorithm+java Create a "graph" connecting rooms to each each other. Each node on the graph is a room, each link is an obstacle e.g. a Gate When you want to walk from room A to room B, find the shortest path in your graph from room A to room B, then traverse the path. Considering this looks like a one-off maze puzzle thing, i'm sure you could get by with a hackier solution, but it would likely not be as robust or elegant. I wrote some code for Arceuus house library that makes use of a graph & shortest path algorithm. I can probably share it with you once I am at home if you are still stuck.
-
I don't see any obvious issues with your code. If DoorHandler doesn't work, you will need to write your own solution
-
It depends on how complex and large the dungeon is. If it's tiny, and only consisted of gates / doors like in your example, using DoorHandler would probably suffice like Alek suggested. If the dungeon is super complex, consisting of multiple levels, different types of obstacles, etc. then you would probably be wanting to write your own path finding and traversing code. You could use a pre-existing path finding algorithm such as A*.
-
The sub-quests you will have to get the configs for yourself.
-
Yes, you can use configs or the quest API. /thread