Jump to content

Explv

Scripter II
  • Posts

    2313
  • Joined

  • Last visited

  • Days Won

    6
  • Feedback

    100%

Posts posted by Explv

  1. 54 minutes ago, Taco Bell said:

    I got the impression the scripts are vetted to look for third party API calls (big no no).

    So getting a password itself wouldn't be a problem.

    I'm pretty sure token has a custom break handler on his NMZ script which gets my password (but let me watch when it logs out next time). 

    I've disabled randoms for my break handler so I can't rely on the current AUTO LOGIN.

    I can hardcode my own passwords for now I guess. Might have to rethink my break handler. 

    But if I logout, it tries to run the AUTO LOGIN handler, am I missing something?

    If I recall correctly, you do not need to disable randoms. You can override the break manager in isolation:

    getBot().getRandomExecutor().overrideOSBotRandom(customBreakManager)

    (Docs - https://osbot.org/api/org/osbot/rs07/event/RandomExecutor.html#overrideOSBotRandom-org.osbot.rs07.script.RandomSolver- )

    Where your custom break manager might look something like: https://github.com/Explv/Explvs-AIO/blob/master/src/main/java/tasks/break_task/CustomBreakManager.java

    There is no way to get passwords through the API, as it would be a security risk. You have to consider local scripts as well as SDN scripts.

    • Like 1
    • Heart 1
  2. 15 minutes ago, mitsuki said:

    So I want to essentially make a check for whether the player is training attack, strength, or defence, so that my script can activate with widgets to change the attack style. 

    I've tried to check whether the style is visible or not, but that always returns true if the combat options screen is showing, and false if not, so it doesn't actually check if "Lunge" is selected or not.

    I looked into configs in the api, but can't find anything. Any Ideas? 

    Cheers guys

     

    Read section 13 of this tutorial to learn about configs 

     

     

    Funnily enough, it actually covers attack style as the example.

    Screenshots are a bit out of date and the OSBot UI has changed, but there is still a config debug view in the settings.

    TLDR: Config 43.

  3. On 11/23/2020 at 2:08 AM, dubanon said:

    Gets stuck choosing outfit on tutorial island, just logs out after choosing name. Have to manually select outfit.

    Gets stuck starting rune mysteries. When asked if player wants to start quest (yes or no) it just clicks on npc again for an endless loop.

     

    These have to be manually done and after restarting, the script will continue. Still testing, just wondering if you still work on this script at all? 

     

    On 11/16/2020 at 2:30 AM, 101madcat101 said:

    hi just fond a bug in the questing part seams to get stuc on acsepting the quest and just clicks on the npc agen in a loop

     

     

    On 11/5/2020 at 9:38 PM, Atari said:

    Rune Mystery

     


    [INFO][Bot #2][11/05 03:32:24 PM]: WebWalkingEvent; We have reached the final destination!
    [INFO][Bot #2][11/05 03:32:24 PM]: Could not find NPC with name 'Duke Horacio'
    [INFO][Bot #2][11/05 03:32:24 PM]: Could not find NPC with name 'Duke Horacio'
    [INFO][Bot #2][11/05 03:32:24 PM]: Could not find NPC with name 'Duke Horacio'
    [INFO][Bot #2][11/05 03:32:25 PM]: Could not find NPC with name 'Duke Horacio'
    [INFO][Bot #2][11/05 03:32:25 PM]: Could not find NPC with name 'Duke Horacio'
    [INFO][Bot #2][11/05 03:32:25 PM]: Could not find NPC with name 'Duke Horacio'
    [INFO][Bot #2][11/05 03:32:25 PM]: Could not find NPC with name 'Duke Horacio'
    [INFO][Bot #2][11/05 03:32:26 PM]: Could not find NPC with name 'Duke Horacio'
    [INFO][Bot #2][11/05 03:32:26 PM]: Could not find NPC with name 'Duke Horacio'
    [INFO][Bot #2][11/05 03:32:26 PM]: Could not find NPC with name 'Duke Horacio'
    [INFO][Bot #2][11/05 03:32:26 PM]: Could not find NPC with name 'Duke Horacio'
     

     

    On 11/3/2020 at 6:09 PM, Jonathan Ortega said:

    its not working for quest anymore it just get stuck talkin at the quest start, wont say yes to start it, was working fine but not many more


    Fixed in latest version (v3.2.7). Available on GitHub now, or on SDN whenever a refresh happens.

  4. On 12/7/2020 at 6:10 PM, Straw said:

    When I activate the script it goes straight in to control settings and does nothing any idea on how to fix it?

     

    On 12/7/2020 at 7:02 PM, NutQuaker said:

    gets stuck at settings bot does not work anymore big sad

     

    On 12/13/2020 at 3:07 PM, nirinullz said:

    Needs updated to support the new video settings layout. I might fork the repo try to fix and upload svn if not fixed soon.

     

    On 12/16/2020 at 4:52 PM, SpringWaterPaul said:

    need uppdate

     

    On 1/13/2021 at 11:25 AM, Yarran1017 said:

    this would be Pog if it was updated

     

    On 1/14/2021 at 8:28 PM, runiteoreg1 said:

    bot stopped working - stucked at display settings

     

    On 1/15/2021 at 11:11 AM, lop1k2345 said:

    is this gonna get updated?



    Just pushed an update to the SDN & GitHub

    SDN will be available whenever it's refreshed

    GitHub working now

    Will look at other reported issues and fix now too.

    • Heart 1
  5. 3 hours ago, Marsman19 said:

    I heard about this virtual reality project that gives you the opportunity to buy virtual land.
    The land would become more expensive if more people buy land in that specific country.

    The developers claim it should provide passive income in the near future, based on advertisements etc.

    Not sure if it's legit or a scam..

    www.earth2.io

     

     

     

    I would say it's more likely to be a scam than not. There's barely any information about it online, aside from their website (which makes some ridiculous claims)

  6. 6 hours ago, Kangabr said:

    here is the error if it helps

     

     

    [ERROR][Bot #1][12/25 10:59:38 PM]: Error in bot executor or from Error class (and not Exception)!
    java.lang.Error: Unresolved compilation problem: 
        The type Main must implement the inherited abstract method Script.onLoop()

        at Core.Main.onLoop(Main.java:56)
        at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(tk:46)
        at java.lang.Thread.run(Thread.java:748)

     

    You're  either missing the onLoop function which is required, or it has the wrong signature. See section 2 of the following: https://osbot.org/forum/topic/115124-explvs-scripting-101/

  7. Your Test class is importing a log function from a package that is blocked by OSBot's permissions.

    That's not the log function you want anyway, you want the one from the OSBot API.

    Remove that import and either pass an instance of MethodProvider to the constructor of your class, or have your class extend MethodProvider and call exchangeContext.

    See section 5 in this tutorial:

     

  8. 1 hour ago, nmba said:

    hello trying to write my first script but i got a few problems

    
    
    @Override
    public int onLoop() throws InterruptedException {
        RS2Object stall = getObjects().closest("Tea Stall");
        Area area = Banks.VARROCK_EAST;
        if (getInventory().isFull()) {
            if (!area.contains(myPosition())) {
                getWalking().webWalk(area);
                getBank().open();
                if (bank.isOpen()) {
                    bank.depositAll();
                } else {
                    getBank().open();
                } else{
                    getWalking().webWalk(area);
                } else{
                    getWalking().webWalk(stall.getPosition());
                }
            }
        } else if (stall != null && !myPlayer().isAnimating()) {
            stall.interact("Steal-from");
        }
        return random(200, 300);
    }

    i already figured out that the problem is that i use : IF IF IF , ELSE ELSE ELSE  but need to use if else , else if .

    But i cant figure out how i should do it exactly. Can someone please help me.

     

    "the problem is that I use: IF IF IF, ELSE ELSE ELSE but need to use if else, else if."

    At the risk of sounding rude, that's pretty nonsensical. I would highly recommend following some Java tutorials until you have a basic understanding of programming and logical constructs.

    You'll find that it's much faster to learn that way rather than waiting for replies on here.

    The best way to learn programming in my opinion, is to follow some tutorials, make things, Google when you get stuck, fix things yourself.

    Perhaps try writing out some pseudocode, so you can get a clearer idea how this should be structured.

    For example:

    If my inventory is full:

        If I am not in the bank:

            Then walk to the bank

        Else if the bank is not open

            Then open the bank

       Else if.... Etc.

    Else if I am not at the stalls:

        Then walk to the stalls

    Etc.

    • Like 1
  9. getInventory().contains(item1, item2)

    Returns true if either item1 or item2 is in the inventory.

    getInventory().interact("Eat", item1, item2)

    Uses the interaction "Eat" on either item1 or item2 depending on which item it finds in the inventory first.

    If you want to eat a Swordfish followed by a Pizza, you need to be explicit in your logic, i.e

    If not eaten swordfish

        Then eat swordfish

    Else 

        Eat pizza

     

    To track whether you have eaten a swordfish, just store a boolean value in a variable, e.g. hasEatenSwordfish, and set it to true when the "Eat" interaction on the swordfish is successful. Set it back to false when you eat the pizza

     

    • Heart 2
  10. 51 minutes ago, Presumptuous said:

    I'm not quite sure on how to launch a GUI that is built using JavaFX through the script I'm creating. Right now it is an inner class to the main script and this is the code I wrote to attempt launching it in the onStart() method of the script.

    
    try {
        Class init = Class.forName("Initialization");
    
        Initialization.launch();
    
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }

    The OSBot app is a swing app, so you have to embed your JavaFX content within swing.

    You can do so using a JFrame + JFXPanel.

    For example:

    https://docs.oracle.com/javafx/2/swing/swing-fx-interoperability.htm

    Or:

    https://stackoverflow.com/questions/40110175/how-to-run-javafx-stage-scene-in-swing-application

     

  11. 2 hours ago, T0ffee said:

     

    Rather embarrassingly my original snippet worked perfectly once I put it inside a skeleton script.

    My original intention was to interact with a rather obscure NPC for whom the .interact() method doesn't work (but I could extract its position).

     

    Many thanks for your reply, and for your work more generally within the OSBot community. 

     

     

    Glad you got it working 👍

  12. 4 hours ago, T0ffee said:

    Hello, 

    I've been having some trouble getting my script to hover over and click a specific tile near the player (in this case in the Al-kharid mine). 

     

    
    new Position(3299, 3273, 0).hover(getBot());
    getMouse().click(false);

     

    It seems neither of these methods work, even when directly next to the tile. I've cobbled this solution together from a few old threads but perhaps the API has changed? I'm using mirror mode if that makes any difference.

    Any help would be appreciated. 

     

    Hello old bean

    Are you trying to just walk to said tile? If so you can do it with a WalkingEvent:

     

    WalkingEvent walkingEvent = new WalkingEvent(new Position(3299, 3273, 0));
    walkingEvent.setMinDistanceThreshold(0);
    execute(walkingEvent);

     

    Could you please also elaborate on what you mean by "neither of these methods work"? Does it not hover the tile? Does it hover but not click?

    • Like 1
  13. 42 minutes ago, nills3 said:

    Thank you for trying to help.

    Remove this:
     

    final Bank bank = new Bank()
    


    You don't instantiate `Bank`, it's already instantiated for you and provided via the MethodProvider. If you are in your main Script class, you can access it using getBank()

    Have a read through my tutorial if you haven't already, it might help you out a bit:

    https://osbot.org/forum/topic/115124-explvs-scripting-101/

  14. 4 hours ago, fisher4040 said:

    mate evey time i stop script it closes client, if bot runs out of supply it closes client, i dont think ive ever been this frustrated ever botting fuck me... i'd rarther import manual 

    It's a free open source piece of software. You're more than welcome to modify it to work how you want to.

    It closes the client when the script exits, this is to support script chaining. If you want to change it, there's nothing stopping you.

  15. You can just set a boolean flag when you enter the house.

    For example:

    public class YourScript extends Script {
        private boolean hasEnteredHouse;
    
        @Override
        public int onLoop() throws InterruptedException {
            if (!inHouse()) {
                // If we're not in the house, enter it
                enterHouse();
            } else {
                // We are inside the house, so we can set hasEnteredHosue to true
                // so that next time we enter the house, we can use the last visit functionality
                hasEnteredHouse = true;
            }
            return 600;
        }
    
        public boolean enterHouse() {
            if (hasEnteredHouse) {
                // We have entered the house before, use the last visit functionality
            } else {
                // We have not entered the house before, use the search
            }
        }
    }

     

    Or alternatively, set a different flag when you see the "You haven't visited anyone this session." message.

    For example:

    public class YourScript extends Script {
        private boolean visitedPlayerHouse = true;
    
        @Override
        public int onLoop() throws InterruptedException {
            if (!inHouse()) {
                // If we're not in the house, enter it
                enterHouse();
            } else {
                // We have entered the house, so we set visitedPlayerHouse to true
                // so that next time we go to enter a house, we know that we can use the
                // last visit functionality
                visitedPlayerHouse = true; 
            }
            return 600;
        }
    
        public boolean enterHouse() {
            if (visitedPlayerHouse) {
                // We have entered the house before, use the last visit functionality
            } else {
                // We have not entered the house before, use the search
            }
        }
      
        @Override
        public void onMessage(Message message) {
            if (message.getType() != MessageType.GAME) {
                return; 
            }
    
          	// When we see this GAME message
            if (message.getMessage().contains("You haven't visited anyone this session.")) {
                // We set visitedPlayerHouse to false
                // So that we know to use the search functionality to enter the house next time
                visitedPlayerHouse = false; 
            }
        }
    }

     

    Note I have not tested any of the above code, but it should give you an idea how to do it.

    • Like 2
  16. 15 hours ago, ProjectPact said:

    This is implemented in OSRS Script Factory.

    You may switch scripts based on:

    1. Skill levels 

    2. XP gained

    3. Total levels

    4. Combat level

    5. Time

     


    Note that this is not related to switching OSBot scripts, so is not quite the same thing as what OP wants.

  17. 1 hour ago, SmallBank said:

    Great script! Quick bug i've found is the deposit box at port sarim - It walks there fine then doesnt interact with the deposit box or deposit items. But if you do it then it carries on as normal :D

    Thanks for the report, I actually just fixed this in the latest change (v3.2.5), it's already available on GitHub, but I'm guessing the SDN has not updated yet. 

    6 hours ago, botimusprime said:

    is the sdn version up to date now?

    If you mean up to date with the GitHub version, then yes pretty much. The GitHub version is sometimes maybe 1 change ahead, just because it's faster to release to GitHub than the SDN.

    But yes they're basically the same now, and all changes I'm pushing to GitHub are also pushed to the SDN

    On 7/22/2020 at 3:14 AM, Murphyryan61 said:

    Let me first say that I love this script, it's been a life safer. Pardon if this bug has been reported before in this thread but when buying multiple items from the GE in a row the script doesn't have time to react to the 2nd, 3rd, 4th etc item so you're always buying the wrong item after the first one.

    Ie. It seems need more time to react before typing the 2nd, 3rd, 4th, item and so on.

    Thanks for your work, very impressive.

    Ryan

     

    11 hours ago, sudoinit6 said:

    I noticed this too, if you uncheck "remember last item" this problem goes away but could still be fixed to work under default conditions.


    Thanks I can also reproduce this, but I did not have time to fix it yet, issue isn't immediately obvious. 

    An easy fix here is to make the script turn off "remember last item", but I'm not sure that's ideal.

    I'll take a look at it as soon as I can

  18. 10 hours ago, SeanAvak said:

    Hiya folks,

    Didn't immediately see a way of implementing this (I'm fairly new to the API) so I went about implementing it myself. Here's a snippet that takes a Position to minimize the distance from, as well as a String carrying the name of the NPC using Java 8 Streams. It returns a list of all NPCs that occupy the position of the NPC you've searched for. Additionally I've included an offset, so for the sake of loops (if the closest NPC isn't suitable, say it is already in combat) then you can add 1 and it will bring back the next closest position. I would imagine it is quite easy to adjust the returned object type, such as for other Entities.

    This is being used with my first script, a Tutorial Island implementation, so I make no guarantees for actual in-game use, due to the seemingly large differences between Tutorial Island and the actual main game. Hope it helps.

    
        public static List<NPC> closestToPosition(Position position, String entity){
            List<NPC> npcs = getNpcs().getAll();
            
            List<Position> npcPositions = npcs.stream().filter(c -> c.getName().equals(entity))
                    .map(temp -> new Position(temp.getX(), temp.getY(), temp.getZ())
                    ).sorted(Comparator.comparingInt(temp -> temp.distance(position))).collect(Collectors.toList());
            return getNpcs().get(npcPositions.get(0).getX(), npcPositions.get(0).getY());
        }
          
        public static List<NPC> closestToPosition(Position position, String entity, int offset){
            List<NPC> npcs = getNpcs().getAll();
            
            List<Position> npcPositions = npcs.stream().filter(c -> c.getName().equals(entity))
                    .map(temp -> new Position(temp.getX(), temp.getY(), temp.getZ())
                    ).sorted(Comparator.comparingInt(temp -> temp.distance(position))).collect(Collectors.toList());
            
            return getNpcs().get(npcPositions.get(offset).getX(), npcPositions.get(offset).getY());
        }

    Edit: I realize this is open to IndexOutOfRange issues; shouldn't be too big of a deal to handle on your end, but if it comes back to bite me I'll update as needed.

     

    9 hours ago, Nbacon said:

    Can you give me some use cases for this?

    Also does this do the same thing?

    
        public  NPC closestToPosition(Position position, String entity){
            return   Scheme.scemeBot.getNpcs().getAll().stream().filter(s->s.getName().equals(entity)&&check(s)).reduce((a,b)->{
    
    
                        return (a.getPosition().distance(position)< b.getPosition().distance(position))?a:b;
                    }
    
            ).get();
        }
    
        private  boolean check(NPC npc) {
            return !npc.isHitBarVisible() && !npc.isUnderAttack() && npc.getHealthPercent() > 0 && npc.getInteracting() == null;
        }

     



    This would be a bit cleaner, allowing for types other than just NPC, and filters other than just entity name:

     

    public <T extends Entity> Optional<T> closestToPosition(final Position position, final List<T> entities) {
        return entities.stream().min(Comparator.comparingInt(e -> position.distance(e.getPosition())));
    }

     

    Example Usage:

    Position pos = new Position(1, 2, 3);
    
    Optional<NPC> rat = closestToPosition(pos, getNpcs().filter(new NameFilter<>("Rat")));

     

    Note that `position.distance()` is the *straight line* distance, it does not take into account any obstacles. This doesn't matter in your specific use-case, but if you wanted to account for it, then you should use getMap().realDistance(). For example:

     

    public <T extends Entity> Optional<T> closestToPosition(final Position position, final List<T> entities) {
        return entities.stream().min(Comparator.comparingInt(e -> getMap().realDistance(position, e.getPosition())));
    }

     

    Or you can support both options using:

     

    public <T extends Entity> Optional<T> closestToPosition(final Position position, final List<T> entities, final boolean realDistance) {
        final ToIntFunction<T> distanceFunc = (T e) -> (
                realDistance ? getMap().realDistance(position, e.getPosition())
                             : position.distance(e.getPosition())
        );
    
        return entities.stream().min(Comparator.comparingInt(distanceFunc));
    }

     

    If you want to include further filtering abilities within the helper function itself, that can also be achieved using:

     

    public <T extends Entity> Optional<T> closestToPosition(final Position position, final List<T> entities, final boolean realDistance, final Filter<T>... entityFilter) {
        final ToIntFunction<T> distanceFunc = (T e) -> (
                realDistance ? getMap().realDistance(position, e.getPosition())
                             : position.distance(e.getPosition())
        );
            
        final Predicate<T> aggregatedEntityFilter = e -> Stream.of(entityFilter).allMatch(filter -> filter.match(e));
    
        return entities.stream().filter(aggregatedEntityFilter).min(Comparator.comparingInt(distanceFunc));
    }

     

    Example usage:

     

    Position pos = new Position(1, 2, 3);
    
    Optional<NPC> rat = closestToPosition(pos, getNpcs().getAll(), true, new NameFilter<>("Rat"));

     

    • Like 7
    • Heart 1
  19. On 5/10/2020 at 8:44 PM, Thunderclees said:

    i set up a resource task to get 280 logs, then a resource task to firemake 280 logs.

    it got the 280 logs fine, but didn't deposit the last 28 before trying to get the tinderbox (28 logs in inventory, keeps trying to withdraw tinderbox).

    I deposit the logs myself, the bot grabs the tinderbox, goes outside, and just stands there doing nothing. "Activity: Firemaking : "

    edit. set up just a firemaking level task (set to 50 in lumbridge) bot does nothing.

    edit 2. set up a second firemaking level task (set to 50 in draynor) and it seems to be working.


    Fixed in latest version

  20. 29 minutes ago, Bigbaws said:

    Theres also a bug on cooks assistent where it does not go down the ladder when added hat in hopper.

    Thanks. Fixed in the latest GitHub version.

    I've also pushed all script updates to the SDN, so hopefully that version will be updated in the near future

    On 6/10/2020 at 7:19 PM, iLylee said:

    Works really well, follows multiple tasks without fail.

     

    3 bugs found during quests, no issues with skilling

    - During sheep sheerer 

       - if farmer is outside script wont find him

       - conversation with farmer will loop unless you pause and finish convo manually

     

    - cooks assisstant, when collecting flour gets stuck on top floor of mill. Repeatedly pulls lever. 

     

     

    Thanks fixed these in latest GitHub version.

    Also pushed to the SDN, which will be available whenever that script gets rebuilt 

×
×
  • Create New...