-
Posts
21 -
Joined
-
Last visited
-
Feedback
0%
Profile Information
-
Gender
Female
Psychotechno's Achievements
Bronze Poster (2/10)
1
Reputation
-
I thank you!
-
May I asked how you did this?
-
Difference between getGrandExchange and GrandExchange?
Psychotechno posted a topic in Scripting Help
Noob question incoming When programming my bot to interact with the grand Exchange, I noticed that some snippets use the getGrandExchange() method in the MethodProvider, for example: getGrandExchange().isOpen() And sometimes people don't use the MethodProvider, so they use GrandExchange class directly, like so: if (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.PENDING_BUY) { status = "Pending offer"; }else if (grandExchange.getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.FINISHED_BUY) { status = "Offer completed - Collecting"; } What is the difference between the two? The same applies with Inventory class & getInventory(), Bank class & getBank() etc.... I guess this question could be phrased more generally: What is the difference between using methodProvider get-functions or interacting with the classes directly? -
Hey fellow scripters! I'm a bit new to OSbot scripting, and I've been searching in the forums on how to best interact with the GE. I found a few API's/snippets. Is there a go-to/defacto best way to interact with the GE? Or do all these snippets/API's have their merits? And what do you guys recommend? I simply need to sell some items I botted at market price. Kindest regards, psycho
-
Is it possible to disable running when using WebWalkEvent?
Psychotechno replied to Colon Nel's topic in Scripting Help
Whooooops, my bad: WebWalkEvent dungeonWalk = new WebWalkEvent(DUNGEON); dungeonWalk.setEnergyThreshold(101); execute(dungeonWalk); It doesn't turn on run at first, but after two clicks in the minimap it does turn on run again (Even though energy is much lower than 100%, ideally I don't want to turn it on at all during the WebWalk). -
Is it possible to disable running when using WebWalkEvent?
Psychotechno replied to Colon Nel's topic in Scripting Help
This doesn't work for me.... When I put in something like this: WebWalkEvent dungeonWalk = new WebWalkEvent(DUNGEON); dungeonWalk.setEnergyThreshold(; ; "In Desired area"; It still enables run somewhere in the middle of the webwalk. Any help would be appreciated. -
Hey Apa! To address point 3 (I think I've met all the conditions but you never know), I added an else-clause that webwalks the entire way to the destination dungeon. This is a backup after all else fails; so I think it will never be executed but you never know. To address point 5; do you mean that I should initialize the walkpath as a field somewhere (Like i did with for example the variables NEAR_DUNGEON and TELESPOT?) With the comment about instantiating the arraylist, do you mean instantiating it in a oneliner? So simply add the positions to the new ArrayList constructor? Point 6: Any example where I did not do this? Thanks again for all the feedback Script is really improving because of it. ~Pscyho
-
EDIT 4: Got it! Does take a lot of checks though, since I am basically walking in three blocks I need to check a lot of conditions, for the bot to know in which "Section" it currently is. Could maybe simplify somehow but at the moment I don't see how haha. Only posted walker function since onloop did not change. I think readers can skip edit 1, 2 and 3 and refer to this block, as this is the final version... Sorry for the SPAM haha kept getting new ideas just after my edits . private void dungeonWalker() { //Player is not near teleport spotm not on it's way to dungeon, and not already in dungeon so walk to telespot. if(!TELESPOT.contains(myPosition()) && !NEAR_DUNGEON.contains(myPosition()) && myPlayer().getY() < 9700){ getWalking().webWalk(TELESPOT); Sleep.sleepUntil(() -> myPlayer().isMoving(), random(2500, 3500)); log("Webwalker finished"); //Player is not near dungeon and at telespot (Because of previous if) so Walk near dungeon. }else if(TELESPOT.contains(myPosition()) && !NEAR_DUNGEON.contains(myPosition())){ List<Position> telespot_neardungeon = new ArrayList<>(); telespot_neardungeon.add(new Position(3086, 3488, 0)); telespot_neardungeon.add(new Position(3093, 3479, 0)); telespot_neardungeon.add(new Position(3094, 3470, 0)); getWalking().walkPath(telespot_neardungeon); Sleep.sleepUntil(() -> myPlayer().isMoving(), random(2500, 3500)); log("Near Dungeon"); //Player is near dungeon but not yet in desired area, so webWalk the rest of the route }else if(NEAR_DUNGEON.contains(myPosition()) && !DUNGEON.contains(myPosition())){ getWalking().webWalk(DUNGEON); Sleep.sleepUntil(() -> myPlayer().isMoving(), random(2500, 3500)); log("In desired Area"); } //Player is in dungeon but not yet in desired area (Maybe cuz webwalk broke in previous onLoop), so webWalk the rest of the route else if (myPosition().getY() > 9700){ //Player is in dungeon, so continue webwalk. getWalking().webWalk(DUNGEON); Sleep.sleepUntil(() -> myPlayer().isMoving(), random(2500, 3500)); log("In desired Area"); } }
-
-
I thought about using walkPath's, But ended up using WalkingEvents because there I can set the setMinDistanceThreshold(1); for some added randomization. If I were to use walkPaths; the both would walk the same path time after time which I believe is very bot-like. Trying to randomize the script as much as possible. Will PM you once done!! EDIT1: This is a better try, but I'm still not sure if it's perfect; @Override public int onLoop() throws InterruptedException { dungeonWalker(); log("One iteration of onLoop finished"); return random(350, 550); } private void dungeonWalker() { //Player is not near teleport spot and not on it's way to dungeon, so Webwalk to telespot if(!TELESPOT.contains(myPosition()) && !NEAR_DUNGEON.contains(myPosition())){ getWalking().webWalk(TELESPOT); Sleep.sleepUntil(() -> myPlayer().isMoving(), random(2500, 3500)); log("Webwalker finished"); //Player is not near dungeon and at telespot (Because of previous if) so Walk near dungeon. }else if(!NEAR_DUNGEON.contains(myPosition())){ //Can executing a walkPath be seen as a "Single game interaction?" //If not, how do i build "in between" checks as the walkPath is a single function call? List<Position> telespot_neardungeon = new ArrayList<>(); telespot_neardungeon.add(new Position(3086, 3488, 0)); telespot_neardungeon.add(new Position(3093, 3479, 0)); telespot_neardungeon.add(new Position(3094, 3470, 0)); getWalking().walkPath(telespot_neardungeon); Sleep.sleepUntil(() -> myPlayer().isMoving(), random(2500, 3500)); log("Near Dungeon"); //Player should be near dungeon because of previous block }else if(!DUNGEON.contains(myPosition())){ //Same holds for walkPath. Say WalkPath fails and onLoop executes again. In that case the previous if block //else if(!NEAR_DUNGEON.contains(myPosition())) will execute because my player is not near the dungeon anymore but further along the road, //And script will get stuck. getWalking().webWalk(DUNGEON); Sleep.sleepUntil(() -> myPlayer().isMoving(), random(2500, 3500)); log("In desired area"); stop(true); } }
-
I can affirm that this happens; bot seems a bit buggy. When I run varrock (& Draynor) rooftop sometimes the bot does multiple "human idles" (Like 4 or 5) in a row. Eventually it continues, but I don't think this is planned behavior as it slows down the script alot. After some investigation it seems to happen if the bot can't "see" the next obstacle. It does turn the screen in the end, but as mentioned it sometimes take like 4 or 5 "human idle" periods. Hope this helps. If you need any additional info to debug i'd be happy to help!
-
Hey boss - Thanks again for the elaborate response. Really do appreciate it!! Completely get it now. I'm going to rewrite the entire script so I execute exactly one game action per onLoop. Shouldn't be too hard now I get the design paradigm =). One question remains: what about walking paths? For example this function; private void poolWalker() { log("Starting poolWalker"); WalkingEvent ferox_1 = new WalkingEvent(new Position(3148, 3629, 0)); ferox_1.setMinDistanceThreshold(2); execute(ferox_1); Sleep.sleepUntil(() -> myPlayer().isMoving(), random(2500, 3500)); WalkingEvent ferox_2 = new WalkingEvent(new Position(3138, 3629, 0)); ferox_2.setMinDistanceThreshold(2); execute(ferox_2); Sleep.sleepUntil(() -> myPlayer().isMoving(), random(2500, 3500)); WalkingEvent ferox_3 = new WalkingEvent(new Position(3134, 3636, 0)); ferox_3.setMinDistanceThreshold(2); execute(ferox_3); Sleep.sleepUntil(() -> myPlayer().isMoving(), random(2500, 3500)); log("Finished poolWalker"); } How does one check if previous movement was successful?? I could make Areas of each position and see if the player position contains the "previous" area coordinates (So for example; before executing the ferox_3 WalkingEvent check if playerPosition is somewhere in area of ferox_2 coords). But that seems a bit cumbersome...
-
Dear Apa, I'm a bit further along my scripting journey now and managed to implement a working script. Previously you told me that I should be "Executing a single game interaction per iteration of onLoop". I indeed see that a lot else-if constructs are used, to ensure that only one if-statement is executed per onLoop. I did not adhere to this principle, and instead of using else-if's i'm simply using some sequential if's to check. It does work, but I'm not sure my script is "In a state to retry" If a function fails; Take for example my bank function; private void bank() throws InterruptedException { if (!FEROXENCLAVE_TELESPOT.contains(myPosition())) { getEquipment().interact(EquipmentSlot.RING, "Ferox Enclave"); Sleep.sleepUntil(() -> FEROXENCLAVE_TELESPOT.contains(myPosition()), random(2500, 3000)); log("Teleported to Ferox enclave"); } if (!FEROXENCLAVE_POOLS.contains(myPosition())) { poolWalker(); } RS2Object refreshmentPool = getObjects().closest("Pool of Refreshment"); if (refreshmentPool != null) { refreshmentPool.interact("Drink"); Sleep.sleepUntil(() -> myPlayer().isAnimating(), random(2500, 3500)); log("Succesfully drank refreshments... Sweet"); } if (!FEROXENCLAVE_BANK.contains(myPosition())) { bankWalker(); } if (!getBank().isOpen()) { boolean isGloryEmpty = gloryChecker(); boolean isDuelingEmpty = duelingChecker(); getBank().open(); log("Bank was opened"); getBank().depositAll(); log("Stuff was deposited"); getBank().withdraw("Salmon", 3); log("Salmon was withdrawn"); if (gloryChecker()) { getBank().withdraw("Amulet of glory(4)", 1); log("Glory empty, so withdraw a new one"); } if (isDuelingEmpty) { getBank().withdraw("Ring of dueling(8)", 1); log("ROD empty, so withdraw a new one"); } getBank().close(); if (isGloryEmpty) { getInventory().getItem("Amulet of glory(4)").interact("Wear"); log("Equipped new amulet of glory"); getBank().open(); getBank().deposit("Amulet of glory", 1); getBank().close(); } if (isDuelingEmpty) { getInventory().getItem("Ring of dueling(8)").interact("Wear"); log("Equipped new ring of dueling"); } } if (!EDGEVILLE_TELESPOT.contains(myPosition())) { getEquipment().interact(EquipmentSlot.AMULET, "Edgeville"); } } I am doing some checks to see if the script advances, but only with sequential if statements. Now, say for example the poolWalker function fails. Then probably the script will get stuck further along the line, for example when trying to open the bank. Is this why I see so many if-elseif-elseif constructs in people's scripts? Since, if one if evaluates to true in an if-elseif-elseif, the other "if"s won't be executed, and hence the onLoop progresses to the next action? If that's the case I think I finally get what you mean Also, finally; do you ideally want to execute exactly *one* action per onloop iteration? For example, in the code above, I open the bank, deposit, withdraw etc all in one go... Is that bad practice too? Thanks in advance
-
This does not work, the If statement will never get executed because the trapdoor does not have actions "Open" and "Climb-down" at the same time. anyways, thx for the snippet, Will use the .exists() function to check.
-
I've been thinking about what you said about your design pattern, but I'm unsure how to implement such a thing. How can I make sure only one interaction happens per OnLoop execution? Only thing I can think of is to store all my compound actions inside some data structure outside onloop and call them one by one in onLoop, only moving on to the next one when the previous one succeeds. Is that what you mean? Again, appreciate the response =) Thanks