-
Posts
146 -
Joined
-
Last visited
-
Feedback
0%
Posts posted by Boots
-
-
Nice, I wasn't going for a full zybez retriever, but yours looks good too.
Haha, I got bored. It relys on the Gson API and I don't know if that's provided by osbot.
Here's a nifty little utility I was able to make with it with little effort.
should extract the picture and maybe an auto fill feature would make it nice
-
Nice, I wasn't going for a full zybez retriever, but yours looks good too.
-
if(script.client.getMyPlayer()!=null && !script.isRunning() )
script.setRunning(true);
-
1
-
-
Retrieves prices from zybez grand exchange. Use the following format to retrieve prices, the price can be inputted with or without the "+" in bewteen each word
PriceGrab priceGrab = PriceGrab.getInstance(); priceGrab.getPrice("snape grass",3);
where the string parameter takes in the actual item name, and the integer parameter will determine if you want high value, low value, or average value. High = 3 , Average = 2, low = 1.
import java.io.*; import java.net.*; public class PriceGrab { private static PriceGrab oneInstance; private URL zybez; private URLConnection urlConnection; private BufferedReader inputScan; private final String zybezUrl = "http://forums.zybez.net/runescape-2007-prices/api/item/"; public static PriceGrab getInstance(){ if(oneInstance == null){ oneInstance = new PriceGrab(); } return oneInstance; } public int getPrice(String itemName, int command){ final String AVERAGE = "average",LOW= "recent_high", HIGH="recent_low"; String item = format(itemName),extracted; int price = 0; openStream(item); extracted = retrieveData(item); switch (command){ case 1: return parseInfo(extracted,LOW); case 2: return parseInfo(extracted,AVERAGE); case 3: return parseInfo(extracted,HIGH); } return price; } private String format(final String string){ if(string.contains(" ")) return string.replaceAll(" ", "+"); else return string; } private void openStream(final String param){ String appended = zybezUrl.concat(param); try { zybez = new URL(appended); urlConnection = zybez.openConnection(); urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11"); } catch (MalformedURLException e) { System.out.println("Web address formatted incorrectly, printing stack trace"); e.printStackTrace(); } catch(IOException exception) { System.out.println("Url connection has thrown an IOException, printing stack trace"); exception.printStackTrace(); } } private String retrieveData(final String param){ String output = null; try { openStream(param); inputScan = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); output = inputScan.readLine(); } catch (IOException e) { e.printStackTrace(); } finally { try {inputScan.close();} catch (IOException e){e.printStackTrace();} } return output; } private int parseInfo(String extracted,String value){ int start, end, price = 0; if(extracted.contains(value)){ start = extracted.indexOf(value); end = extracted.indexOf(",",start); price = Integer.parseInt(extracted.substring(start, end).replaceFirst(".*?(\\d+).*", "$1")); } else System.out.println("Could not retrieve price"); return price; } }
-
enums are all caps by default
-
1
-
-
Talk to @jason, he works at oracle + is good with web development.
You need a bachelors in a computer related field to work at oracle, I doubt he entered university at age 12 and finished at 16
-
The thing is it only happens when im running more than one tab, otherwise if i stop the a script with only one tab open it will be normal. Java is up to date and cpu is around 58 percent when running my bots
-
when i stop a script in low cpu mode the whole client freezes i have to start the task manager to close the client
-
I watched a guide on how to make this, and I'm going to try and improve on it periodically to improve my java skills.
Day 1
It successfully does your math!
Are you using infix to postfix conversion with the use of stacks?Otherwise doing the math will become a clusterfuck when youre not doing single operator conversions. You also need to push the postfix conversion into a binary tree the choose a traversal method, otherwise it will be a lot of hardcoding.
Heres an examples of what they made us create in university
after the postfix conversion is done everything is pushed into a binary tree in nodes then a bst search is applied and the correct mathematical rules are followed
-
They make us use textpad in university, but outside of that I always use intellij
-
Some people shouldnt get a refund, like the ones that want a refund 3 weeks into owning the script, but refunds should be given for the first few days of the purchase.
-
I think you would be much better off using this (quick writeup)
public void newSleep(int min, int max) { int x = 0; do { x = gRandom(min,max,(double)(max-min)/2); } while (x < min || x > max); sleep(x); }
This way you can refine it in certain areas of your code, instead of it being generally around one area.That's not as randomized as the method I posted, nor is it as simplified.
I'd have to disagree. I did a little bit of statistical analysis on your method:
Case one yields an average range of 750 to 2000 if not using a dynamic base.
Case one yields an average range of 250 to 1500 if using a dynamic base.
Case two yields an average range of 750 to 1675 if not using a dynamic base.
Case two yields an average range of 50 to 975 if using a dynamic base.
Case three yields an average range of 750 to 1675 if not using a dynamic base.
Case three yields an average range of 23 to 948 if using a dynamic base.
(all of these are bell curves with their peak at the mean)
If you logged every time the bot slept, you would have a graph that looks like 2 or 3 superimposed bell curves (or 5 if you randomly use the dynamic base).
To have something truly random, you have to use this method along with a way of changing the base to better suit your needs in a script. Such as an action that requires 1 tick compared to something that needs 5. If you slept the same way every time, it would look obvious by the randomness of it.
By default, humans are not random. There was a study done that asked a human to flick on and off a light switch in a random pattern. The study concluded that there was a non-random pattern that the person followed subconsciously. When humans do actions, they get tuned to what they are doing. It is very easy to keep the beat in a song, compared to trying to play something in random intervals. Its not how our brains work.
This is a very well written video explaining what I'm walking about http://www.youtube.com/watch?v=H2lJLXS3AYM
I'm very aware of the constant patterns in subconcious timing. When flipping a lightswitch you are aware that it flips on and off, two reasonable options, while only one is optional at a time. If you've gone up, your only option is to go down, meaning that your brain will naturally flip it at a constant rate. This isn't the same in RuneScape. There are many actions you can do, and they happen randomly. You don't attack an npc every 5.0 seconds, you may attack one at 1.2 seconds, attack another at 6.8 seconds, then another at 9.1 seconds. The randomized core of RuneScape's engine, the random hits, the random spawns. The set delays are the only ticks that would be remembered by your brain. Even so, the numbers are changeable for a reason. Everyone would have their own set "ticks" they'd be accustom to using, which is why you can change the sleeps, add more, or remove some.
Thanks for the nice discussion!
If you wanted to achieve that type of randomness you would have to do a dynamic sleep then add that. This is because the dynamic sleep only acts when the condition is false. So if you were to attack an Npc with your sleep it would try to click it at random intervals which might mean the npc is still not dead. With a dynamic sleep it would wait for the npc to die, then you can implement that type of sleep which would make it wait before the next attack
-
1
-
-
l2 use conventions
Happy?
So how would you use this.
Sleep(500+200,300);
If you want to do that just use the normal method..
why not use dynamic sleeps?
import timer.Timer; import org.osbot.script.Script; import org.osbot.script.rs2.model.Player; public class Singleton { private final Script script; private static Singleton oneInstance; private Singleton(Script script){ this.script = script; } public static Singleton getInstance(final Script script){ if(oneInstance == null){ oneInstance = new Singleton(script); } return oneInstance; } public boolean isIdle(){ Player p = script.client.getMyPlayer(); return !p.isAnimating() && p.getAnimation()==-1 && !p.isMoving() && !p.isUnderAttack(); } public void dynamicSleep(final boolean condition){ Timer timer = new Timer(800); try{ while(!isIdle() && condition && timer.isRunning()) script.sleep(10); } catch (InterruptedException e){e.printStackTrace();} } }
-
NPC#getInteractingCharacter
Player#getInteractingCharacter
Have Position implement Serializable.
That's it for now. I'll post more if I need more.
Thanks in advance.
serializable is for reading and writing to a file...
-
-
Just a quick simple one for first of all until i learn abit more, Maybe fishing or cooking??
sure
-
I was about to follow this tutorial, http://osbot.org/forum/topic/5490-osbot-updated-programming-tutorials/
Would anybody like to make a small project with me?
id be willing to, what did you have in mind
-
Hello,
I came up with an idea today that could help soms scripters. As some may know, several scripts may need to perform an action before logging out. (Example: combat scripts may need to walk to a safe location; or hunter scripts may need to pick up their traps, as otherwise those will be lost.)
I came up with the idea for an onBreak() method, handled similar to onStart() and onStop().
The idea is fairly simple: when the break timer reaches 0, the script will execute the onBreak() method (if it exists, if not stop and break immediently) after the script gets to finish the onBreak method, the client will then start taking a break. And the script can simply restart after the break is over.
Hope to see this implented, could be very useful, and I don't think it is very hard to make.
Sincerly, Alex
the tree node system basically does that, it will only activate the node when the conditions are met, which could be only execute it when you run out of materials etc
-
apparently it doesnt read multiple classes either, because i placed everything in one file and now it works
-
I have a packaged script and a non packaged script running on local and when i press play only the non packaged runs. Do you guys have the same problem
-
nvm i found out how to add them, thanks anyway
-
There is a whole tutorial on how to do this.. You might want to look around a bit more... They are found at the guide or help section.
im not looking on how to add scripts that were made by others. The only tutorial i found was adding other peoples jars, but im trying to add .java files to the local scripts
-
So im wanting to create my own scripts but whenever i throw them into the osbot folder they dont appear does anyone have any tuts?
Zybez price retriever
in Snippets
Posted
Its the singleton pattern used to avoid multiple object creations