Jump to content

Valkyr

Members
  • Posts

    1433
  • Joined

  • Last visited

  • Days Won

    3
  • Feedback

    0%

Posts posted by Valkyr

  1. 1. OSBot Version (do NOT put "current version", be specific)


    2.4.43


     


    2. A description of the issue. Include relevant logs.


    When loading the GUI (which works locally) it seems to be unable to locate event handler methods. I figured it would be the obfuscator not affecting FXML files, idk how it works.


     


    3. Are you receiving any errors in the client canvas or the logger? 



    Apr 03, 2016 12:53:57 PM javafx.fxml.FXMLLoader$ValueElement processValue
    WARNING: Loading FXML document with JavaFX API of version 8.0.65 by JavaFX runtime of version 8.0.60
    javafx.fxml.LoadException: Error resolving onAction='#goBack', either the event handler is not in the Namespace or there is an error in the script.
    /D:/Programming/Java/OSBot/out/production/OSBot/resources/ui/fxml/taskscheduler.fxml:44
     

    4. How can you replicate the issue?


    Attempt to start Alpha Chopper/Fighter through the SDN


     


    5. Has this issue persisted through multiple versions? If so, how far back?


    Unknown

  2. 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.

    • Like 2
  3. 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;
        }
    }
    
    • Like 3
  4. a lot of extroverts are extroverts because they're too insecure to be alone

     

     

    it's hard to diminish between an insecure extrovert who feels they HAVE to be with people and a confident introvert who can handle being on their own but can also be the life of a party

    and for that reason i think it's a load of rubbish, insecure people will say extrovert and content people will say introvert 

    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.

  5. If you live in America sure.

     

     

     

    Yeah I'm like this as well, but sometimes it gets too much and I go AWOL on my friends and family and gotta text/call/email me to make sure I'm still alive. 

    same

    Introvert - charging energy alone because you had a social day

    Extrovert: charging energy by being with other people

    Eh I'm both I guess, after being around my friends for a long time, I prefer some time alone but when I'm alone on a sunday and kinda bored I love to go out and get energy from all my friends.

    Does it make sense?

    I'm a really outgoing person, but at the end of the day I prefer some time alone

    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...