Everything posted by Explv
-
Can't download osbot
Try this: http://osbot.org/forum/topic/87717-fixing-osbot-not-starting/
- Need DP & SIGGY
-
walk() vs random path walking
It should be fairly random as it is?
-
walk() vs random path walking
Area area = new Area(0, 0, 1, 1); getLocalWalker().walk(area.getRandomPosition());
-
get all bank booths
noob?? Learn to Java 8 m8 It is safe to ignore this warning. It is an unchecked generics array creation warning produced by getObjects().filter(). You can just supress it. @SuppressWarnings("unchecked") List<RS2Object> banks = getObjects().filter(obj -> obj.getName().equals("Bank booth")); If you don't want a warning you can always do: List<RS2Object> banks = getObjects().getAll().stream().filter(obj -> obj.getName().equals("Bank booth")).collect(Collectors.toList()); But the first way is perfectly fine and shorter. No it is not anything to worry about.
-
Auto login
If the user has saved their username and password in the OSBot settings, it will automatically log in for them. There is no need to create a login script.
- get all bank booths
-
get all bank booths
It just means: -Get all objects and filter them so that the list only contains objects with the name "Bank booth" -If the list is null, or there are no elements in the list, return null Otherwise return a random value from the list.
-
get all bank booths
This is a bit shorter: public RS2Object getRandomBank() { List<RS2Object> banks = getObjects().filter(obj -> obj.getName().equals("Bank booth")); return (banks == null || banks.size() == 0) ? null : banks.get(random(banks.size()-1)); }
-
Explv's Tutorial Island [Free] [Random Characters]
That's what it's supposed to do
-
Explv's Tutorial Island [Free] [Random Characters]
:xdoge:
- client freezing
-
Iron Powerminer
Awesome job on your first script! Not issues or anything like that, just possible ways you could improve your code 1) That ft method hurts my fucking eyes This is a bit cleaner: public String formatTime(long ms){ long s = ms / 1000, m = s / 60, h = m / 60, d = h / 24; s %= 60; m %= 60; h %= 24; return d > 0 ? String.format("%02d:%02d:%02d:%02d", d, h, m, s) : String.format("%02d:%02d:%02d", h, m, s); } 2) You don't need to store timeRan in a global variable because it has no use anywhere else in the code, other than where it is calculated. 3) For the state you don't need to store a String value in a variable for output. You can simply override the toString() method in the enum, for example: private enum State { MINE, DROP, SLEEP; @Override public String toString(){ char[] nameArr = name().toLowerCase().toCharArray(); nameArr[0] = Character.toUpperCase(nameArr[0]); return new String(nameArr); } } Then it can be used like: g.drawString("STATE: " + getState().toString(), 15, 80); // this prints out state 4) You have done: getExperienceTracker().startAll(); Considering you are only using one skill (Mining), you should call: getExperienceTracker().start(Skill.MINING);
-
client freezing
No problem For more information on the different operators in Java you can take a look at this Java tutorial: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html
-
client freezing
Yes, it is a logical OR || so the second condition in the OR is not checked if the first evaluates to true. If you were to use a bitwise OR | then both sides of the condition would be checked and a null pointer exception thrown.
-
client freezing
Because when the widget is not on screen, when you do getWidegets().get() it will return null. So always make sure you null check
-
client freezing
Perhaps you should take a look at the debugging console. You can find it under settings -> show logger. You can then determine your error from the output. Probably a NPE. Your logic and code structure could also use some improvement if(!myPlayer().isAnimating() && !myPlayer().isMoving()){ RS2Widget spinMenu = getWidgets().get(); // Whatever you do to get the spin menu if(spinMenu == null || !spinMenu.isVisible()){ wheel.interact("Spin"); sleep(random(700, 3000)); } else { spinMenu.interact("Make X"); } }
-
Worth Starting?
If you have a lot of programming experience in C# you will not find the move to Java difficult at all. They are similar languages. There are still gaps in the selection of scripts that you can fill, and shitty scripts that can be improved. The API does not take a huge time commitment to understand, and there are tutorials out there to help you. It's really up to you if it is worth it
-
How to track how much i picked up of one specific item?
See the first part of the solution i posted, and substitute "Feather" for "Bones" .
-
How to track how much i picked up of one specific item?
private long feathersCollected; private long prevInvCount; @Override public void onStart(){ // initialise previous inventory count to current inventory count prevInvCount = getInventory().getAmount("Feather"); } @Override public int onLoop(){ long invCount = getInventory().getAmount("Feather"); // get number of feathers in inventory // If the amount of feathers has increased, add the change to total feathers collected if(invCount > prevInvCount) feathersCollected += (invCount - prevInvCount); // Update previous inventory count to current count prevInvCount = invCount; ... } (This accounts for if you are banking, or if you are disposing of the items e.g. burying bones) If you aren't banking: private long startFeatherCount; @Override public void onStart(){ startFeatherCount = getInventory().getAmount("Feather"); } private long getFeathersCollected(){ return getInventory().getAmount("Feather") - startFeatherCount; } If you want to make it so that the updating of the count is not paused by the bot's actions, you can move the code in onLoop to the onPaint method. However you should ensure that you limit the amount of times it is called per second.
-
Banned
he seemed like a cool guy dickhead ftfy.
-
Item isn't in inv
You should take a look at using a state based system for your scripts. That code could potentially have some bugs in it. For example, what happens if the bank opening process gets interrupted? Your script will just walk back to the fishing spot without having retrieved a lobster pot.
-
Can't open only 2 doors?
RS2Object closestDoor = getObjects().closest(true, obj -> obj.getName().equals("Door") && obj.hasAction("Open")); if(closestDoor != null) closestDoor.interact("Open");
-
Can't download osbot
Try this: http://osbot.org/forum/topic/87717-fixing-osbot-not-starting/ http://osbot.org/forum/topic/87717-fixing-osbot-not-starting/ http://osbot.org/forum/topic/87717-fixing-osbot-not-starting/ http://osbot.org/forum/topic/87717-fixing-osbot-not-starting/
-
Script only banks
See updated post.