-
Posts
52 -
Joined
-
Last visited
-
Feedback
0%
Everything posted by slazter
-
If only banned once i think it's okay, i was banned on one of my accounts for boting, keept boting on the other account, but just started to avoid doing it for more than 6h+ aswell as between 01-07 am. Same scripts, but this account haven't got banned yet. Just my personal experiences
-
Have u tried making a walking event and set the threshold? Position groundItemPosition = new Position(cords); WalkingEvent walkingEvent = new WalkingEvent(groundItemPosition); walkingEvent.setMinDistanceThreshold(0); execute(walkingEvent); this walks to that exakt tile, else you could do what i did with my questingScript, when webwalkign wanted to take shortcut to the farmer and ended up in the Sheep pen, i made 3 separate areas, and made it go to first, second and then third. (Not sure if this is good practice though) u could probably also (not 100% sure) use webwalkingevent and use a pathPreferenceProfile, to make sure it takes your desired path
-
solved
-
- filtering
- conditional sleep
-
(and 1 more)
Tagged with:
-
Ohh, wow didn't even knew i actually created a new variable each time the method was called, guess this is going to save alot of memory down the lane when creating bigger scripts! Thanks alot! And yeh im gonna take you up on that skype deal for sure! gimme hell This is really a goldmine of info! As a new coder i can't thank you enough for all this input, this is really really great!! I can't really comment on each of your suggestions as of yet, as im gonna rewrite the entire script with your inputs in mind ASAP, and i think i have to work through each of your given concepts to fully understand on how to implement it before i can ask further. I'll start working on this ASAP and i'll post updates if i get stuck, and an updated version of the script in case i don't to see if i understood what was said correctly Okay great, something new learnt! I thought that the script would automaticly take care of that since i nest everything inside of a if(!Inventory.contains(qitems)), that i thought would reloop if it didn't take those items out correctly, But since everyone of you pointed it out, it seems to be the right choice, point taken! Thanks guys! I'm gonna start reworking the script ASAP and post an update when im done or stuck.
-
Okay so i've been coding for not that long, mabye 2-3 weeks, but i see alot of really good coders around here, and what i can tell is that the better coder you are, the bigger the toolset of your coding. So the last few days i've been trying to improve my coding with making a questing script, which both improved my understanding of whenever to make a method for repeating task, passing arguments, aswell as overloading methods. However when i look at other scripters i se that the really good ones use lambdas when it's suitable, and i want to be able to do that aswell, as it makes for really smooth code and seem easier to manage. I've understood some parts of it, as on how to make a Lambda, and by that i mean making a functional interface that the Lambda can implement use as a type, aswell as on how to write it's syntax. What i've not fully grasped is how to use it in the context of my own scripts.. So what i really would like input on is, do you se any feature that i could extract further or improve? 1)Is there any code i should try to make a method of instead? 2)is there some code i should put in a superclass or interface? (Any input on why, and when that is suitable would also be super helpful) 3)Is there some part i can turn into a Lamda statement? I'm personally thinking of the dialogueV2 parts, but not quite sure on how to.. this is would really really make me happy if someone could provide help on 4)My main questing script is atm 630 lines, and involves 8-9 quests, I intend to script pretty much every quest(which is going to make it really big if i keep it up this way) , so should i try to like make some kind of superclass, and make the subquests children? or mabye some other smart solution? 5) If yes on number 4, would it make sense to make an abstract class, and mabye have dialoguehandling, and dialoguehandlingV2, in there as concrete methods, so i could just make an object of that class to implement them without really cluttering up to much of my code? 6) So i have a class called "Platser" where i save many areas or positions around runescape, however i read that when u create an object, the constructor makes space for the object on the heap for that object based on the constructor, does that mean it's bad practice for me to make a new object to call my spots more easily (cause the object have to store all the diffrent spots?) rather then just making them method variables, to save memory? 7) Any other coder out there that want to talk on skype with me to exchange ideas, if so feel free to add me on skype: Slazter My code to give input on: import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.Item; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import static org.osbot.rs07.api.Quests.Quest.THE_KNIGHTS_SWORD; @ScriptManifest(author = "slazter", name = "Knights Sword f2p q", info = "Does Knights sword if u have all items", version = 0.1, logo = "") public final class KnightsSword extends Script { @Override public final int onLoop() throws InterruptedException { if(canKnight()){ questKnightsSword(); } return (random(150,250)); } //Method for dialoguehandling when not needing to give extra input public void dialogueHandling() throws InterruptedException { String[] options = {""}; if (dialogues.isPendingContinuation()) { dialogues.clickContinue(); } else if (dialogues.isPendingOption()) { dialogues.completeDialogue(options); } } //method for when i want to supply the talking options, public void dialogueHandling(String[] opt) throws InterruptedException { String[] options = opt; if (dialogues.isPendingContinuation()) { dialogues.clickContinue(); } else if (dialogues.isPendingOption()) { dialogues.completeDialogue(options); } } //method for making it easier to select npc - default dialogue options public void dialogueV2(NPC name) throws InterruptedException { NPC qNpc; qNpc = name; if (Tab.INVENTORY.isDisabled(this.getBot())) { Sleep.sleepUntil(() -> !Tab.INVENTORY.isDisabled(this.getBot()), 15000); } else if (!dialogues.inDialogue()) { qNpc.interact("Talk-to"); Sleep.sleepUntil(() -> dialogues.inDialogue(), 5000); } else if (dialogues.inDialogue()) { dialogueHandling(); } } //method for making it easier to select npc - With supplied talk options public void dialogueV2(NPC name, String[] opts) throws InterruptedException { NPC qNpc; qNpc = name; String[] options = opts; if (Tab.INVENTORY.isDisabled(this.getBot())) { Sleep.sleepUntil(() -> !Tab.INVENTORY.isDisabled(this.getBot()), 15000); } else if (!dialogues.inDialogue()) { qNpc.interact("Talk-to"); Sleep.sleepUntil(() -> dialogues.inDialogue(), 5000); } else if (dialogues.inDialogue()) { dialogueHandling(options); } } //bolean to see if quest isn't done public boolean canKnight() { if (!quests.isComplete(THE_KNIGHTS_SWORD)) { return true; } else return false; } //the main quest method public void questKnightsSword() throws InterruptedException { String[] val = {"Something else.","Would you like some redberry pie?"}; RS2Object bluerite = getObjects().closest(7495); NPC squire = getNpcs().closest("Squire"); NPC thurgo = getNpcs().closest("Thurgo"); NPC reldo = getNpcs().closest("Reldo"); String[] qItems = {"Iron bar", "Redberry pie"}; Area squire_spot = new Area(2980, 3339, 2975, 3344); Area thurgo_spot = new Area(3001, 3143, 2995, 3146); Area reldo_spot = new Area(3213, 3490, 3207, 3497); Filter<Item> pickaxe = new Filter<Item>() { @Override public boolean match(Item item) { return item.getName().contains("pickaxe"); } }; //withdraw q items if not in inv if (!inventory.contains(qItems) && configs.isSet(122,0)) { if (!getBank().isOpen()) { getWalking().webWalk(Banks.FALADOR_WEST); getBank().open(); } else if (getBank().isOpen()) { getBank().withdraw("Iron bar", 2); getBank().withdraw("Redberry pie", 1); getBank().withdraw(pickaxe, 1); } } else if (configs.isSet(122,0)) { if (squire != null) { dialogueV2(squire); } else getWalking().webWalk(squire_spot); } else if (getConfigs().isSet(122,1)) { if(reldo!=null){ if(!dialogues.inDialogue()){ reldo.interact("Talk-to"); sleep(random(1200,1800)); } else if(dialogues.inDialogue()){ if(dialogues.isPendingContinuation()){ dialogues.clickContinue(); } else if(dialogues.isPendingOption()){ String[] options = {"What do you know about the Imcando dwarves?"}; dialogues.completeDialogue(options); } } } else getWalking().webWalk(reldo_spot); } else if(configs.isSet(122,2)){ String[] opts = {"Something else.","Would you like some redberry pie?"}; if(thurgo!=null){ dialogueV2(thurgo,opts); } else getWalking().webWalk(thurgo_spot); } else if(configs.isSet(122,3)){ String[] opts = {"Something else."}; if(thurgo!=null){ dialogueV2(thurgo,opts); } } else if(configs.isSet(122,4)){ if(squire!=null){ dialogueV2(squire); } else getWalking().webWalk(squire_spot); } else if(configs.isSet(122,5)){ String[] food = {"Trout"}; RS2Object cup = getObjects().closest("Cupboard"); if(inventory.contains("Portrait")) { //get food before getting near ice warriors if(!inventory.contains(food)){ if (!getBank().isOpen()){ getWalking().webWalk(Banks.FALADOR_EAST); getBank().open(); } else if(getBank().isOpen()) { getBank().withdraw("Trout", 4); getBank().close(); } } else if(thurgo!=null){ dialogueV2(thurgo,val); } else getWalking().webWalk(thurgo_spot); } else if(cup!=null && getMap().canReach(cup)){ if(getDialogues().isPendingContinuation()){ dialogues.clickContinue(); } cup.interact("Open"); sleep(random(1500,2100)); cup.interact("Search"); } else getWalking().webWalk(new Position(2984,3335,2)); } else if(configs.isSet(122,6)){ if(inventory.contains("Blurite sword")){ if(squire!=null){ dialogueV2(squire); } else getWalking().webWalk(squire_spot); } else if(!inventory.contains("Blurite ore")){ if(bluerite!=null && !myPlayer().isAnimating()){ bluerite.interact("Mine"); Sleep.sleepUntil(()-> myPlayer().isAnimating(),5000); } else getWalking().webWalk(new Position(3049,9567,0)); } else if(thurgo!=null) { dialogueV2(thurgo,val); } else getWalking().webWalk(thurgo_spot); } } }
-
This came to my mind, mabye something to try.
-
Worked like a charm! Many thanks to you!
-
Hello guys, so im fairly new to scripting but think im starting to get a hang of it, So anyways i fucking hate questing so i figured i'd make a script for questing so i don't have to do them manually, aswell as have some fun doing them. Anyways when coding the Witch's potion i ran into some trouble, Here's the problem: I want my character to talk to Hetty to start the quest - Because you can't get the Rat's tail before the quest is started. So i figured i'd go to the api and use the, Quests.isStarted. But it didn't work, whenever i tryed to call if(getQuests.isStarted(WITCHS_POTION) so i went to the api, and the description says exactly thesame for both IsComplete, and IsStarted. isComplete public boolean isComplete(Quests.Quest quest) Returns: False if the quest was not complete or there was an issue caching. isStarted public boolean isStarted(Quests.Quest quest) Returns: False if the quest was not complete or there was an issue caching. Therefore i don't really know how to check if the quest is marked yellow so i can go for the rat's tail. So any ideas on how to fix this? My code: import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.api.model.Item; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import static org.osbot.rs07.api.Quests.Quest.WITCHS_POTION; @ScriptManifest(author = "Slazter", name = "An Example Script", info = "Teamplate", version = 0.1, logo = "") public final class OsBotFråga extends Script { @Override public final int onLoop() throws InterruptedException { if(canWitch()){ questWitchPotion(); } return 150; } public boolean canWitch(){ if (!quests.isComplete(WITCHS_POTION)) { return true; } else return false; } public void questWitchPotion() throws InterruptedException { NPC witch = getNpcs().closest("Hetty"); Platser plat = new Platser(); NPC rat = getNpcs().closest("Rat"); RS2Object range = getObjects().closest("Range"); RS2Object cauldron = getObjects().closest(2024); String[] startitems = {"Onion","Eye of newt"}; String[] allQItems = {"Onion","Eye of newt","Burnt meat","Rat's tail"}; GroundItem tail = getGroundItems().closest("Rat's tail"); Filter<Item> meat = new Filter<Item>() { @Override public boolean match(Item item) { return item.getName().contains("meat"); } }; if(!inventory.contains(startitems)){ if(cauldron!=null && plat.witchs_potion.contains(myPosition())){ if(!dialogues.inDialogue()){ cauldron.interact("Drink From"); sleep(random(1200,1800)); } else if(dialogues.inDialogue()){ dialogueHandling(); } } else if (!getBank().isOpen()) { getWalking().webWalk(Banks.DRAYNOR); getBank().open(); } else { getBank().depositAll(); getBank().withdraw("Onion",1); getBank().withdraw("Eye of newt", 1); getBank().withdraw(meat,1); } } //Start quest else if(inventory.contains(startitems)){ //start quest if(!getQuests().isStarted(WITCHS_POTION) && !witch.isVisible()){ // Won't work getWalking().webWalk(plat.witchs_potion); } else if(witch!=null && !dialogues.inDialogue()){ witch.interact("Talk-to"); sleep(random(1200,1800)); } else if(dialogues.inDialogue()){ dialogueHandling(); } //get Rat's tail else if(!inventory.contains("Rat's tail")){ getWalking().webWalk(new Position(2957,3204,0)); rat.interact("Attack"); Sleep.sleepUntil(()-> rat.getHealthPercent()==0 || tail!=null,5000); if(tail!=null){ tail.interact("Take"); Sleep.sleepUntil(()-> !tail.isVisible(),5000); } // Cook the meat } else if(!inventory.contains("Burnt meat")){ getWalking().webWalk(new Position(2969,3210,0)); getInventory().getItem(meat).interact("Use"); sleep(random(1250,1900)); range.interact("Use"); Sleep.sleepUntil(()-> !myPlayer().isAnimating(),5000); //walk back to witch } else if(getInventory().contains(allQItems) && !witch.isVisible()){ getWalking().webWalk(plat.witchs_potion); //talk to witch } else if(witch!=null && getMap().canReach(witch) && !getDialogues().inDialogue()){ witch.interact("Talk-to"); Sleep.sleepUntil(()-> getDialogues().inDialogue(),5000); } else if(getDialogues().inDialogue()){ dialogueHandling(); } } } public void dialogueHandling() throws InterruptedException { String[] options = {""}; if(dialogues.isPendingContinuation()){ dialogues.clickContinue(); } else if(dialogues.isPendingOption()){ dialogues.completeDialogue(options); } } } Also if anyone have any feedback for me on how to improve my coding, i'd be super happy for any input
-
In gonna go ahed and say your probaby getting stuck in an infinute loop and that is why it crashes. Mabye like if(myplayer.gethealth()<30){ //eAT flod } And inv doesnt contain food, therefore ur stuck in a infinite loop making it crash. Had The same problems starting to script, tryck to check your conditions
-
Hmm wouldn't it be smarter to keep it at == 51, and instead throw in an else loop for >51, to eat on the dwarven rock cake, until 51.
-
stun alched with ahk on zogres in ardouge from 80-94 magic... No ban and then i used fixed mouse position, like: send {f3} sleep 300 mousemove 580, 264 R sleep 25 click etc
-
Not quite sure if this is the right answer, but if i recall i had the same problem and it had something to do with installing the 32bit instead of the 64bit version.
-
Interacting with an array of strings instead of a string
slazter replied to vaynex's topic in Scripting Help
Okay so im fairly new to coding, been reading through both your, Apaec's guide aswell as many support questions here and been chewing through Head first java. I've been writing 5-6 fairly simple scripts, although been trying to make them more advanced each time. Even have your answer on the states vs task thread bookmarked, you seem to understand alot about Java, would you care to explain to a fairly new coder why this isn't the correct way/ most optimal? and what could be done instead? -
I stun alched on the zogre in ardougne zoo, 100kxp/h+, alched rune arrows, since my bank was small and u don't really lose that much money on rune arrows, soul runes are cheap as hell aswell. And for afking, you can just bot it i guess? I myself used ahk, zoomed in and set relative mouse coordinates to zogre position, and went to town.. the map do eventually move slightly so your gonna have to readjust sometimes, and i would suggest using some Osbot script with java, unless you know how to use pixelsearch with AHK. and yeh imo this whole ahk is bannable is bs.. been ahking forever and never got a been over it.
-
Hmm trying to read up on this... How far in Java learning should i be to start using, task based scripts? Intermediate? This is kinda the same thing as a Node system right?
-
Agility is pretty much the only skill i really don't want to train myself, and since im gonna bot 1-80, i might aswell purchase a script for it, may i therefore have a trial please to test yours out?