Jump to content

datpigeon

Members
  • Posts

    38
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by datpigeon

  1. 5 hours ago, Patrick said:

    1) What do you mean exactly?

    Having people click through an aimbooster.com like application to create a "MouseMoveProfile" that tries to mimic the movement patterns of the user's input data

  2. I have 3 questions and I'm sorry if someone's already asked it but there are too many people spamming these release posts,

    1) Is there going to be a way to convert mouse movement biometrics into MouseMoveProfiles?  (I doubt you guys have the time and/or motivation to do so)

    2) Is there going to be a way to import custom flow profiles or is it going to be limited to the profiles provided in the predefined FlowVariety enums? (there might be a way already but I haven't found it)

    3) Is there a way to see the api for the dev versions of osbot?


    I don't know if you have stated where the mouse movement API came from but I am 100% sure it is some modified version of the NaturalMouseMotion by JoonasVali. I have been working on my own implementation of this API in my own osbot scripts from scratch and I know you used JoonasVali's API because of the nature of the different variable movement properties but also more importantly a preview of the mouse movement in action (from this video) made me immediately recognize the overshoot behavior. This is should be a big issue because through my own personal testing, I have not yet found an authentic way to make overshoots look legitimate imo and I believe it could be easily recognizable without modifications.

  3. On 5/22/2020 at 11:10 PM, Simoner26 said:

    Hi, thanks you so much for that. Haven't tried yet, I have to exchange context in the main script class or do I have to do it here?

    sorry for the late response, but yeah you do have to exchange context in the main script (obviously in onStart() is the best place to do it)

  4. A lot of infrequently used functions aren't really as well defined in the api documentation as they could be, you'll probably just have to test it out yourself or see if someone has found it before.  Another option that I like doing is using google and in your case I would search "osbot onResponseCode" and there will likely be some links to forum topics here that have some information about it.

    • Like 1
  5. 23 minutes ago, BravoTaco said:

    To my knowledge, you won't be able to override the default mouse movement/interactions within the API so you will have to create custom methods and call those. You wont have to create that many methods as the objects you interact with always have an X, Y position, knowing this you could create a moveMouse(int X, int Y) method that would work for all interactable objects. Than after using your own mouse movement logic to move closely to the object you could than finish off the method with an interaction() call to the API. This may even provide more randomness to the mouse logic since the API will than have a chance to also use its own movement logic to interact with the object.

    ok well I may end up trying that out, i did something similar to that a long time ago but rather than moving the mouse close with some other mouse movement API i just instantly moved the mouse to the x,y position and then used the standard methods to interact with the object and that worked really well for the critical task it needed to do

  6. 20 hours ago, BravoTaco said:

    Best way would be to write your own algorithm. You could take a look at this its written in Pascal so you won't be able to just plop into java, but the algorithm is there for you to take a look at than write your own based on that knowledge. It has pretty good functionality such as overshooting the target, shaky pathing to target, and variable speed, to just name a few.

    What methods would you have to override to have osbot universally to implement custom mouse movement like that? I've spent about 4 hours trying to find information on how other people have done it in the past and I only came across 2 different topics that had anything to do with what I am asking/trying to do.

    Topic 1: This topic slightly addresses my question but the responses got derailed off the topic and is irrelevant to me. In the topic "making your own Mouse.click()" was mentioned which I assume was intended to mean overriding the Mouse.click() and Mouse.move() functions which is not possible because those methods are final and cannot be overridden. And before anyone answers "just make your own function that clicks where you want to click with the custom mouse movement you want to use...", i'm specifically asking how to universally override the mouse movement without having to create every single possible method I would ever need to use that would move the mouse like a new NPC.interact() method, a new Item.interact() method, etc.

     

    Topic 2: This topic is almost exactly what I want to be able to do, but the main topic it references (https://osbot.org/forum/topic/47398-semi-advanced-creating-your-own-mouse-controller/) has been moved to a location I cannot see with my osbot account (maybe I need VIP or something but I doubt it) and I went through all the archived topics in the date range that the topic existed and I couldn't find it. To be able to do what this topic below mentions, I need to be able to use the MouseController class (which is in the topic that is referenced above) and I have not found a way to see it.

     

    While having the ability to implement custom mouse movement would be really nice, my scripts work entirely fine right now so there is no real urgency here.

  7. On 3/18/2020 at 8:56 PM, Simoner26 said:

    Hi, amazing work. I've tried to implement that in my project but it seems like the GraphicUtilities util is not in the OsBot API anymore. Any other sugestion where I can take a look at to try to develop something like this? Thanks in advance

    idk if you still need it but i needed it, i just changed all the GraphicUtilities to getDisplay() because of this 

    
    import java.awt.Color;
    import java.awt.FontMetrics;
    import java.awt.Graphics2D;
    import java.awt.Point;
    import java.awt.Polygon;
    import java.awt.Rectangle;
    import java.awt.Shape;
    import java.awt.geom.Area;
    import java.awt.geom.Rectangle2D;
    import java.util.Collection;
    import java.util.List;
    import java.util.function.Function;
    
    import org.osbot.rs07.api.map.Position;
    import org.osbot.rs07.api.model.Entity;
    import org.osbot.rs07.api.model.Vector3D;
    import org.osbot.rs07.script.API;
    
    /**
     * Painter utility
     *
     * @author LiveRare
     */
    public class PaintAPI extends API {
    
        /**
         * Initialise module
         */
        @Override
        public void initializeModule() {
        }
    
        /**
         * Draw line between two in-game points
         *
         * @param g       - Graphic object
         * @param entity1 - First entity point
         * @param entity2 - Second entity point
         */
        public void drawLink(Graphics2D g, Entity entity1, Entity entity2) {
            Area a1;
            Area a2;
            Rectangle2D r1;
            Rectangle2D r2;
            Point p1;
            Point p2;
            if (entity1 != null && entity2 != null) {
                a1 = getDisplay().getModelArea(entity1.getGridX(), entity1.getGridY(), entity1.getZ(), entity1.getModel());
                a2 = getDisplay().getModelArea(entity2.getGridX(), entity2.getGridY(), entity2.getZ(), entity2.getModel());
                r1 = a1.getBounds2D();
                r2 = a2.getBounds();
                p1 = new Point((int) r1.getCenterX(), (int) r1.getCenterY());
                p2 = new Point((int) r2.getCenterX(), (int) r2.getCenterY());
                if ((p1.x > 0 || p1.y > 0) && (p2.x > 0 || p2.y > 0)) {
                    g.drawLine(p1.x, p1.y, p2.x, p2.y);
                }
            }
        }
    
        /**
         * Draw minimap area
         *
         * @param g    - Graphic object
         * @param area - Area object
         */
        public void drawMinimapArea(Graphics2D g, org.osbot.rs07.api.map.Area area) {
    
            Polygon areaPolygon;
            Polygon minimapPolygon;
            int minimapX;
            int minimapY;
            short[] minimapCoordinates;
    
            if (area != null) {
    
                areaPolygon = area.getPolygon();
    
                if (areaPolygon != null) {
    
                    minimapPolygon = new Polygon();
    
                    for (int i = 0; i < areaPolygon.npoints; i++) {
    
                        minimapX = areaPolygon.xpoints[i];
                        minimapY = areaPolygon.ypoints[i];
    
                        minimapCoordinates = getDisplay().getMinimapScreenCoordinate(minimapX, minimapY);
    
                        if (minimapCoordinates != null) {
    
                            minimapX = (int) minimapCoordinates[0];
                            minimapY = (int) minimapCoordinates[1];
    
                            minimapPolygon.addPoint(minimapX, minimapY);
                        }
    
                    }
    
                    drawShape(g, minimapPolygon);
                }
            }
        }
    
        /**
         * Draw a dynamically generated, position-related string and set its location to
         * an in-game position
         *
         * @param g        - Graphic object
         * @param toString - string function
         * @param position - Position object
         */
        public <T extends Position> void drawString(Graphics2D g, Function<T, String> toString, T position) {
            if (toString != null && position != null) {
                drawString(g, toString.apply(position), position);
            }
        }
    
        /**
         * Draw string for a tile
         *
         * @param g        - Graphic object
         * @param aString  - String object
         * @param position - Position object
         * @see {@link PaintAPI#drawString(Graphics2D, String, Rectangle)}
         */
        public void drawString(Graphics2D g, String aString, Position position) {
    
            Rectangle2D rectangle;
            Polygon polygon;
    
            if (position != null && position.isVisible(bot)) {
    
                polygon = position.getPolygon(bot);
    
                if (polygon != null) {
    
                    rectangle = polygon.getBounds2D();
    
                    drawString(g, aString, rectangle.getBounds());
                }
            }
        }
    
        /**
         * Draw string for an entity
         *
         * @param g       - Graphic object
         * @param aString - String object
         * @param entity  - Entity object
         */
        public void drawString(Graphics2D g, String aString, Entity entity) {
    
            Rectangle rectangle;
    
            if (entity != null && entity.isVisible()) {
    
                rectangle = getDisplay().getModelBoundingBox(entity.getGridX(), entity.getGridY(), entity.getZ(),
                        entity.getModel());
    
                if (rectangle != null) {
    
                    drawString(g, aString, rectangle);
                }
            }
        }
    
        /**
         * Draw entity
         *
         * @param g         - Graphic object
         * @param entity    - Entity object
         * @param aString   - String object
         * @param labelTile - <tt>Label relative to tile</tt>
         * @param click     - <tt>Draw click box</tt>
         * @param cube      - <tt>Draw model cube</tt>
         * @param minimap   - <tt>Draw minimap point</tt>
         * @param tile      - <tt>Draw tile</tt>
         * @param box       - <tt>Draw 3D wire-frame box spanning from bottom to top tile</tt>
         * @param wireframe - <tt>Draw wire-frame</tt>
         * @see {@link PaintAPI#drawClickBounds(Graphics2D, Entity)}
         * @see {@link PaintAPI#drawCube(Graphics2D, Entity)}
         * @see {@link PaintAPI#drawMinimapPoint(Graphics2D, Vector3D)}
         * @see {@link PaintAPI#drawTile(Graphics2D, Entity)}
         * @see {@link PaintAPI#drawBox(Graphics2D, Entity)}
         * @see {@link PaintAPI#drawWireframe(Graphics2D, Entity)}
         * @see {@link PaintAPI#drawString(Graphics2D, String, Position)}
         * @see {@link PaintAPI#drawString(Graphics2D, String, Entity)}
         */
        public void drawEntity(Graphics2D g, Entity entity, String aString, boolean labelTile, boolean click, boolean cube,
                               boolean minimap, boolean tile, boolean box, boolean wireframe) {
    
            if (entity != null) {
    
                if (minimap) {
                    drawMinimapPoint(g, entity);
                }
    
                if (entity.isVisible()) {
    
                    if (click) {
                        drawClickBounds(g, entity);
                    }
    
                    if (cube) {
                        drawCube(g, entity);
                    }
    
                    if (tile) {
                        drawTile(g, entity);
                    }
    
                    if (box) {
                        drawBox(g, entity);
                    }
    
                    if (wireframe) {
                        drawWireframe(g, entity);
                    }
    
                    if (labelTile) {
    
                        drawString(g, aString, new Position(entity.getX(), entity.getY(), entity.getZ() + 1));
    
                    } else {
    
                        drawString(g, aString, entity);
                    }
                }
            }
        }
    
        /**
         * Draw entity
         *
         * @param g                - Graphic object
         * @param entity           - Entity object
         * @param getDescription - get description
         * @param labelTile        - <tt>Label relative to tile</tt>
         * @param click            - <tt>Draw click box</tt>
         * @param cube             - <tt>Draw model cube</tt>
         * @param minimap          - <tt>Draw minimap point</tt>
         * @param tile             - <tt>Draw tile</tt>
         * @param tileCube         - <tt>Draw tile cube</tt>
         * @param wireframe        - <tt>Draw wireframe</tt>
         * @see {@link PaintAPI#drawEntity(Graphics2D, Entity, String, boolean, boolean, boolean, boolean, boolean, boolean, boolean)}
         */
        public <T extends Entity> void drawEntity(Graphics2D g, T entity, Function<T, String> getDescription, boolean labelTile, boolean click, boolean cube,
                                                  boolean minimap, boolean tile, boolean tileCube, boolean wireframe) {
            String aString = null;
            if (getDescription != null && entity != null) {
                aString = getDescription.apply(entity);
            }
            drawEntity(g, entity, aString, labelTile, click, cube, minimap, tile, tileCube, wireframe);
        }
    
        /**
         * Draw entities
         *
         * @param g                - Graphic object
         * @param entities           - Entity object
         * @param getDescription - get description
         * @param labelTile        - <tt>Label relative to tile</tt>
         * @param click            - <tt>Draw click box</tt>
         * @param cube             - <tt>Draw model cube</tt>
         * @param minimap          - <tt>Draw minimap point</tt>
         * @param tile             - <tt>Draw tile</tt>
         * @param tileCube         - <tt>Draw tile cube</tt>
         * @param wireframe        - <tt>Draw wireframe</tt>
         * @see {@link PaintAPI#drawEntity(Graphics2D, Entity, String, boolean, boolean, boolean, boolean, boolean, boolean, boolean)}
         */
        public <T extends Entity> void drawEntities(Graphics2D g, Collection<T> entities, Function<T, String> getDescription,
                                                    boolean labelTile, boolean click, boolean cube, boolean minimap, boolean tile, boolean tileCube,
                                                    boolean wireframe) {
    
            if (entities != null && !entities.isEmpty()) {
                entities.forEach(entity -> {
    
                    if (entity != null) {
    
                        String aString = null;
    
                        if (getDescription != null) {
                            aString = getDescription.apply(entity);
                        }
    
                        drawEntity(g, entity, aString, labelTile, click, cube, minimap, tile, tileCube, wireframe);
                    }
                });
            }
        }
    
        /**
         * Draw box
         *
         * @param g      - Graphic object
         * @param entity - Entity object
         */
        private void drawBox(Graphics2D g, Entity entity) {
            Position bottomTile;
            Position topTile;
            if (entity != null) {
                bottomTile = entity.getPosition();
                topTile = new Position(bottomTile.getX(), bottomTile.getY(), bottomTile.getZ() + 1);
                drawBox(g, bottomTile, topTile);
            }
        }
    
        /**
         * Draw box
         *
         * @param g        - Graphic object
         * @param bottomTile - Position object A
         * @param topTile - Position object B
         * @see {@link PaintAPI#drawShape(Graphics2D, Shape)}
         */
        private void drawBox(Graphics2D g, Position bottomTile, Position topTile) {
    
            Polygon bottom;
            Polygon top;
    
            Polygon side1;
            Polygon side2;
            Polygon side3;
            Polygon side4;
    
            if (bottomTile != null) {
    
                bottom = bottomTile.getPolygon(bot);
                top = topTile.getPolygon(bot);
    
                side1 = new Polygon(
                        new int[]{top.xpoints[0], top.xpoints[1], bottom.xpoints[1], bottom.xpoints[0]},
                        new int[]{top.ypoints[0], top.ypoints[1], bottom.ypoints[1], bottom.ypoints[0]},
                        4);
    
                side2 = new Polygon(
                        new int[]{top.xpoints[1], top.xpoints[2], bottom.xpoints[2], bottom.xpoints[1]},
                        new int[]{top.ypoints[1], top.ypoints[2], bottom.ypoints[2], bottom.ypoints[1]},
                        4);
    
                side3 = new Polygon(
                        new int[]{top.xpoints[2], top.xpoints[3], bottom.xpoints[3], bottom.xpoints[2]},
                        new int[]{top.ypoints[2], top.ypoints[3], bottom.ypoints[3], bottom.ypoints[2]},
                        4);
    
                side4 = new Polygon(
                        new int[]{top.xpoints[3], top.xpoints[0], bottom.xpoints[0], bottom.xpoints[3]},
                        new int[]{top.ypoints[3], top.ypoints[0], bottom.ypoints[0], bottom.ypoints[3]},
                        4);
    
                drawShape(g, bottom);
    
                drawShape(g, side1);
                drawShape(g, side2);
                drawShape(g, side3);
                drawShape(g, side4);
    
                drawShape(g, top);
    
            }
        }
    
        /**
         * Draw wireframe
         *
         * @param g      - Graphic object
         * @param entity - Entity object
         * @see {@link PaintAPI#drawShape(Graphics2D, Shape)}
         */
        private void drawWireframe(Graphics2D g, Entity entity) {
    
            List<Polygon> polygons = getDisplay().getModelMeshTriangles(entity.getGridX(), entity.getGridY(),
                    entity.getZ(), entity.getModel());
    
            if (polygons != null && !polygons.isEmpty()) {
    
                for (Polygon polygon : polygons) {
    
                    drawShape(g, polygon);
                }
            }
        }
    
        /**
         * Draw click bounds
         *
         * @param g      - Graphic object
         * @param entity - Entity object
         */
        private void drawClickBounds(Graphics2D g, Entity entity) {
    
            Rectangle rectangle = getDisplay().getModelBoundingBox(entity.getGridX(), entity.getGridY(),
                    entity.getZ(), entity.getModel());
    
            if (rectangle != null) {
    
                drawShape(g, rectangle);
            }
        }
    
        /**
         * Draw box around entity
         *
         * @param g      - Graphic object
         * @param entity - Entity object
         */
        private void drawCube(Graphics2D g, Entity entity) {
    
            Area area = getDisplay().getCubicArea(entity.getGridX(), entity.getGridY(), entity.getZ(),
                    entity.getSizeX(), entity.getSizeY(), entity.getHeight());
    
            if (area != null) {
    
                drawShape(g, area);
            }
        }
    
        /**
         * Draw minimap point
         *
         * @param g - Graphic object
         * @param v - 3D Vector
         */
        public void drawMinimapPoint(Graphics2D g, Vector3D v) {
    
            short[] minimapPosition = null;
            int x = 0;
            int y = 0;
    
            if (v != null) {
    
                minimapPosition = getDisplay().getMinimapScreenCoordinate(v.getX(), v.getY());
    
                if (minimapPosition != null) {
    
                    x = (int) minimapPosition[0];
                    y = (int) minimapPosition[1];
    
                    drawPoint(g, x, y, 3);
                }
            }
        }
    
        /**
         * Draw links between vectors
         *
         * @param g - Graphic object
         * @param a - 3D Vector A
         * @param b - 3D Vector B
         */
        public void drawMinimapLink(Graphics2D g, Vector3D a, Vector3D b) {
    
            short[] minimapPositionA;
            short[] minimapPositionB;
            int x1;
            int y1;
            int x2;
            int y2;
    
            if (a != null && b != null) {
    
                minimapPositionA = getDisplay().getMinimapScreenCoordinate(a.getX(), a.getY());
                minimapPositionB = getDisplay().getMinimapScreenCoordinate(b.getX(), b.getY());
    
                if (minimapPositionA != null && minimapPositionB != null) {
    
                    x1 = minimapPositionA[0];
                    y1 = minimapPositionA[1];
                    x2 = minimapPositionB[0];
                    y2 = minimapPositionB[1];
    
                    if (x1 != x2 && y1 != y2
                            && (x1 > 0 || y1 > 0)
                            && (x2 > 0 || y2 > 0)) {
    
                        g.drawLine(x1, y1, x2, y2);
                    }
                }
            }
        }
    
        /**
         * Draw tile
         *
         * @param g      - Graphic object
         * @param entity - entity object
         * @see {@link PaintAPI#drawTile(Graphics2D, Position)}
         */
        public void drawTile(Graphics2D g, Entity entity) {
    
            if (entity != null) {
    
                drawTile(g, entity.getPosition());
            }
        }
    
        /**
         * Draw tile
         *
         * @param g        - Graphic object
         * @param position - Position object
         */
        public void drawTile(Graphics2D g, Position position) {
    
            Polygon polygon = null;
    
            if (position != null && position.isVisible(bot)) {
    
                polygon = position.getPolygon(bot);
    
                drawShape(g, polygon);
            }
        }
    
        /**
         * Draw point
         *
         * @param g     - Graphic object
         * @param point - Point object
         * @param size  - Size of the oval
         */
        public static void drawPoint(Graphics2D g, Point point, int size) {
    
            if (point != null) {
    
                drawPoint(g, point.x, point.y, size);
            }
        }
    
        /**
         * Draw point
         *
         * @param g    - Graphic object
         * @param x    - X coordinate
         * @param y    - Y coordinate
         * @param size - Size of the oval
         */
        public static void drawPoint(Graphics2D g, int x, int y, int size) {
    
            final Color bg = g.getBackground();
            final Color fg = g.getColor();
    
            g.setColor(bg);
            g.fillOval(x - size, y - size, size * 2, size * 2);
            g.setColor(fg);
            g.drawOval(x - size, y - size, size * 2, size * 2);
    
        }
    
        /**
         * Draw and fill shape
         *
         * @param g     - Graphic object
         * @param shape - Shape object
         */
        public static void drawShape(Graphics2D g, Shape shape) {
    
            final Color bg = g.getBackground();
            final Color fg = g.getColor();
    
            if (shape != null) {
    
                if (bg != null) {
                    g.setColor(bg);
                    g.fill(shape);
                    g.setColor(fg);
                }
                g.draw(shape);
    
            }
        }
    
        /**
         * Draw string
         *
         * @param g       - Graphic object
         * @param aString - String object
         * @param x       - X coordinate
         * @param y       - Y coordinate
         */
        public static void drawString(Graphics2D g, String aString, int x, int y) {
    
            final Color bg = g.getBackground();
            final Color fg = g.getColor();
    
            if (aString != null && !aString.isEmpty()) {
    
                if (bg != null) {
    
                    g.setColor(bg);
                    g.drawString(aString, x + 1, y + 1);
                    g.drawString(aString, x + 1, y - 1);
                    g.drawString(aString, x - 1, y + 1);
                    g.drawString(aString, x - 1, y - 1);
                    g.setColor(fg);
                }
    
                g.drawString(aString, x, y);
            }
        }
    
        /**
         * Draw string
         *
         * @param g       - Graphic object
         * @param aString - String object
         * @param point   - Point object
         * @see {@link PaintAPI#drawString(Graphics2D, String, int, int)}
         */
        public static void drawString(Graphics2D g, String aString, Point point) {
    
            if (point != null) {
    
                drawString(g, aString, point.x, point.y);
            }
        }
    
        /**
         * Draw centred string above rectangle
         *
         * @param g         - Graphic object
         * @param aString   - String object
         * @param rectangle - Rectangle object
         */
        public static void drawString(Graphics2D g, String aString, Rectangle rectangle) {
    
            final FontMetrics fontMetrics = g.getFontMetrics();
    
            double x = 0D;
            double y = 0D;
            int stringWidth = 0;
    
            if (aString != null && !aString.isEmpty() && rectangle != null) {
    
                stringWidth = fontMetrics.stringWidth(aString);
    
                x += rectangle.getCenterX();
                x -= (stringWidth / 2);
    
                y = rectangle.getY();
    
                drawString(g, aString, (int) x, (int) y);
            }
        }
    }

     

    EDIT1: the paste code below isn't working for me right now but i'll try to fix it
    EDIT2: nvm i forgot to exchange context

  8. 39 minutes ago, ProjectPact said:

    Hi grey name that has done nothing for this community. I'm sorry but I don't understand why you sound so misinformed in your post. I tried to see if you've ever ran my script, and it seems you haven't. Therefore, you may not speak. Good day.

     

    3a0cb768dfa076e6453104cf8ac01ed6.png

    yikes didn't know you were gonna get all butthurt about it, but i was talking about scripts in general with anti-ban features like yours

  9. 3 hours ago, ProjectPact said:

    Bot smart and you’ll be fine! 

     

     

     

    I'm sorry but i don't understand why your script is so special?  I see that there are a bunch of cool features, but other bot clients with higher standards of scripts than this one and usually requires/has all of those features and the ban rates are relatively similar in my experience

  10. 2 hours ago, ihom said:

    Then yes, your issue is caused by the recent update.
    Same problem with "getNpcs()".

    hey i have a question not entirely related to this thread, how long does it normally take for the issues with the bots to get resolved after a new update and when would i know it's fixed.  i make my own private scripts for myself and this is the first time i really encountered a big problem with this

  11. 5 hours ago, FrostBug said:

    If you the timestamp of any tick reliant change, you can just use that to find when the next tick will occur.

    Where did you find GameTickListener and onGameTick() ? These are not specified in the OSBot API

    I was thinking about that and using prayer points but I decided there was a good chance that I wouldn't lose a prayer point every game tick, if you don't mind telling me how you do it in pm or something as watching your fire cape bot video did inspire me to find a way to detect the game ticks (im not making a fire cape bot btw).  I have a few ideas on how you might be able to determine it, but since I have created this thread I used this code to find a general idea of when the ticks happen (this is in the onPaint method so it updates really fast)

    gameTick = (int)java.lang.Math.floor((double)getBot().getClient().gameClockMs() / 600);
    g.drawString("Current Game Tick:  " + gameTick,10,250);

    I know it's probably not the most efficient process, but it was all I could think of right before I went to sleep.

    I found those methods way before when I was browsing through the possible methods to call (i am probably using the wrong terminology btw, im pretty new to programming in general) like for example:

    17bb1a1abc26e6e716a7a66d4def361c.gif

    I generally find it more useful browsing through that than wasting time looking at the API, since in the API it NEVER tells you the exact "vaules" that could be returned like for instance a MessageType TypeID returns these values based off of the message:

     proximity message - TypeID = 2
     private message - TypeID = 3
     clan message - TypeID = 9
     game message - TypeID = 27
     autochat message - TypeID = 90
     trade message - TypeID = 101
     

    That kind of information is nowhere to be found in the API AT ALL, which imo makes the API pretty much useless.  Sorry the majority of this post was off topic, but I hope i learn something from you or other experienced people on this forum.

     

    EDIT: just now after testing, I was able to 1 tick flick for a while while only looking at the current game tick that i used, so it should be sufficient enough

  12. i need help determining when the next game tick will be to help with a script i'm writing.  I essentially want to do only 1 action during that game tick, and i've tried all the GameTickListener and the deprecated method onGameTick() and i couldn't get either of them to work.  So i was wondering if there was anyway to read each game tick and increment a value whenever a new game tick takes place.

    btw i've tried checking the API for any information and couldn't find a single thing

  13. i think this script has been profiled by jagex :/ i used to be able to run 3 accounts 12 hours a day all the same ip (that i've been ban previously) and now i can't bot 1 account for more than 3 hours on fresh ip's without getting ban even while using the yanille location, which should not have had that many people botting there.  Good Luck to future buyers of this script



    PS: the bot still stops whenever any random appears for it but since we want to blame it on the client (even though no other script has that problem btw) we won't even try to look at the problem

  14. This script fills Buckets at the Varrock East fountain and uses them on Clay to make Soft Clay

    Reasons why I made this script:
    1. need to make a script to get scripter status
    2. there are no clay softener scripts on this bot client that aren't broken or complete garbage

    Requirements:
    14 buckets in your inventory
    clay in the bank

    Source: https://pastebin.com/UnLFGea2

    Jar: PigeonClaySoftener.jar

    Things I know I can improve on it:
    1. add the amount of clay made into soft clay into paint
    2. create more locations
    3. make sure that you can log in with anything in your inventory and not break the script

     

    Please let me know what I can improve on, thanks!

     

    EDIT (4/17/20):
    Just came back after a while and just wanted to say that this script probably won't work anymore but I will leave it up so anyone can look at my code to reference.

  15. @Explv So i tried your GUI snippet (the GridBagLayout) and i tried to add actions to the buttons on the GUI but i keep getting a null pointer exception on the 18th line (in insertButtonActionPerformed, whitelist.setModel(dm)) and i was hoping you could tell me what i was doing wrong.  Would it be a better idea to put the event handlers in the main class like how liverare's tutorial shows or keep them there?

    here's my code:
     

    import javax.swing.*;
    import javax.swing.border.EmptyBorder;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    
    import static java.awt.GridBagConstraints.HORIZONTAL;
    import static java.awt.GridBagConstraints.NONE;
    
    public class PigeonGUI {
    
        private final JFrame jFrame;
        DefaultListModel dm = new DefaultListModel();
    
        private void insertButtonActionPerformed(ActionEvent e) {
            if(nameField.getText() != null) {
                dm.addElement(nameField.getText());
                nameField.setText(null);
                whitelist.setModel(dm);
            }
        }
    
        private void deleteButtonActionPerformed(ActionEvent e) {
            if (whitelist.getSelectedValue() != null) {
                dm.removeElementAt(whitelist.getSelectedIndex());
                whitelist.setModel(dm);
            }
        }
    
        private void startButtonActionPerformed(ActionEvent e) {
            this.close();
        }
    
    
        public PigeonGUI() {
            jFrame = new JFrame("Pigeon GUI");
    
            mainPanel = new JPanel(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            jFrame.setContentPane(mainPanel);
            mainPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
    
            titleLabel = new JLabel("Pigeon GUI");
            gbc.gridx = 0;
            gbc.gridy = 0;
            gbc.gridwidth = 4;
            gbc.insets = new Insets(0, 10, 20, 10);
            mainPanel.add(titleLabel, gbc);
    
            nameLabel = new JLabel("Name:");
            gbc.gridx = 0;
            gbc.gridy = 1;
            gbc.gridwidth = 1;
            gbc.insets = new Insets(0, 0, 0, 5);
            mainPanel.add(nameLabel, gbc);
    
            nameField = new JTextField(20);
            gbc.gridx = 1;
            gbc.gridy = 1;
            gbc.gridwidth = 1;
            gbc.insets = new Insets(0, 0, 0, 0);
            mainPanel.add(nameField, gbc);
    
            whitelistScrollPane = new JScrollPane();
            JList<String> whitelist = new JList<>();
            whitelistScrollPane.add(whitelist);
            gbc.gridx = 2;
            gbc.gridy = 1;
            gbc.ipadx = 200;
            gbc.ipady = 200;
            gbc.gridwidth = 2;
            gbc.insets = new Insets(10, 10, 0, 10);
            mainPanel.add(whitelistScrollPane, gbc);
    
            insertButton = new JButton("Insert");
            insertButton.addActionListener(e -> insertButtonActionPerformed(e));
            gbc.gridx = 2;
            gbc.gridy = 2;
            gbc.fill = HORIZONTAL;
            gbc.weightx = 0.5;
            gbc.gridwidth = 1;
            gbc.ipadx = 0;
            gbc.ipady = 0;
            gbc.insets = new Insets(10, 10, 0, 10);
            mainPanel.add(insertButton, gbc);
    
            deleteButton = new JButton("Delete");
            deleteButton.addActionListener(e -> deleteButtonActionPerformed(e));
            gbc.gridx = 3;
            gbc.gridy = 2;
            gbc.fill = HORIZONTAL;
            gbc.weightx = 0.5;
            gbc.gridwidth = 1;
            gbc.ipadx = 0;
            gbc.ipady = 0;
            gbc.insets = new Insets(10, 10, 0, 10);
            mainPanel.add(deleteButton, gbc);
    
            startButton = new JButton("Start");
            startButton.addActionListener(e -> startButtonActionPerformed(e));
            gbc.gridwidth = 4;
            gbc.gridx = 0;
            gbc.gridy = 3;
            gbc.fill = NONE;
            gbc.insets = new Insets(20, 10, 0, 10);
            mainPanel.add(startButton, gbc);
    
            jFrame.pack(); // resize the JFrame so that all the components are at or above their preferred sizes
            jFrame.setLocationRelativeTo(jFrame.getOwner()); // center the gui on bot client
        }
    
        //test variables
        private JPanel mainPanel;
        private JLabel titleLabel;
        private JLabel nameLabel;
        private JTextField nameField;
        private JScrollPane whitelistScrollPane;
        private JList<String> whitelist;
        private JButton insertButton;
        private JButton deleteButton;
        private JButton startButton;
        //end test variables
    
    
        public void open() {
            jFrame.setVisible(true);
        }
    
        public void close() {
            jFrame.setVisible(false);
            jFrame.dispose();
        }
    
        public static void main(String[] args) {
            SwingUtilities.invokeLater(() -> new PigeonGUI().open());
        }
    }

     

  16. 6 hours ago, Explv said:

    1. DO NOT use absolute positioning (null layout), it's harder to maintain, and can easily looked fucked up on different systems with different configurations.
    2. DO NOT use GUI designers/builders, they produce bad code which is hard to maintain, and often is not the best way to build the GUI. You also cannot achieve more advanced things if you're using a builder. Another good reason to do it "by hand", is so that you actually know what you are doing, you will learn nothing from a GUI builder.

    3. Look at https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html5iP7AZ0.png, by combining these layout managers in nested JPanels you can easily achieve your desired GUI

    i'm assuming it would be a better idea to use a GUI designer until i understand what each of the layouts do and what should go where, but ill use your snippets as a guide in the future, thanks!

  17. 5 hours ago, liverare said:
    1. GUI builders let you pick which layout you want to use. This is important. A null layout will require you to specify the size and position of every component, whereas other layouts (GridBagLayout, BoxLayout, FlowLayout) automatically arrange your components, but you get to specify how they're arranged. You should write your own GUIs from scratch so you can build your GUIs exactly how you need them to be.
    2. I've never used that builder, so no comment.
    3. You're welcome.
    4. You're using a GUI builder. Why would somebody make an advanced tutorial for you when you're not going to learn the how's/why's of the actual underlying code?

    yeah i have looked at your GUI implementing tutorial, but i have never done anything dealing with atomic variables in my cs classes so far.  I would like to understand what im doing when i make anything rather than copy pasting or half understanding what is going on, but if nothing else works in this thread ill give it try.

  18. 1 hour ago, Slut said:

    3. How do i get the GUI to open in onStart
     - I would create a "main" void, set the frame equal to a new instance of your PidgeonGUI class, set the frame to visible & then utilize it with PidgeonGUI.main();, this probably isn't the 'right' way to go about it, but I have a "if it works, why change it" mentality about smaller things like this.

    so i tried to that (i used run instead of main for the function name) and when i started the script, nothing happened at all.  Even the logger didn't even show that a script started and whenever i try to rebuild the project it says it can't delete the .jar file until i close that instance of the osbot client

    here's my code
     

    //in the main class
    
    public class Main extends Script {
    
    	private PigeonGUI gui = new PigeonGUI();
    	private Settings s = new Settings();
    
    	@Override
        public void onStart() throws InterruptedException {
            log("Starting Script");
            gui.run(s);
        }
    
    	@Override
    	public int onLoop() throws InterruptedException {
    		if (!gui.isVisible()) {
    			//bot code here
    			return random(200, 600);
    		}
    		return random(200, 600);
    	}
    }
    
    
    //in the GUI class
    
    public class PigeonGUI extends JFrame {
    	//GUI code here
    	
    	public void run(Settings settings) {
            JFrame frame = new PigeonGUI();
            frame.setVisible(true);
        }
    }

    i have 2 return statements in onLoop and one shouldn't be there but the script doesn't even get past onStart to get there so it isn't a problem

×
×
  • Create New...