Everything posted by Botre
- What happened to Laz
-
@Botre This Ones for you homie
- ExperienceTable Class / snippet
Fixed lel, that looked gross.- @Botre This Ones for you homie
- Some array utilities for your convenience
The concatenate method is mine. The reverse method not, who seriously credits stackoverflow code though ? Oo- An improved section for scripting.
Could the scripting section get its own section instead of having to share one with programming? Its subsections aren't easy to find. As it is, the graphics section is more clear and easy to navigate. Propositions: Split scripting and programming into two separate sections. Give the new scripting section the following subsections: Scripting Tutorials Snippets Projects Help desk The way it's currently structured is really uninviting and impractical imo. Cheers. Credits to my #RaketBro @Czar for bringing it up, most of this was his idea.- Array shuffling
They all do the same, not going to copy and paste the explanation 10 times every time I feel like changing / completing / detailing the description- State-Node Framework
Ok so the class implementing Activity isn't supposed to perform any looping right?- Scripting help
Explain HOW it doesn't work. Try getNpcs().closest()- Array shuffling
LAST UPDATE: MARCH 10, 2015 You could use Collections by converting the array to a List but that would be more expensive and wouldn't work for primitives. The ArrayUtilities.swapEntriesByIndex(...) method can be found here: http://osbot.org/forum/topic/65570-some-array-utilities-for-your-convenience/ package org.bjornkrols.algorithms.sequence_permutation; import java.util.Random; import org.bjornkrols.utilities.array.ArrayUtilities; /** * Generates a random permutation of a finite set in an unbiased manner. * * These methods can be used both procedurally (by not using the return value) * and as a factory (by calling it on a copy of an existing array for example). * * @param set The set to be shuffled. * @return The shuffled set. * @author Bjorn Krols (Botre) * @version 0.2 * @since March 5, 2015 */ public final class KnuthShuffle { private static final Random RANDOM = new Random(); private KnuthShuffle() { // This class should never be instantiated. // Do not delete or make accessible. } /** * @see KnuthShuffle */ public static boolean[] shuffle(boolean[] set) { int length = set.length; // For each index i of the array, starting at 1 (because i = 0 would systematically return j = 0). for (int i = 1; i < length; i++) { // Find j, a random index between 0 (inclusive) and i (inclusive). int j = RANDOM.nextInt(i + 1); // Swap the entries at indexes i and j. ArrayUtilities.swapEntriesByIndex(set, i, j); } return set; } /** * @see KnuthShuffle */ public static byte[] shuffle(byte[] set) { int length = set.length; for (int i = 1; i < length; i++) ArrayUtilities.swapEntriesByIndex(set, i, RANDOM.nextInt(i + 1)); return set; } /** * @see KnuthShuffle */ public static short[] shuffle(short[] set) { int length = set.length; for (int i = 1; i < length; i++) ArrayUtilities.swapEntriesByIndex(set, i, RANDOM.nextInt(i + 1)); return set; } /** * @see KnuthShuffle */ public static char[] shuffle(char[] set) { int length = set.length; for (int i = 1; i < length; i++) ArrayUtilities.swapEntriesByIndex(set, i, RANDOM.nextInt(i + 1)); return set; } /** * @see KnuthShuffle */ public static int[] shuffle(int[] set) { int length = set.length; for (int i = 1; i < length; i++) ArrayUtilities.swapEntriesByIndex(set, i, RANDOM.nextInt(i + 1)); return set; } /** * @see KnuthShuffle */ public static long[] shuffle(long[] set) { int length = set.length; for (int i = 1; i < length; i++) ArrayUtilities.swapEntriesByIndex(set, i, RANDOM.nextInt(i + 1)); return set; } /** * @see KnuthShuffle */ public static float[] shuffle(float[] set) { int length = set.length; for (int i = 1; i < length; i++) ArrayUtilities.swapEntriesByIndex(set, i, RANDOM.nextInt(i + 1)); return set; } /** * @see KnuthShuffle */ public static double[] shuffle(double[] set) { int length = set.length; for (int i = 1; i < length; i++) ArrayUtilities.swapEntriesByIndex(set, i, RANDOM.nextInt(i + 1)); return set; } /** * @see KnuthShuffle */ public static Object[] shuffle(Object[] set) { int length = set.length; for (int i = 1; i < length; i++) ArrayUtilities.swapEntriesByIndex(set, i, RANDOM.nextInt(i + 1)); return set; } }- lol they fucked up already
- lol they fucked up already
- State-Node Framework
Would you mind sharing a small implementation of this? For example; what kind of class would/could implement the Activity interface?- Woodcutting / firemaking data enums
LAST UPDATE: MARCH 6, 2015 Yes Logs is plural, there's no such thing as "a log" in osrs. package org.bjornkrols.woodcutting; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; /** * @author Bjorn Krols (Botre) * @version 0.0 * @since March 6, 2015 */ public enum Tree { TREE(1, 25f, Logs.LOGS), DYING_TREE(1, 25f, Logs.LOGS), DEAD_TREE(1, 25f, Logs.LOGS), EVERGREEN(1, 25f, Logs.LOGS), JUNGLE_TREE(1, 25f, Logs.LOGS), ACHEY_TREE(1, 25f, Logs.ACHEY_TREE_LOGS), OAK(15, 37.5f, Logs.OAK_LOGS), WILLOW(30, 67.5f, Logs.WILLOW_LOGS), TEAK(35, 85f, Logs.TEAK_LOGS), MAPLE(45, 100f, Logs.MAPLE_LOGS), HOLLOW_TREE(45, 82.5f, Logs.BARK), MAHOGANY(50, 125f, Logs.MAHOGANY_LOGS), ARCTIC_PINE(54, 140f, Logs.ARCTIC_PINE_LOGS), YEW(60, 175f, Logs.YEW_LOGS), MAGIC(75, 250f, Logs.MAGIC_LOGS); private final int chopLevel; private final float chopExperience; private final Logs logs; private Tree(final int chopLevel, final float chopExperience, final Logs logs) { this.chopLevel = chopLevel; this.chopExperience = chopExperience; this.logs = logs; } public int getChopLevel() { return chopLevel; } public boolean canChop(Script script) { return chopLevel <= script.getSkills().getDynamic(Skill.WOODCUTTING); } public float getChopExperience() { return chopExperience; } public Logs getLogs() { return logs; } @Override public String toString() { String string = super.toString().replaceAll("\\s+","").toLowerCase(); return Character.toUpperCase(string.charAt(0)) + string.substring(1); } } package org.bjornkrols.woodcutting; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.script.Script; /** * @author Bjorn Krols (Botre) * @version 0.1 * @since March 6, 2015 */ public enum Logs { LOGS(1, 40f), ACHEY_TREE_LOGS(1, 40f), OAK_LOGS(15, 60f), WILLOW_LOGS(30, 90f), TEAK_LOGS(35, 105f), ARCTIC_PINE_LOGS(42, 125f), MAPLE_LOGS(45, 135f), BARK(999, 0f), // Can't be burned. MAHOGANY_LOGS(50, 157.5f), YEW_LOGS(60, 202.5f), MAGIC_LOGS(75, 303.8f); private final int burnLevel; private final float burnExperience; private Logs(final int burnLevel, final float burnExperience) { this.burnLevel = burnLevel; this.burnExperience = burnExperience; } public int getBurnLevel() { return burnLevel; } public boolean canBurn(Script script) { return burnLevel <= script.getSkills().getDynamic(Skill.FIREMAKING); } public float getBurnExperience() { return burnExperience; } @Override public String toString() { String string = super.toString().replaceAll("\\s+","").toLowerCase(); return Character.toUpperCase(string.charAt(0)) + string.substring(1); } }- lol they fucked up already
They were probably a huge pain to test so :p- A template / demonstration for using the "equals" method in Java.
Updated- ExperienceTable Class / snippet
- Some array utilities for your convenience
Updated- Basic Timer classes
Passing a method as a parameter is tedious imho. I could make fetchCurrentTime() non abstract and have it take a long argument for current time and an int for converting to other time units but the current implementation is more efficient (I could also get rid of fetchCurrentTime() and make the getElaspsed...() methods take those parameters but again, no need for that). Perhaps I misunderstood, if I did feel free to post some pseudocode :p- Basic Timer classes
Because it doesn't have a way to the fetch the current time or a valid mtups value to convert between time units and therefore shouldn't be instantiated, only extended.- Basic Timer classes
LAST UPDATE: MARCH 6, 2015 package org.bjornkrols.timing; /** * A base for basic timer subclasses. * * @author Bjorn Krols (Botre) * @version 0.1 * @since March 6, 2015 */ public abstract class BasicAbstractTimer { protected long st; protected int mtups; protected BasicAbstractTimer() { start(); } public void start() { st = fetchCurrentTime(); } public void restart() { start(); } protected abstract long fetchCurrentTime(); public double getElapsedDays(){ return getElapsedSeconds() / 86400; } public double getElapsedHours(){ return getElapsedSeconds() / 86400; } public double getElapsedSeconds() { return (fetchCurrentTime() - st) / mtups; } public double getElapsedMilliSeconds() { return getElapsedSeconds() / 1000; } public double getElapsedNanoSeconds() { return getElapsedSeconds() / 1000000000; } public int[] distribute() { int seconds = (int) getElapsedSeconds(); int d[] = new int[4]; d[0] = (seconds / 86400); // Days. d[1] = ((seconds % 86400) / 3600); // Hours. d[2] = (((seconds % 86400) % 3600) / 60); // Minutes. d[3] = (((seconds % 86400) % 3600) % 60); // Seconds. return d; } @Override public String toString() { StringBuilder sb = new StringBuilder(); int[] d = distribute(); for (int i = 0; i < d.length; i++) { sb.append(String.format("%02d", d[(int) i])); if (i != d.length - 1) sb.append(":"); } return sb.toString(); } } package org.bjornkrols.timing; /** * A millisecond precision timer. * * @author Bjorn Krols (Botre) * @version 0.0 * @since March 6, 2015 */ public final class BasicMilliTimer extends BasicAbstractTimer { public BasicMilliTimer() { super(); mtups = 1000; } @Override protected long fetchCurrentTime() { return System.currentTimeMillis(); } @Override public double getElapsedMilliSeconds() { return st - fetchCurrentTime(); } } package org.bjornkrols.timing; /** * A nanosecond precision timer. * * @author Bjorn Krols (Botre) * @version 0.0 * @since March 6, 2015 */ public final class BasicNanoTimer extends BasicAbstractTimer { public BasicNanoTimer() { super(); mtups = 1000000000; } @Override protected long fetchCurrentTime() { return System.nanoTime(); } @Override public double getElapsedNanoSeconds() { return st - fetchCurrentTime(); } }- Count To 10,000!
1028 Lesson 44: don't mess up forum games, they are sacred.- how to spam?
Lesson 34: "The postcount comment". Omg Mysteryy you almost have 1337 postcount, how amazing I'm so glad for you! Leson 35: "The Mysteryy"- how to spam?
Lesson 19: "For no reason whatsoever, try quoting someone quoting you (and be appreciative for the postcount opportunity)". Lesson 7: "The doge". Lesson 8: "The mald". Lesson 23: "Make up a bunch of lessons about spamming".- how to spam?
Lesson 17: "Quoting a correct answer unnecessarily, instead of liking it." - ExperienceTable Class / snippet
Account
Navigation
Search
Configure browser push notifications
Chrome (Android)
- Tap the lock icon next to the address bar.
- Tap Permissions → Notifications.
- Adjust your preference.
Chrome (Desktop)
- Click the padlock icon in the address bar.
- Select Site settings.
- Find Notifications and adjust your preference.
Safari (iOS 16.4+)
- Ensure the site is installed via Add to Home Screen.
- Open Settings App → Notifications.
- Find your app name and adjust your preference.
Safari (macOS)
- Go to Safari → Preferences.
- Click the Websites tab.
- Select Notifications in the sidebar.
- Find this website and adjust your preference.
Edge (Android)
- Tap the lock icon next to the address bar.
- Tap Permissions.
- Find Notifications and adjust your preference.
Edge (Desktop)
- Click the padlock icon in the address bar.
- Click Permissions for this site.
- Find Notifications and adjust your preference.
Firefox (Android)
- Go to Settings → Site permissions.
- Tap Notifications.
- Find this site in the list and adjust your preference.
Firefox (Desktop)
- Open Firefox Settings.
- Search for Notifications.
- Find this site in the list and adjust your preference.