Jump to content

Zynava

Members
  • Posts

    7
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Zynava

  1. Forth script release! 🎉 

    Do you like my free scripts? Please show your support: 🙂  ---------------- 👇           Buy Zynava a Coffee!

    DISCLAIMER: This script is for EDUCATIONAL PURPOSES ONLY. It is to help other new scripters get an idea of how to approach writing scripts. If you use this script,⚠️you will more than likely face a quick ban in OSRS⚠️. This is a very easy first script to write, but also a very well-known method. Use at your own risk, and most importantly... learn from it. 🙂

    VIDEO TUTORIAL:

    CODE:

    import com.epicbot.api.shared.APIContext;
    import com.epicbot.api.shared.GameType;
    import com.epicbot.api.shared.entity.GroundItem;
    import com.epicbot.api.shared.methods.*;
    import com.epicbot.api.shared.model.Area;
    import com.epicbot.api.shared.script.LoopScript;
    import com.epicbot.api.shared.script.ScriptManifest;
    import com.epicbot.api.shared.util.paint.frame.PaintFrame;
    import com.epicbot.api.shared.webwalking.model.RSBank;
    
    import java.awt.*;
    
    @ScriptManifest(name = "Lumbridge Cowhide Collector by Zynava", gameType = GameType.OS)
    public class LumbridgeCowHideCollector extends LoopScript {
    
        /*** BEGIN VARIABLES ***/
        public String status = "";
        public IInventoryAPI myInventory() { return getAPIContext().inventory(); }
        public IWebWalkingAPI webWalking() { return getAPIContext().webWalking(); }
        public IBankAPI myBank() { return getAPIContext().bank(); }
        public ILocalPlayerAPI localPosition() { return getAPIContext().localPlayer(); }
        public IGroundItemsAPI groundItems() { return getAPIContext().groundItems(); }
        public Area COW_AREA = new Area(3244, 3295, 3262, 3277);
        /*** END VARIABLES ***/
    
        @Override
        public boolean onStart(String... strings) {
            setStatus("Script starting");
            return true;
        }
    
        @Override
        protected int loop() {
            if(myInventoryIsFull()) {
                setStatus("Heading to bank...");
                bank();
                if(myBank().isOpen()) {
                    setStatus("Depositing inventory...");
                    if(myBank().depositInventory()) {
                        myBank().close();
                    }
                }
            }
    
            if(!myInventoryIsFull() && !COW_AREA.contains(localPosition().getLocation())) {
                setStatus("Walking to cow field...");
                webWalking().walkTo(COW_AREA.getRandomTile());
            }
    
            if(!myInventoryIsFull() && COW_AREA.contains(localPosition().getLocation())) {
                GroundItem cowHide = groundItems().query().named("Cowhide").results().nearest();
                if(cowHide != null) {
                    setStatus("Gathering cowhide");
                    cowHide.interact("Take");
                }
            }
            return 50;
        }
    
        public boolean myInventoryIsFull() {
            return myInventory().isFull();
        }
    
        public void bank() {
            webWalking().walkTo(RSBank.LUMBRIDGE_TOP.getTile());
            myBank().open();
        }
    
        public void setStatus(String status) {
            this.status = status;
        }
    
        @Override
        protected void onPaint(Graphics2D g, APIContext ctx) {
            PaintFrame frame = new PaintFrame("Lumbridge Cowhide Collector by Zynava");
            frame.addLine("Action being performed: ", status);
            frame.draw(g, 0, 170, ctx);
        }
    }

     

    • Like 3
  2. Third script release! 🥳 Do you like my free scripts? Please show your support and Buy Me a Coffee!  

    This one is really simple. Have empty jugs in your bank & bot will withdraw, fill them at pump, bank, rinse & repeat.

    CODE:
     

    import com.epicbot.api.shared.APIContext;
    import com.epicbot.api.shared.GameType;
    import com.epicbot.api.shared.entity.ItemWidget;
    import com.epicbot.api.shared.entity.SceneObject;
    import com.epicbot.api.shared.methods.*;
    import com.epicbot.api.shared.model.Area;
    import com.epicbot.api.shared.script.LoopScript;
    import com.epicbot.api.shared.script.ScriptManifest;
    import com.epicbot.api.shared.util.paint.frame.PaintFrame;
    import com.epicbot.api.shared.util.time.Time;
    import com.epicbot.api.shared.webwalking.model.RSBank;
    
    import java.awt.*;
    
    @ScriptManifest(name = "Water Jug Filler by Zynava", gameType = GameType.OS)
    public class WaterJugFiller extends LoopScript {
    
        /***BEGIN VARIABLES***/
        private String status = "Starting";
        private final Area PUMP_POS = new Area(2949, 3382, 2949, 3383);
        IBankAPI myBank() { return getAPIContext().bank(); }
        IInventoryAPI myInv() { return getAPIContext().inventory(); }
        IWebWalkingAPI webWalking() { return getAPIContext().webWalking(); }
        IWalkingAPI walking() { return getAPIContext().walking(); }
        ILocalPlayerAPI localPosition() { return getAPIContext().localPlayer(); }
        IObjectsAPI localObject() { return getAPIContext().objects(); }
        /***END VARIABLES***/
    
        @Override
        public boolean onStart(String... strings) {
            return true;
        }
    
        @Override
        protected int loop() {
            //On script start, if inventory is empty...
            if(myInv().isEmpty()) {
                setStatus("Banking");
                bank();
            }
            // If inv if full, bank
            if(myInv().isFull()) {
                if(myInv().onlyContains("Jug of water")) {
                    setStatus("Banking");
                    bank();
                } else if(myInv().contains("Jug") && !PUMP_POS.contains(localPosition().getLocation())) {
                    webWalking().walkTo(PUMP_POS.getRandomTile());
                } else if(myInv().contains("Jug") && PUMP_POS.contains(localPosition().getLocation())) {
                    SceneObject PUMP = getPump();
                    ItemWidget jug = myInv().getItem("Jug");
                    if(PUMP != null) {
                        setStatus("Filling jugs");
                        if(jug != null) {
                            Time.sleep(2000, jug::interact);
                            Time.sleep(2000, PUMP::interact);
                        }
                    }
                }
            // If moving, don't do anything
            } else if(localPosition().isMoving()) {
                Time.sleep(1000, () -> !localPosition().isMoving());
            // If out of run and we have some to use, enable run
            } else if(walking().isRunEnabled() && walking().getRunEnergy() > 15) {
                if(walking().setRun(true)) {
                    Time.sleep(2000, () -> walking().isRunEnabled());
                }
            }
            return 100;
        }
    
        public void setStatus(String status){
            this.status = status;
        }
    
        public void bank() {
            if(myBank().isOpen()) {
                if(!myInv().onlyContains("Jug")) {
                    myBank().depositInventory();
                    Time.sleep(2000, () -> myInv().isEmpty());
                } else {
                    if(myBank().withdrawAll("Jug")) {
                        Time.sleep(2000, () -> myInv().onlyContains("Jug"));
                    } else {
                        Time.sleep(2000, () -> myBank().close());
                        Time.sleep(4000, () -> getAPIContext().game().logout());
                        getAPIContext().script().stop("Stopping script");
                    }
                }
            } else {
                webWalking().walkTo(RSBank.FALADOR_WEST.getTile());
                myBank().open();
            }
        }
    
        public SceneObject getPump() {
            return localObject().query().nameMatches("Waterpump").results().nearest();
        }
    
    
        @Override
        protected void onPaint(Graphics2D g, APIContext ctx) {
            PaintFrame frame = new PaintFrame("Water Jug Filler by Zynava");
            frame.addLine("status", status);
            frame.draw(g, 0, 170, ctx);
        }
    }

     

    • Like 1
  3. Second script release! 🥳🎉Woo! Do you like my free scripts? Please show your support and Buy Me a Coffee!  

    TIPS FOR RUNNING THIS SCRIPT:
    - Adjust your camera for top-down view.
    - Disable roofs
    - Zoom your camera out as far as possible
    - Start with an empty inventory (although the bot will deposit for you if you have anything in your inventory that is NOT a red spider egg).
    - If you have a weak defense and don't regen HP quicker than the red spiders can hit you for, do not wear what you can't lose. ☠️This bot will not save you from death. ☠️

    - Does this bot support pouches and glory teleporting?
    Not at this time. This is Version 1 of this bot. Call it the beta. Future versions will have support for these, and there is currently no ETA for the next version as this was just released. As of 10/31/2021, this version of the script was finished & production of Version 2 is not in progress.


    CODE:
    This script will run from anywhere. It will take you to Edgeville, it will bank when needed, and it will take you to the Red Spiders' Egg spot in the Edgeville dungeon. It will collect until your inventory is full (28), bank, rinse, and repeat. 

    import com.epicbot.api.shared.APIContext;
    import com.epicbot.api.shared.GameType;
    import com.epicbot.api.shared.entity.GroundItem;
    import com.epicbot.api.shared.entity.SceneObject;
    import com.epicbot.api.shared.methods.*;
    import com.epicbot.api.shared.model.Area;
    import com.epicbot.api.shared.script.LoopScript;
    import com.epicbot.api.shared.script.ScriptManifest;
    import com.epicbot.api.shared.util.paint.frame.PaintFrame;
    import com.epicbot.api.shared.util.time.Time;
    
    import java.awt.*;
    
    @ScriptManifest(name = "Edgevville Red Spider Egg Collector by Zynava", gameType = GameType.OS)
    public class RedSpiderEggCollector extends LoopScript {
    
        /***START VARIABLES***/
        public boolean botIsNotInDungeon = true;
        IWebWalkingAPI webWalking() { return getAPIContext().webWalking(); }
        ILocalPlayerAPI localPosition() { return getAPIContext().localPlayer(); }
        IInventoryAPI myInventory() { return getAPIContext().inventory(); }
        IBankAPI myBank() { return getAPIContext().bank(); }
        IObjectsAPI localObject() { return getAPIContext().objects(); }
        IGroundItemsAPI groundItem() { return getAPIContext().groundItems(); }
        Area edgeBank = new Area(3092, 3493, 3094, 3491);
        Area dungeonEntrance = new Area(3093, 3471, 3095, 3469);
        Area redSpiderEggArea = new Area(3118, 9949, 3127, 9956); // BLOCKER
        /***END VARIABLES***/
    
        public boolean inventoryIsEmpty() {
            return myInventory().isEmpty();
        }
    
        public boolean needsToGoToBank() {
            return myInventory().isFull() || (!myInventory().onlyContains("Red spiders' eggs") && !edgeBank.contains(localPosition().get()));
    
        }
    
        public boolean bankIsOpen() {
            return myBank().isOpen();
        }
    
        public boolean botNotAtDungeonEntrance() {
            return !dungeonEntrance.contains(localPosition().get());
        }
    
        public boolean botIsAtDungeonEntrance() {
            return dungeonEntrance.contains(localPosition().get());
        }
    
        public void goToBank() {
            if(!edgeBank.contains(localPosition().get())) {
                System.out.println("Walking to bank.");
                webWalking().walkTo(edgeBank.getRandomTile());
                myBank().open();
            }
        }
    
    
        public SceneObject getEntranceDoor() {
           return localObject().query().nameMatches("Trapdoor").actions("Open").results().nearest();
        }
        public SceneObject getEntranceLadder() {
            return localObject().query().nameMatches("Trapdoor").actions("Climb-down").results().nearest();
        }
        public void goToDungeonEntrance() {
            webWalking().walkTo(dungeonEntrance.getRandomTile());
        }
        public void goToRedSpiderEggArea() {
            webWalking().walkTo(redSpiderEggArea.getRandomTile());
        }
        public GroundItem getNearestEggs() {
            return groundItem().query().nameMatches("Red spiders' eggs").results().nearest();
        }
    
    
    
        @Override
        public boolean onStart(String... strings) {
            return true;
        }
    
        @Override
        protected int loop() {
            if(needsToGoToBank()) {
                goToBank();
            }
    
            if(bankIsOpen() && !inventoryIsEmpty()) {
                myBank().depositInventory();
            } else {
                myBank().close();
            }
    
            if(!myInventory().isFull() && botNotAtDungeonEntrance() && botIsNotInDungeon) {
                goToDungeonEntrance();
            }
    
            if(botIsAtDungeonEntrance() && !myInventory().isFull()) {
                SceneObject trapdoorClosed;
                SceneObject trapdoorOpen;
                trapdoorClosed = getEntranceDoor();
                trapdoorOpen = getEntranceLadder();
    
                if(trapdoorClosed != null) {
                    trapdoorClosed.interact("Open");
                    return 100;
                }
    
                if(trapdoorOpen != null) {
                    trapdoorOpen.interact("Climb-down");
                    botIsNotInDungeon = false;
                    return 100;
                }
            }
    
            if(!myInventory().isFull() && botIsNotInDungeon == false && !redSpiderEggArea.contains(localPosition().get())) {
                goToRedSpiderEggArea();
                return 100;
            }
    
            if(redSpiderEggArea.contains(localPosition().get())) {
                if(myInventory().getCount("Red spiders' eggs") < 28) {
                    GroundItem eggs = getNearestEggs();
                    System.out.println(eggs);
                    if(eggs != null) {
                        eggs.interact("Take");
                        Time.sleep(1000);
                    }
                    return 100;
                }
            }
    
            if(myInventory().getCount("Red spiders' eggs") == 28) {
                botIsNotInDungeon = true;
            }
    
            return 100;
        }
    
        @Override
        protected void onPaint(Graphics2D g, APIContext ctx) {
            PaintFrame frame = new PaintFrame("Red Spider Egg Collector by Zynava");
            frame.draw(g, 0, 170, ctx);
        }
    }

     

    • Like 2
  4. Do you like my free scripts? Please show your support and Buy Me a Coffee!  

    Hi, first script here. 🙂 Originally written by Edwardino, but with a few improvements. See the top comments "CHANGES" in the code for main features.

    HOW TO USE:
    Have the equal desired amount of Cosmic Runes in your inventory & the equal amount of the items you need enchanting in your bank before starting the script.

    * Change these lines to match the object being enchanted & the enchanted item:
      public String itemToBeEnchanted = "Emerald amulet";
      public String enchantedItem = "Amulet of defence";

    * Change this method to establish which enchantment level you're working with:
    public void CAST_ENCHANT() {
         Time.sleep(500, 100, () -> myMagicBook().cast(Spell.Modern.LEVEL_2_ENCHANT)); // Example: Spell.Modern.LEVEL_3_ENCHANMENT for Lv-3 Enchant
    }

    CODE:

    import com.epicbot.api.shared.GameType;
    import com.epicbot.api.shared.entity.ItemWidget;
    import com.epicbot.api.shared.methods.*;
    import com.epicbot.api.shared.model.Spell;
    import com.epicbot.api.shared.script.LoopScript;
    import com.epicbot.api.shared.script.ScriptManifest;
    import com.epicbot.api.shared.util.time.Time;
    
    
    @ScriptManifest(name = "Improved Enchanter by Zynava", gameType = GameType.OS)
    public class ImprovedEnchanter extends LoopScript {
    
        /**
         *
         * THIS BOT IS BUILT FOR ENCHANTING LV-1 - LV-4
         * However... While it doesn't track the other runes for higher level enchantments, it will still work if you have them.
         * 
         * CREDITS:
         *      Original script author -> Edwardino
         *      Improvement author -> Zynava
         *
         * CHANGES:
         *      - Improved readability of code
         *      - Easy-to-alter items being enchanted via script
         *          * See 'itemToBeEnchanted', 'enchantedItem' & 'CAST_ENCHANT()' below
         *      - Grouped relevant methods together, labeled.
         *      - Added sleep methods to reduce the amount of buggy clicks
         **/
    
        // CHANGE THESE TO WHATEVER YOU'RE WORKING WITH
        public String itemToBeEnchanted = "Emerald amulet";
        public String enchantedItem = "Amulet of defence";
        public String COSMIC_RUNES = "Cosmic rune";
        public void CAST_ENCHANT() {
            Time.sleep(500, 100, () -> myMagicBook().cast(Spell.Modern.LEVEL_2_ENCHANT));
        }
    
        // BEGIN METHODS FOR NESTED REFERENCES
        public IClientAPI myClient() {return getAPIContext().client();}
        public IBankAPI myBank() {return getAPIContext().bank();}
        public IInventoryAPI myInventory() {return getAPIContext().inventory();}
        public IMagicAPI myMagicBook() {return getAPIContext().magic();}
        public IGameAPI myGame() {return getAPIContext().game();}
        public IScriptAPI myScript() {return getAPIContext().script();}
        // END METHODS FOR NESTED REFERENCES
    
        /**********************************************************
         *********************BANKING METHODS**********************
         **********************************************************/
        // Do I need to bank? (Checks for necessary supplies in inventory)
        public boolean botNeedsToBank() {
            boolean doesHaveSupplies = !myInventory().contains(COSMIC_RUNES) || !myInventory().contains(itemToBeEnchanted);
            return doesHaveSupplies;
        }
        // Do I need to OPEN the bank?
        public boolean needsToOpenBank() {
            return !myBank().isOpen();
        }
        // Open the bank
        public void openBank() {
            System.out.println("Opening bank.");
            myBank().open();
        }
        // Close the bank
        public void closeBank() {
            System.out.println("Closing bank.");
            myBank().close();
        }
        // Do I need to deposit?
        public boolean shouldDeposit() {
            return myInventory().getCount(enchantedItem) > 0;
        }
        // Deposit all items except runes
        public void depositEnchantedItems() {
            System.out.println("Depositing enchanted items.");
            myBank().depositAll(enchantedItem);
        }
        // Can withdraw more of the item I'm enchanting?
        public boolean shouldWithdraw() {
            return myInventory().getCount(itemToBeEnchanted) == 0 && myBank().getCount(itemToBeEnchanted) > 0;
        }
        // Withdraw items
        public void withdrawItems() {
            System.out.println("Withdrawing items to be enchanted.");
            myBank().withdraw(27, itemToBeEnchanted);
        }
    
        /**********************************************************
         *********************ENCHANTING METHODS*******************
         **********************************************************/
        // Should I begin enchanting?
        public boolean shouldEnchant() {
            boolean hasSupplies = myInventory().contains(itemToBeEnchanted) && myInventory().contains(COSMIC_RUNES);
            return hasSupplies;
        }
    
        // Begin enchanting
        public void enchantItem() {
            System.out.println("Enchanting...");
    
            CAST_ENCHANT();
    
            ItemWidget item = myInventory().getItem(itemToBeEnchanted);
            if(item != null) {
                item.interact();
                Time.sleep(1000);
            }
        }
    
        @Override
        public boolean onStart(String... strings) {
            System.out.print("Starting Improved Enchanter script...");
            return true;
        }
    
        @Override
        protected int loop() {
            if(!myClient().isLoggedIn()) {
                System.out.println("Please wait until you are logged in.");
            }
    
            // First checks supplies & if bank needs to be opened
            if(botNeedsToBank() && needsToOpenBank()) {
                openBank();
            }
    
            // If bank is open:
            //      Deposits and/or Withdraws as needed
            //      Closes bank after
            // If there's no more to withdraw
            //      Close bank, logout, end script
            if(myBank().isOpen()) {
                if(shouldDeposit()) {
                    depositEnchantedItems();
                }
    
                if(shouldWithdraw()) {
                    withdrawItems();
                    closeBank();
                    Time.sleep(1000);
                } else {
                    closeBank();
                    myGame().logout();
                    Time.sleep(800);
                    myScript().stop("Script stopping...");
                }
            }
    
            // Enchants if there's items needing to be enchanted
            if(shouldEnchant()) {
                enchantItem();
            }
            return 200;
        }
    }
    • Like 2
×
×
  • Create New...