Jump to content

OvCoursee

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by OvCoursee

  1. On 3/11/2022 at 12:09 PM, Koala said:

    Hey - couple issues with this:

    1. If returning false in your onStart, it will exit the script. You couldn't run this from the login screen, as it would immediately exit.

    2. walking is a boolean. You don't need to do walking == false, you can just do !walking

    3. You never want to return -1, as that's the time between loops. You'd just be wasting resources by running nothing as fast as possible.

    4. You never exit the script once it arrives.

    Thanks a lot for the feedback, I am very new to the language so I must get on to learning the essentials, as for these few issues I have fixed them locally, may edit the post soon to show fixes! 😁Thanks again!

  2. WALK TO GRAND EXCHANGE - OV

    I am honestly not sure how well I went with this but I understand it's not too complicated, It was more of a learning project to me and I thought why not release it to see if there's any feedback to come from it. Enjoy!

     

    import com.epicbot.api.shared.script.LoopScript;
    import com.epicbot.api.shared.script.ScriptManifest;
    import com.epicbot.api.shared.APIContext;
    import com.epicbot.api.shared.GameType;
    import com.epicbot.api.shared.util.paint.frame.PaintFrame;
    import com.epicbot.api.shared.webwalking.model.RSBank;
    
    import java.awt.*;
    
    @ScriptManifest(name = "Walk to Grand Exchange", gameType = GameType.OS)
    
    public class Main extends LoopScript {
    
        private boolean walking = false;
    
        @Override
        public boolean onStart(String... strings) {
    
            if (getAPIContext().client().isLoggedIn()) {
    
                return true;
            }
            else {
                return false;
            }
        }
    
        @Override
        protected int loop() {
    
            if (walking == false) {
    
                if (!RSBank.GRAND_EXCHANGE.getTile().getArea().contains(getAPIContext().localPlayer().get().getLocation())) {
                    walking = true;
                    getAPIContext().webWalking().walkToBank(RSBank.GRAND_EXCHANGE);
                    walking = false;
                }
                else {
                    return -1;
                }
    
                return -1;
            }
            return 1000;
        }
    
        @Override
        protected void onPaint(Graphics2D g, APIContext ctx) {
            PaintFrame frame = new PaintFrame("Walk to GE - Ov");
            frame.addLine("Walking: ", walking);
            frame.draw(g, 0, 120, ctx);
        }
    }

     

     

×
×
  • Create New...