-
Posts
251 -
Joined
-
Last visited
-
Feedback
100%
Everything posted by Nbacon
-
Hello HotPoket, I Think its good start. I like the script. As you make more bots your code will get better and you'll learn the Api. Things I see I thinks a bad pratic to do everthing is start. Things like gui , walk to a bank , step up classes and values should go here. A non looping structure. Duplicate code. Things that the api can do but you will learn as you make more bots. Example checkSupplies method. Error in the amount of runes needed I think you need 4 laws not 3. conditionsleep Like what Protoprize said. 1. will be fixed by 2. 2. The best bots in my opinion are ones that have if else tree that clearly defines were you are in script for something like framing it would be a little harder. But when you get that logic down the bots are bullet proof. They can be start and stoped any were in the script and finsh the task. I think the loop would start like if bot-has-items if !bot-near-patch || patch-has-herb move-to-next // you can find out were you are at in the scrpit by amount of runes buckets of compost left else farmpatch else get-items Example my post in with a flax spiner 3. See the code fixes I post.[tpAndMoveToArea] 4.See the code fixes I post. [ checkSupplies, noteHerbs] 5. Just something I saw Fixes I would make : package com.bacon.AIO.paint; import com.bacon.AIO.util.Sleep; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; 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.MagicSpell; import org.osbot.rs07.api.ui.Spells; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; @ScriptManifest(author = "HotPoket", info = "My first script", name = "Herb Running", version = 0, logo = "") public class Main extends Script { private static final Area camelotPatch = new Area(2810, 3460, 2820, 3470); private static final Area mortPatch = new Area(3600, 3528, 3605, 3533); private static final Area ardyPatch = new Area(2668, 3376, 2672, 3372); private static final Area falPatch = new Area(3055, 3313, 3060, 3308); private static final Area camBank = new Area(2808, 3440, 2810, 3438); @Override public void onStart() throws InterruptedException { gui maybe? } @Override public int onLoop() throws InterruptedException { /* if (checkSupplies()) { moveToCamelot(); farmPatch(); moveToMort(); farmPatch(); tpAndMoveToArea(Spells.NormalSpells.FALADOR_TELEPORT, falPatch); farmPatch(); tpAndMoveToArea(Spells.NormalSpells.ARDOUGNE_TELEPORT, ardyPatch); farmPatch(); } else { log("Not enough supplies to perform a herb run"); stop(); } */ This neeeds some looping structure if bot-has-items if !bot-near-patch || patch-has-herb move-to-next else farmpatch else get-items return random(500, 1200); } private boolean checkSupplies() throws InterruptedException { String[] items = new String[]{"Rake", "Seed dibber", "Spade", "Ectophial"}; String[] runes = new String[]{"Law rune", "Water rune", "Air rune"}; for (String item : items) { if (!getInventory().contains(item)) { log(item + " not found"); return false; } } for (String rune : runes) { if (getInventory().getAmount(rune) < 10) { log(rune + " not found"); return false; } } long seedAmount = getInventory().getAmount((x) -> x.getName().contains("seed")); long compostAmount = getInventory().getAmount((x) -> x.getName().contains("post")); if (seedAmount < 4/* && compostAmount < 4*/) { log("Seed or Compost fail" + seedAmount); return false; } return true; } private void noteHerbs() throws InterruptedException { Item myItem = getInventory().getItem((x) -> x.nameContains("Grimy") && !x.isNote()); myItem.interact("Use"); if (getInventory().isItemSelected()) { NPC tl = npcs.closest("Tool Leprechaun"); tl.interact("Use"); Sleep.sleepUntil(() -> !myPlayer().isMoving(), 5000); } } private void banking() throws InterruptedException { if (getBank().open()) { getBank().depositAll("Bucket"); getBank().depositAll(21483); getBank().withdraw(21483, 5); } } private void moveToMort() throws InterruptedException { Position myspot = myPlayer().getPosition(); getInventory().getItem("Ectophial").interact("Empty"); Sleep.sleepUntil(() -> !myPlayer().getPosition().equals(myspot), 5000); walking.webWalk(mortPatch); } private void moveToCamelot() throws InterruptedException { log("Let's get started!"); tpAndMoveToArea(Spells.NormalSpells.CAMELOT_TELEPORT,camBank); banking(); walking.webWalk(camelotPatch); } private void tpAndMoveToArea(MagicSpell spell, Area area) throws InterruptedException { Position myspot = myPlayer().getPosition(); magic.castSpell(spell); Sleep.sleepUntil(() -> !myPlayer().getPosition().equals(myspot), 5000); walking.webWalk(area); } private void farmPatch() throws InterruptedException { if (getInventory().contains((x) -> x.nameContains("Grimy") && !x.isNote())){ noteHerbs(); }else { RS2Object patch = getObjects().closest(8150,8151,8152,8153); if (patch needs to be raked){ rake }else if(inventory has weeds){ drop weeds }else if(patch can be picked){ pick patch }else if(patch is empty and has no weeds and no compost){ use compost }else { use use seed } } } }
-
thanks ill check it out
-
I want to move the mouse with out using the api move mouse. Its sometimes way to slow for my oh shit problem that i have and i need some thing that will move to the other side of the screen instantly. Anyone got anything?
-
I've made one before pm me or Add me on discord inept#0327 Video
-
what are doing? does it it have an interface or animation?
-
Hey pigfarmer, I don't know if this works public RS2Object something() { for (RS2Object x:getObjects().getAll()) { if (myPlayer().isInteracting((org.osbot.rs07.api.model.Character<?>) x)){ return x; } } return null; } Also you might want to put questions in https://osbot.org/forum/forum/249-scripting-help/ not https://osbot.org/forum/forum/251-snippets/
-
@Lol_marcus idea could work but https://osbot.org/api/org/osbot/rs07/api/util/ItemContainer.html is better becuase Equipment extends it and gets methods like contains(stuff...), getItems(), onlyContains(stuff...). Items[] MyArmor =getEquipment().getItems()
-
Ironic. Hey, xghostsage please stop posting useless comments to bost your Post count. In the last hour you have made 50+ post [he has around 50 posts] [15 min update 70 post] [45 min update 100 post] I would like a real price check for this.
-
70 smithing Coal bag ice gloves Full Graceful
-
You could do that, there is nothing wrong with that. Its almost the same amount or more work(When i used that method it seemed like 3 times more work) as what this code does. This code is just Id10t proofing the sending, resiving and execution of data. No need to encode and decode data, No need to cast Strings to objects, and No need to make a parsing tree that only you can use because you made it. All you have to do is connection.addPacket(new YourPacket(info , info, info....));
-
I don't know what you mean I have packet x with String i, int j, long k I make an x packet. I give you an packet with only the info. You read the packet and see id, oh its an x packet so you know it has a string i, int j and a long k. We both agree that all x packets need string i, int j, and a long k but we dont care what the others dose with info. There only so much you can do and having molds for the grabage in and garbage out is usefull.
-
I don't think I under stand this fully explain more. Becuase to me they are protocol becuase both sides agree on info that is sent over the sockets. You dont need packets to be mono taskers. But they can keeping a theme in a packet, this is usefull for expandability (for me at least). For my bot at least I have never needed more then 5 "packet", The bots are kept in the dark about the 30 other packets they cant see but the server can handle all 35. This sounds like what it is doing.(I don't Know how you would do this externally)
-
Webwalk Can I make it so it does not check the quest tab every time? Where can I find a list of all supported charter, Tp, and other? Any way to save a path?
-
Hello there, I origanal made a post about this in Unofficial Scripts & Applications. But see how no one wants it. I'm moving the updates to Off-topic. When making Bots in I believe that best bots can stop and start at any time and keep going with mininal globle variables and find its place based off state of the bot. So this project is a full blow programming laungage called scheme a flavor of lisp writen in java (writing one language in another? yes). Scheme is a functional programming laungage so that means runs of the idea of Lambda expressions and inputs. Lambda expressions make funtions that take 0 to N inputs and can be thought of as the same like math funtions were you have some inputs/none to 1 output [example f(x,y) = x+y+5]. Scheme is not typed this means thay you can pass any to a funtion like other funtions, good and bad data. It can "find out" if programed to know what to do with the data. This weeks update is under this post The basics of Sceme (extensive https://www.scheme.com/tspl3/ ) Why I do I think funtional programming better then java? Because you can keep data and methods separate, the abilty to pass functions as parameters and Currying https://en.wikipedia.org/wiki/Currying. You can make a basic functional programming laungage in 500 lines or less in C. I can program program alot faster, I made an AIO woodcutter 2 hours becuase when I program like a dfs I believe they run faster, are easier to change/mantain and use less resourses. Showing off the basics [updated 07192020] Videos+Scripts AIO Woodcut video [updated for new code] Wc code rewriten for super banker saves around 300 lines of code. AIO Firemaking video AIO F2P runecrafting video Features You can make 1 liner bots. Implents 95% of Osbot api Live updates Funtions Local, globle and private variables Can do any thing lazy-scheme can do. Light weight memory becuase of the runtime abilty you only use the memory you need for that task at hand then drop it after words. Flat/Deep recursion https://inst.eecs.berkeley.edu//~cs61a/su10/resources/Carolen Notes/week6.pdf Tail recursion https://en.wikipedia.org/wiki/Tail_call Threading Async only map , folds, letrec, and bang map f(x) [1 2 3 4] ->[ f(1) f(2) f(3) f(4) ] https://en.wikipedia.org/wiki/Fold_(higher-order_function) https://docs.racket-lang.org/reference/let.html (!) bang sets value and can destroy mean of define. (define x 5 ) [like x=5 ] !x 7 [ x is now 7] Loops but they are bad with functional programing Switches, cond, if else https://docs.racket-lang.org/reference/if.html Classes and Objects Done in a jankie way. Goals Make abilty to have packages (current Goal) test about 600 500 400 300 more methods Gui system like scratch Gui that can be made at runtime Implement ansi common lisp (50% done) Dictionaries and hashmaps(current in O(n) time but can get to O(1) time) Arrays [have not needed them yet so i have not added them.] Program Goals AIO skilling system (like Expv's AIO) RC FM WC Combat Herblore Fletching AIO quest system All ftp quest done Account builder system like level 3 to MMF bot and level 3 to blast furnace with coal bag and ice gloves. Number of bots baned: 3 Feltching testing(injection) Some quest (my guess dorics quest.) Banned after doing Monkey madness. [no idea on cause] Cook assistant quest
-
NPE when trying to access MethodProvider instance
Nbacon replied to Epos OSBot's topic in Scripting Help
Avrae works but this will fix your problem without change any of your old code. public static MethodProvider MP = this;//script extends the MethodProvider -
Hello, I hope this code helps you. [edited 06072020] Over heads is about 10-20mb of ram but is worth it becuase of how flexable it is. How to use new Packets Packets are usefull because you can send data and both sides know what is being sent and how to use it. Examples of packets I have made mouse packet that takes an x and a y and a mouse button and when executed will click on the screen. The example below is from my login packet takes a name, password and a world. The server will send this to a client and using code in the script will log in. Goto src/com/bacon/eco/server/shared/packets Make a new Packet that "implements IPacket" Go to PacketType enum add this line ClassName(last number ++ , com.bacon.eco.server.shared.packets.ClassName.class), You will see 4 override methods echo, send, receive, execute in the new Class you just made Make 2 constructors like This. One needs to have 0 args taken, other can take what ever you want. public LoginPacket() { } public LoginPacket(final String username, final String password, final int world){ this.username = username; this.password = password; this.world = world; } echo -has a boolean and if the server ever gets this packet it will send the info to everone- good for pking and ge merching. send - Inside send you need to use connection.writeString, connection.writeInt, ... and others in the order that you want to send them @Override public void send(ActiveConnection connection) { connection.writeString( this.username); connection.writeString( this.password); connection.writeInt( this.world ); } receive - Inside receive use connection.readString,connection.writeInt in the same order as above. @Override public void receive(ActiveConnection connection) { this.username =connection.readString(); this.password=connection.readString(); this.world =connection.readInt(); } execute - put what you want your bot to do here @Override public void execute(ActiveConnection connection) { if ( Client.mp !=null) Client.mp.loginToAccount( username,password ); if ( Client.mp !=null) Client.mp.hopto( world ); } This will does the same this as excute inside the packet (just rember to leave execute blank or it will do both). make getters and inside Client -> handlePacket -> add code like this if (clazz == LoginPacket.class) { final LoginPacket packet = (LoginPacket)Ipacket; if ( Client.mp !=null) Client.mp.loginToAccount( packet.username() ,packet.password() ); if ( Client.mp !=null) Client.mp.hopto( packet.world() ); return; } How to add P2P messages Make a new Class Add it to the Enum PacketType Goto com.bacon.eco.server.server.network.Controller under handlePacket make code like this Test your code (example P2PMessagePacket) go to TestClient write some code like this. compile and run Change the code to un comment to see them talk to each other. out put shoud look like Adding useful info AbstractPingPongPacket these send a request for data [Advance] PingPacket this updates the server ever 3 seconds. info that could go in here userloged in username [example script you need write this your self] current script runnign User location much,much more Sever-side Tuning Basicly you can make methods that can be controlled by a gui or CLA with a scanner : Example This tells all accounts to log out or just some amount. public void sendlogouts(int logoutAmount) { final Set<ActiveConnection> clientSet = clients.keySet(); int count = 0; for (final ActiveConnection connection : clientSet) { if (connection.getType() == 1 && (count < logoutAmount || logoutAmount == -1)) { count++; connection.addPacket(new LogoutPacket()); } } } Adding it to your scripts Examples from my scripts This is code was my frist draft on networking.Code update to add change in How to use [06072020] Things that can be added: if your connection drops out then try to reconnect. Better way to drop old conections- at the moment if you get sent 10 null messages in a row the connetion is droped. Things that can be ran TestClient Mainserver Example (script) Any questions or help just ask. update [06072020] Username is example script needs to be defined in some way by you. code_06072020.zip
-
Killing two birds with one small thermonuclear device. You don't need a botting client for xp checks.... Download something like jitbit macro recorder they have a trial. make 1 recording at a time were you start in the bank or some solid static item and use add an image check before run that one recording.
-
I use the Ge and Items that are never trade so I just buy from myself 100 "apple pies" (not the item) for 3k each and sell them back for 200 gp. I keep the pies and the 280k profit. I have a few item one with an 8k margin and my bots are set up to buy this item after some gold threasehold so muling is never needed . Only problem is people under cuting your item so I do price check befor the transfer.
-
My thoughts: (opinions ) I made a mutiboxer that had the abilty to record the objects, menu options , wait for widgits, and title potions you clicked. It used the osbot api to make almost bullet proof macros. If the camera moved the bot would still work, if there was npc infront of something you need to click on it still worked. Long recordings just invite failure and would take alot of input. Do you think there's any validity to this approach? No, why? you are not using any osbot api so why would you need osbot to do this? Most bans are client checks (*opinion* needs a fact-check) JNativeHook library comes off as malicious and always gets deleted my by anti-virus. there is a macro recoder on osbot already with abity to load your own macros maybe record and inport to thier format . scriptID 1012
-
General advice for debugging slow/unresponsive scripts?
Nbacon replied to Impensus's topic in Scripting Help
Sorry I can't help you more. Its most likly something supper small. Sounds like a mermory leak or a threading problem. If a memory leak limit recursion and making new objects. If a threading problem try this. (I like ExecutorSevices to kill all threads.) That sucks. Maybe take out features add them back 1 at a time till you find the problem? -
Thanks. Functional programming program hits harder then any oo language on a résumé. (personal opinion ofc) Thanks. I don't think you understand how many times I rebuild scripts..... but amazing tip nevertheless.
-
General advice for debugging slow/unresponsive scripts?
Nbacon replied to Impensus's topic in Scripting Help
I agree with Ace. This sounds like your tring to use something that is null fixing this will help the memory issue. Fixes? Try/catch around the loop this is a bandaid for gun shot or null check everthing this is just a pain in the ass but saved me many heart aches . Follow questions to get a better answer. Can you stop the script after sometime or do you have to force kill it if this does happen? Do can you see the log? Is it only in one section of the script or you can't tell. -
Thread moved to Offtopic with Silent Updates. OG post Interesting title Ahoy all, Im here to show off my most resent project. Latly, Ive been programing alot of bots and find it to be the biggest pain in the ass is remake a jar after update the programing or to testing one part in my bots. So to slove this problem that is such a minor inconvenience and legit takes at most 5 minutes out of my life per script. I went a head and invested my lunch, test and break times to make my own run time programing language bases off scheme. So this was not a small under taking (15000 line and 30+ hours) but I think it 100% worth it. After I get It all methodes test because there are 100's of them. I would like to slap a gui on it that looks like scratch and apply to put it in the SDN. Ill post updates here and if anyone has any suggestions ill take them. Video (Also this is a lot kewler than you think it is) Example of working code. I need suggestions on how to test shit loads of code with out test cases for everthing. Features Implents 95% of Osbot api Live updates Funtions Local, globle and private variables Can do any thing lazy-scheme can do. Todo list test about 700 more methods Gui that looks like scratch implement ansi common lisp Floats every thing is in longs and ints atm filter, fold, letrec, and bang Loops Classes and Objects Dictionaries Switchs Arrays Flat recursion
-
Examples public void generateBotMouseEvent(int id, // MouseEvent.MOUSE_PRESSED or MouseEvent.MOUSE_RELEASED I think there maped to 1 and 0 long time, // The system time of when you want this click to happen. int modifiers, // Set this to 0. int x, //the x on a cartisian plane (0,0) is top left int y, // the y on a cartisian plane int clickCount, // 1 is click once 2 is double ... boolean popupTrigger, //just make this false int button, //MouseEvent.BUTTON1 , MouseEvent.BUTTON2 right/left boolean botInput) //make this true This a tip for all new to coding and want to see exaples of obscure code with bad docs.(I have said it like 30 times) goto github.com login type the string of the package you are using your case "org.osbot.rs07.input.mouse.MouseDestination;" put osbot after click Code its under Repositories (https://github.com/search?q=org.osbot.rs07.input.mouse.MouseDestination&type=Code) Look at the code and try to make it work. If you cant find anything try searching other keywords or using something else or rethink logic
-
Hello Flewis, The code works pat yourself on the back. Its a good start. The logic is most important part of a bot and ever sagement is broken in to a logic spot. BUT using a switch statement like this is like using goto and we can do better. If think like a state machine were all action is true false pair. Programing becomes fast and rapid becuase you can use "and then" and "what if" thinking. Will spin flax in Lumbridge castle. Yes Banks on the top floor. Yes Can be stopped and started anytime and will figure out where you left off. It does but there like goto. Will stop when the user has no more flax in the bank. Yes. Has mechanisms to deal with lag for example if widgets don't open ETC. Check for nulls is great becuase they will crash the client but for lag look into ConditionalSleep. Tested on all server locations. No idea what this means. Two tips limit accounts per loop and use conditionals logic not switches. (switches have a place like during quest ). This is how I would do it . I just a rearaging of your code to limit actions per loop and tried to explain the thinking behind it. step 1: break the bot in to 2 logical opposites like has bow stirngs or does not have bow strings. (you can use this pattern for 95% of banking skills) step 2: Think to yourself If i dont have not flax were am i and how do i get ride of this not flax? step 3: fill in the code to get you to the bank, bank your items and with draw the flax. Once this is done the logic for getting flax is done. Step 4: The else logic we have flax, we could be at the bank, or going to the sping wheel or making bowstrings. step 5 fill in and done.