Jump to content

gevo

Members
  • Posts

    106
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by gevo

  1. On 5/20/2019 at 2:12 AM, Gunman said:

    You need to null check the net void. It's one line of code and a pair of these {}. If not your script won't work right if == null

    Ok, I'll add those. So that just stops the getNpc method from returning null?

    What would happen if it did return null?

  2. I thought I was missing something, since the code looked like it should be working somewhat.

    Turns out it was just my laptop. I ran it on my PC and it worked with the original code.

     

    Afterwards, I changed the fishing spot ID to a string. I also added a while loop and a sleep timer. So far it seems to be working. 

        //Checks closest fishing spot and clicks it (supposedly)
        private void net() throws InterruptedException {
            while (!myPlayer().isAnimating()) {
                Entity spot = getNpcs().closest("Fishing spot");
                spot.interact("Net");
                MethodProvider.sleep(5000);
            }
        }

    Is there anything wrong with this before I move on to banking etc?

     

    Full code:

    Spoiler
    
    import org.osbot.rs07.api.map.Position;
    import org.osbot.rs07.api.model.Entity;
    import org.osbot.rs07.script.Script;
    import org.osbot.rs07.script.ScriptManifest;
    import org.osbot.rs07.api.map.Area;
    import org.osbot.rs07.api.map.constants.Banks;
    import org.osbot.rs07.api.ui.RS2Widget;
    import org.osbot.rs07.script.MethodProvider;
    import org.osbot.rs07.script.Script;
    import org.osbot.rs07.script.ScriptManifest;
    import org.osbot.rs07.utility.ConditionalSleep;
    import org.osbot.rs07.api.Inventory;
    import java.util.function.BooleanSupplier;
    
    
    @ScriptManifest(author = "Gevo", name = "Fish", info = "idk", version = 0.1, logo = "")
    public final class Fisher extends Script {
        @Override
        public final int onLoop() throws InterruptedException {
            int space = invCount();
            if (space==0) {
                drop();
            }
            else {
                net();
            }
    
            return random(150, 200);
        }
    
        @Override
        public final void onStart() {
            log("Hi?");
        }
    
        //Checks closest fishing spot and clicks it (supposedly)
        private void net() throws InterruptedException {
            while (!myPlayer().isAnimating()) {
                Entity spot = getNpcs().closest("Fishing spot");
                spot.interact("Net");
                MethodProvider.sleep(5000);
            }
        }
    
        //Counts empty slots in inventory
        private int invCount() {
            return     getInventory().getEmptySlotCount();
        }
    
        //drops all shrimps
        private void drop() {
            getInventory().dropAll(317);
        }
    
    }

     

     

  3. Hi, I'm trying to make my first script. It's a fishing script that just catches shrimp and drops them when invy is full.

    Is there something I'm missing here? I stand next to the fishing spot in lumbridge with a fishing net and the bot does nothing.

    Ignore the extra imports I just copy pasted more than I needed.

     

    import org.osbot.rs07.api.map.Position;
    import org.osbot.rs07.api.model.Entity;
    import org.osbot.rs07.script.Script;
    import org.osbot.rs07.script.ScriptManifest;
    import org.osbot.rs07.api.map.Area;
    import org.osbot.rs07.api.map.constants.Banks;
    import org.osbot.rs07.api.ui.RS2Widget;
    import org.osbot.rs07.script.MethodProvider;
    import org.osbot.rs07.script.Script;
    import org.osbot.rs07.script.ScriptManifest;
    import org.osbot.rs07.utility.ConditionalSleep;
    import org.osbot.rs07.api.Inventory;
    import java.util.function.BooleanSupplier;
    
    
    @ScriptManifest(author = "Gevo", name = "Fish", info = "idk", version = 0.1, logo = "")
    public final class Fish extends Script {
        @Override
        public final int onLoop() throws InterruptedException {
            int space = invCount();
            if (space==0) {
                drop();
            }
            else {
                net();
            }
    
            return random(150, 200);
        }
    
        @Override
        public final void onStart() {
            log("Hi?");
        }
    
    //Checks closest fishing spot and clicks it (supposedly)
        private void net() {   
            Entity spot = getNpcs().closest(1530);
            spot.interact("Net");
        }
    
        //Counts empty slots in inventory
        private int invCount() {    
            return     getInventory().getEmptySlotCount();
        }
    
        //drops all shrimps
        private void drop() { 
            getInventory().dropAll(317);
        }
    
    }

     

    Thanks!

    • Like 1
×
×
  • Create New...