Jump to content

Valkyr

Members
  • Posts

    1433
  • Joined

  • Last visited

  • Days Won

    3
  • Feedback

    0%

Everything posted by Valkyr

  1. Could you not at least partially solve this using gaussians?
  2. Wow Alek. Just wow. Sad to see you going but all the best! ?
  3. Searchable combo box http://stackoverflow.com/questions/16418925/using-jcombobox-as-a-search
  4. Congratulations Mald! Will there be a fanfare to celebrate the coming of OSBot's heir?
  5. Bc someone followed it and were having issues
  6. Why declare a JFrame within the script class? Separate it. public class GUI extends JFrame { public GUI() { setTitle("GUI); ... pack(); setVisible(true); } } Instantiate within the script class public class ShitScript extends Script { private GUI gui; ... @Override public void onStart() { gui = new GUI(); } @Override public void onExit() { if(gui != null) gui.dispose(); } ... } This way, you can manage your GUI without having to trawl through a ton of unrelated code in the script class.
  7. That's what I was getting at with the P.S
  8. It wasn't paid for via the website, which means he would have authed it to you. Recently due to shenanigans, all of his auths were removed. P.S I recommend purchasing a voucher with RSGP next time.
  9. Tomorrowland is now sold out for anyone still considering
  10. I'll be there anyway if I can afford it
  11. Make sure you don't have any older versions of Java installed, they sometimes override the newer version. Try re-downloading the OSBot jar.
  12. 2.4.39-40 It does that after opening a bot tab (mirror)
  13. Assuming they're missing hooks since it's accessing the client class.
  14. Valkyr

    Query API

    Wrote this a while back, basically a replacement for EntityAPI IQuery.java import com.zenscripting.api.script.engine.Context; import java.util.Comparator; import java.util.List; import java.util.function.Predicate; /** * Created by Valkyr on 17/12/2015. */ /** * Query * * @param <T> Type of query * @param <R> Result table type * @param <Q> Query type */ public interface IQuery<T, R extends IQueryResult<T>> { /** * Returns the API context * * @return context */ Context getContext(); /** * Returns the list of T to be queried. * * @return List of T */ List<T> load(); /** * Returns the results from filtering items using the * provided predicate. * * @param predicate a predicate to filter the query * @return this query */ IQuery<T, R> filter(Predicate<T> predicate); /** * Sorts results according to the comparator * * @return this query */ IQuery<T, R> sort(Comparator<T> comparator); /** * Removes non-matching items * * @param subType * @return this query, modified for subclass */ <ST extends T> Query<ST, QueryResult<ST>> bySubClass(Class<ST> subType); /** * Returns the results of the query * * @return result */ R result(); } IQueryBuilder.java import org.osbot.rs07.script.Script; /** * Created by Valkyr on 17/12/2015. */ /** * Query Builder * Builds a query using given parameters * * @param <T> Object to use * @param <R> QueryResult type to use */ public interface IQueryBuilder<T, R extends IQueryResult<T>, Q extends IQuery<T, R>> { /** * Returns the API context * * @return context */ Script getScript(); /** * Returns a new Query of type T * * @return new query */ Q newQuery(); } IQueryResult.java import java.util.Comparator; import java.util.List; /** * Created by Valkyr on 17/12/2015. */ /** * Query Result * * @param <T> Type of query */ public interface IQueryResult<T> { /** * Returns the first item in the results table * * @return first found item */ T first(); /** * Returns the last item in the results table * * @return last found item */ T last(); /** * Returns the item at the provided index * * @param index * @return found item at index */ T get(int index); /** * Returns all items in the results table * * @return last found item */ List<T> all(); /** * Determines whether or not the results table is empty. * * @return results table is empty */ boolean isEmpty(); } Query.java import org.osbot.rs07.script.Script; import java.util.Comparator; import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; /** * Created by Valkyr on 17/12/2015. */ public abstract class Query<T, R extends QueryResult<T>> implements IQuery<T, R> { private final Script script; private List<T> raw; public Query(Script script) { this.script = script; raw = load(); } public final Script getScript() { return script; } @Override public final Query<T, R> filter(Predicate<T> predicate) { if (raw != null && raw.size() > 0) { raw.removeAll(raw.stream().filter(t -> !predicate.test(t)).collect(Collectors.toList())); } return getThis(); } @Override public final Query<T, R> sort(Comparator<T> comparator) { raw = raw.stream().sorted(comparator).collect(Collectors.toList()); return getThis(); } @Override public final <ST extends T> Query<ST, QueryResult<ST>> bySubClass(Class<ST> subType) { if (raw != null && raw.size() > 0) { filter(t -> t != null && subType.isAssignableFrom(t.getClass())); } return (Query<ST, QueryResult<ST>>) getThis(); } protected final List<T> getRaw() { return raw; } protected final <SQ extends Query<T, R>> SQ getThis() { return (SQ) this; } public abstract R result(); } QueryBuilder.java import org.osbot.rs07.script.Script; /** * Created by Valkyr on 17/12/2015. */ public abstract class QueryBuilder<T, R extends IQueryResult<T>, Q extends IQuery<T, R>> implements IQueryBuilder<T, R, Q> { private final Script script; public QueryBuilder(Script context) { this.script = context; } public final Script getScript() { return script; } } QueryResult.java import java.util.List; /** * Created by Valkyr on 17/12/2015. */ public abstract class QueryResult<T> implements IQueryResult<T> { private final List<T> results; public QueryResult(List<T> results) { this.results = results; } @Override public T first() { if (!isEmpty()) return results.get(0); return null; } @Override public T last() { if (!isEmpty()) return results.get(results.size()); return null; } @Override public T get(int index) { if (!isEmpty()) return results.get(index); return null; } @Override public List<T> all() { if (!isEmpty()) return results; return null; } @Override public boolean isEmpty() { return results.size() < 1; } }
  15. http://www.wikihow.com/Tie-a-Noose
  16. Isn't the Myers-Briggs Type Indicator used to distinguish between those? The critique is that the differentiation between introversion and extraversion is down to a preference as opposed to an absolute i.e. an introvert may prefer to be isolated as opposed to spending their life in isolation, which would be torture.
  17. Same here as well, to a lesser extent. I love going out but can only bear it for a few hours before I wanna be elsewhere. Definitely introvert.
×
×
  • Create New...