poweruser321 Posted June 18, 2016 Share Posted June 18, 2016 I was wondering if there is a way to perform actions (specifically drinking a potion) while walking? can it be done with webwalk() or is another walking method required (if possible at all)? Quote Link to comment Share on other sites More sharing options...
GaetanoH Posted June 18, 2016 Share Posted June 18, 2016 if(myPlayer().isMoving()){ //code } 1 Quote Link to comment Share on other sites More sharing options...
poweruser321 Posted June 18, 2016 Author Share Posted June 18, 2016 (edited) if(myPlayer().isMoving()){ //code } Thanks for the reply! but how do i use that with getWalking().webWalk()? I know I can't just stick it after getWalking().webWalk(destination) because it won't get read until after the walking is over. Sorry if this is a stupid question :I Edited June 18, 2016 by poweruser321 Quote Link to comment Share on other sites More sharing options...
GaetanoH Posted June 18, 2016 Share Posted June 18, 2016 (edited) Thanks for the reply! but how do i use that with getWalking().webWalk()? I know I can't just stick it after getWalking().webWalk(destination) because it won't get read until after the walking is over. Sorry if this is a stupid question :I if(myPlayer().isMoving()){ // code to do while walking } else { getWalking().webwalk(position); } Edited June 19, 2016 by GaetanoH Quote Link to comment Share on other sites More sharing options...
poweruser321 Posted June 19, 2016 Author Share Posted June 19, 2016 if(myPlayer().isWalking()){ // code to do while walking } else { getWalking().webwalk(position); } From my understanding of this code, I don't think you're understanding quite what i want to do. I want to drink potions while walking to the destination. My question still remains, how do i check if im moving (or do ANYTHING) while my player is moving towards his destination with webwalk? Quote Link to comment Share on other sites More sharing options...
Twin Posted June 19, 2016 Share Posted June 19, 2016 (edited) From my understanding of this code, I don't think you're understanding quite what i want to do. I want to drink potions while walking to the destination. My question still remains, how do i check if im moving (or do ANYTHING) while my player is moving towards his destination with webwalk? Just do an area check. if(!DESTINATION_AREA.contains(myPlayer()&&myPlayer().isMoving()) { //whatever you need } So as long as you're not in the destination area, you'll drink potions. Then you need some sort of timer or message listener so you don't spam drink potions. Hopefully this is what you needed. Edited June 19, 2016 by Twin Quote Link to comment Share on other sites More sharing options...
GaetanoH Posted June 19, 2016 Share Posted June 19, 2016 From my understanding of this code, I don't think you're understanding quite what i want to do. I want to drink potions while walking to the destination. My question still remains, how do i check if im moving (or do ANYTHING) while my player is moving towards his destination with webwalk? As far as I know this is going to do some code when it's walking/ moving and will walk when it's not walking so I don't get you man :p Quote Link to comment Share on other sites More sharing options...
Woody Posted June 19, 2016 Share Posted June 19, 2016 From my understanding of this code, I don't think you're understanding quite what i want to do. I want to drink potions while walking to the destination. My question still remains, how do i check if im moving (or do ANYTHING) while my player is moving towards his destination with webwalk? Pseudo code: walk to area conditional sleep till player is moving if player is moving && is not potted drink potions Quote Link to comment Share on other sites More sharing options...
poweruser321 Posted June 19, 2016 Author Share Posted June 19, 2016 (edited) As far as I know this is going to do some code when it's walking/ moving and will walk when it's not walking so I don't get you man :p Just do an area check. if(!DESTINATION_AREA.contains(myPlayer()&&myPlayer().isMoving()) { //whatever you need } So as long as you're not in the destination area, you'll drink potions. Then you need some sort of timer or message listener so you don't spam drink potions. Hopefully this is what you needed. alright i must be too retarded to code. How can i even run the if statement while walking? everytime i use webWalk, it stops reading code until it reaches its destination. am i making sense or should i just uninstall my IDE? Pseudo code: walk to area conditional sleep till player is moving if player is moving && is not potted drink potions I still can't run any code/checks while walking. for example getWalking().webWalk(shop); new ConditionalSleep(2500, 100) { @Override public boolean condition() throws InterruptedException { return myPlayer().isMoving(); } }.sleep(); if(getInventory().contains(DSTAMINA_ID)){ getInventory().getItem(DSTAMINA_ID).interact("Drop"); Script.sleep(Script.random(600, 800)); log("vial dropped"); }else{log("nothing to drop");} will only read past the webwalking line once the player is already completely finished walking. is this making any sense or am i actually retarded? Edited June 19, 2016 by poweruser321 Quote Link to comment Share on other sites More sharing options...
Woody Posted June 19, 2016 Share Posted June 19, 2016 alright i must be too retarded to code. How can i even run the if statement while walking? everytime i use webWalk, it stops reading code until it reaches its destination. am i making sense or should i just uninstall my IDE? I still can't run any code/checks while walking. for example getWalking().webWalk(shop); new ConditionalSleep(2500, 100) { @Override public boolean condition() throws InterruptedException { return myPlayer().isMoving(); } }.sleep(); if(getInventory().contains(DSTAMINA_ID)){ getInventory().getItem(DSTAMINA_ID).interact("Drop"); Script.sleep(Script.random(600, 800)); log("vial dropped"); }else{log("nothing to drop");} will only read past the webwalking line once the player is already completely finished walking. is this making any sense or am i actually retarded? No, you're not retarded. It will walk until it reaches the final destination. However, you could make a condition for when to walk to next position and you'll be able to control what to do while the player is walking. if player is not moving || distance between player and current destination < 6 webwalk to position else do pot stuff Quote Link to comment Share on other sites More sharing options...
poweruser321 Posted June 19, 2016 Author Share Posted June 19, 2016 No, you're not retarded. It will walk until it reaches the final destination. However, you could make a condition for when to walk to next position and you'll be able to control what to do while the player is walking. if player is not moving || distance between player and current destination < 6 webwalk to position else do pot stuff From my understanding of what youre saying it seems ill have to break up the path into sections instead of just telling it to walk to a single area. I feel like this will check to see if im moving/far enough away, then walk to the final destination. I dont see how i can run any code between when it starts and ends the webwalking to position. The "if condition" if only checked once, before the "webwalk to position." Then once the webwalking starts it will continue until the end. im still not seeing how this solves the problem of " It will walk until it reaches the final destination. " Sorry if this is dumb but i cant tell you how shitty i feel that i cant get any of the 3 responses to this thread to work. I thought the question was clear so I just feel completely inept right now Quote Link to comment Share on other sites More sharing options...
anderiel Posted June 19, 2016 Share Posted June 19, 2016 (edited) I dont get how so many people did not understand what you want to do. What you are looking for is the webwalking event. I'm not too familiar with their use, but i think you need to create your own, override the execute method (do your drinking there and then return super.execute()) and then use script.execute() to run it. Code could look like this (did not test it though): WebWalkEvent event = new WebWalkEvent(routeFinder, position){ @Override public int execute() { // do your drinking logic here return super.execute(); } }); script.execute(event); Edited June 19, 2016 by anderiel 1 Quote Link to comment Share on other sites More sharing options...
poweruser321 Posted June 19, 2016 Author Share Posted June 19, 2016 I dont get how so many people did not understand what you want to do. What you are looking for is the webwalking event. I'm not too familiar with their use, but i think you need to create your own, override the execute method (do your drinking there and then return super.execute()) and then use script.execute() to run it. Code could look like this (did not test it though): WebWalkEvent event = new WebWalkEvent(routeFinder, position){ @Override public int execute() { // do your drinking logic here return super.execute(); } }); script.execute(event); Thanks for the response! much appreciated. this looks like the kind of thing i was looking for, ill mess around with it later today when i have time and report back Quote Link to comment Share on other sites More sharing options...
Twin Posted June 19, 2016 Share Posted June 19, 2016 alright i must be too retarded to code. How can i even run the if statement while walking? everytime i use webWalk, it stops reading code until it reaches its destination. am i making sense or should i just uninstall my IDE? I still can't run any code/checks while walking. for example getWalking().webWalk(shop); new ConditionalSleep(2500, 100) { @Override public boolean condition() throws InterruptedException { return myPlayer().isMoving(); } }.sleep(); if(getInventory().contains(DSTAMINA_ID)){ getInventory().getItem(DSTAMINA_ID).interact("Drop"); Script.sleep(Script.random(600, 800)); log("vial dropped"); }else{log("nothing to drop");} will only read past the webwalking line once the player is already completely finished walking. is this making any sense or am i actually retarded? I thought they made webwalking check for conditions? I haven't used anything where I would need to do that, so I haven't really tested it. Maybe I misread something when webwalking was released, so sorry about that. Quote Link to comment Share on other sites More sharing options...
Explv Posted June 24, 2016 Share Posted June 24, 2016 I was wondering if there is a way to perform actions (specifically drinking a potion) while walking? can it be done with webwalk() or is another walking method required (if possible at all)? I thought they made webwalking check for conditions? I haven't used anything where I would need to do that, so I haven't really tested it. Maybe I misread something when webwalking was released, so sorry about that. What you need to do is to create your own WebWalkEvent and set a break condition so that it will stop executing the walking code when you need to drink a potion: final WebWalkEvent webWalkEvent = new WebWalkEvent(area); webWalkEvent.setBreakCondition(new Condition() { @Override public boolean evaluate() { return needToDrinkPotion(); } }); execute(webWalkEvent); 3 Quote Link to comment Share on other sites More sharing options...