Jump to content

Boots

Members
  • Posts

    146
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Recent Profile Visitors

841 profile views

Boots's Achievements

Steel Poster

Steel Poster (4/10)

17

Reputation

  1. Its the singleton pattern used to avoid multiple object creations
  2. 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
  3. Nice, I wasn't going for a full zybez retriever, but yours looks good too.
  4. if(script.client.getMyPlayer()!=null && !script.isRunning() ) script.setRunning(true);
  5. 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; } }
  6. enums are all caps by default
  7. 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
  8. 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
  9. They make us use textpad in university, but outside of that I always use intellij
  10. 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.
  11. 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
  12. Happy? 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();} } }
  13. id be willing to, what did you have in mind
  14. nvm i found out how to add them, thanks anyway
×
×
  • Create New...