Jump to content

TheJacob

Members
  • Posts

    22
  • Joined

  • Last visited

  • Feedback

    0%

Everything posted by TheJacob

  1. Follow-up: Repository will be down over the next day or two. I'm changing the project name and integrating Maven in the development process. Moreover, I'm working with some collaborators that are focused on pushing a proof of concept script with the first stable release of the framework. The repository layout will be changing as well to reflect this. This project will be open source (no change).
  2. Follow-up: Finished providing Javadocs for everything under the framework package and discovered & fixed a bug with Active Selector's implementation (see issue#2). Started working on action model of the framework.
  3. Follow-up: Prior to the aforementioned upcoming tasks, I'm going to provide Javadocs for everything under the framework package. In doing this, I'll likely clean up a bunch of the code as well (or at least streamline it). The "decision" model is essentially complete, maybe adding one or two more decorators or composites here and there. The focus will shift to the "action" model once I've finished documenting everything (the "sense" model is provided by the OSBot API hehe, ty.) Initial Javadocs pushed to Git for Tree, TreeFactory, and Behavior. The remainder will follow.
  4. Follow-up: Utility functions implemented. Next updates will expand on buckets, useful utility decorators, and streamlining the script to a (sense -> decide -> act) model. I expect these to be the last additions to the framework before major work will be put in to writing conditions/actions for f2p hybrid pking.
  5. Follow-up: New release (v1.2) with updated framework. This should be the last time I majorly re-work the framework, much more flexible now. Can @Mio or @Gunman move this thread to Soft Dev/Projects. Thank you!
  6. Follow-up: So, I definitely think this approach (a behavior tree) will be sufficient to create a F2P ranged/2h pking script. That said, release 1.2 will separate actions from decisions before diving into the meat and potatoes of pking. Namely, the behavior tree will be parsed to update the blackboard with a set of game states (read as goals) that the game logic will accomplish -- decisions executed in onLoop and decisions processed in onGameTick. Also, I will provide more flexibility with regards to conditional aborts and parsing a "RUNNING" tree. In release 1.3+, grouping and prioritizing actions for pking (as subtrees) will be the toughest part. It's my intent to have a working pk-ready release within the next 10 days. If anyone has any thoughts on what a model might look like for pking, definitely reach out and give me a shout. As well, it's my first time writing a project in Java, so if there's any bad practices you folks see in the project, let me know.
  7. I didn't test your method, but immediately I see there's a chance to throw an array out of bounds exception (not providing array.length - 1 on indexing). Here's a more condensed implementation that might help: static final int[] fWorlds = { 1, 8, 16, ... }; static final int[] mWorlds = { 2, 3, 4, ... }; public static void hopRand() { final int[] hWorlds = getWorlds().isMembersWorld() ? mWorlds : fWorlds; if (!getWorlds().hop(300 + hWorlds[random(0, hWorlds.length - 1)])) { hopRand(); } }
  8. Try passing a parameter with -script as well. I couldn't get -script to work without passing a dummy parameter. java -jar OSBot.jar -login <OSBotUser>:<OSBotPass> -bot <OSRSAccount>:<OSRSPass>:0000 -world <WorldNum> -script <YourScriptName>:params
  9. Released a different approach to creating scripts (behavior tree framework). See this thread. If a decision tree approach is used, it will be a hybrid subtree of the behavior tree framework.
  10. Hey folks, I'm working on an AI framework for writing Scripts on OSBot. After having recently played around with a decision tree framework and reflection (see this thread), I wanted to try a different approach to scripting and I definitely think this is a winner. My intent is to provide two things: flexibility and simplicity (in regards to maintainability). I will be using a behavior tree model w/ a utility function to write a F2P pking script, so let me know where you think we can improve this framework! Source Download (0.0.31): Git Repo (temporarily down) Changes 0.0.31 - new repository, structural changes, and maven integration (streamlines collaboration). 0.0.21 - merged new framework, implemented a utility function, and removed json integration & chicken killer test script. 0.0.12 - loading decision tree from JSON file. 0.0.1 - initial release Setup Updating setup in accordance with 0.0.31 (TODO). Remarks Updating remarks in accordance with 0.0.31 (TODO). Snippets (v0.0.31) MyScript.java
  11. Oh ok, I didn't know about that! I think I can change the design such that it doesn't use reflection. The reason I decided to go with that design in the first place was to reduce code clutter while parsing the decision tree (making the assumption that the script does not know about all the conditions & tasks). In order to get rid of reflection, I can make the script aware of all conditions & tasks while still leaving the decision tree to be dynamic to the user. The 'parser' variable in 'onLoop' should be holding a reference to a spot in the tree at all times rather than a copy of the tree. If I'm not mistaken, this line passes a reference by value rather than copying the whole tree. Condition parser = dto; I might be wrong though, where do you see it copying the whole decision tree or JSON parser every loop?
  12. Solution: I don't think I understood the reasons to extend API vs. MethodProvider, and how exchangeContext ties in with Bot. This post explains it quite well:
  13. Thanks @Czar! I'm still figuring out a few more things about the OSBot api, but I'm aiming within the next two weeks to have a script released demonstrating this framework (more complicated than the simple one I included with this release). I'm sure there's still some drawbacks with it's current design, so definitely give it a look and let me know what you think. Open to all feedback. For example, I don't know how well this framework will perform when more than one decision is needed in a tick, or how to handle running concurrent tasks (such as moving and eating -- maybe hooking in to OSBot's Event API).
  14. Hey folks, I think I understand the purpose of org.osbot.rs07.script.API abstract class but I don't know how to tie everything together in a script. I think it has something to do with the behavior of MethodProvider.exchangeContext, specifically: But I'm stuck on understanding what this actually means. For example, here's a Fighter class that extends API (let's say it'll behave similarly to Combat). public class Fighter extends API { public Fighter(Bot bot) { exchangeContext(bot); } @Override public void initializeModule() { log("Initializing fighter module."); } // Some example method. public String getMyName() { return myPlayer().getName(); } } Right now I don't know where initializeModule should be called, or how I hook this class into the existing API framework for that matter. Based on the docs above, I think it has something to do with overriding the exchangeContext method somewhere, but I don't know where: // This method would be in a class that subclass's MethodProvider (a wrapper, maybe?) // But a problem might be, how do I get getBot().getMethods() to return a reference // to this new method wrapper so I can access getFighter(). @Override public MethodProvider exchangeContext(Bot bot) { super.exchangeContext(bot); fighter = new Fighter(bot); fighter.initializeModule(); return this; } public Fighter getFighter() { return fighter; } Does anyone have those answers? In my mind, the desired end state is something like: @Override public int onLoop() { String myName = getBot().getMethods().getFighter().getMyName(); // or maybe just getFighter().getMyname() for short, similar to getCombat(). // ... return 600; }
  15. Hey folks, here's a decision tree framework for writing Scripts on OSBot. My intent is to simplify the process of making iterative decisions and provide flexibility to the user should they wish to change the decision model. I will be using something similar to this in order to build a F2P PKing Script, so let me know your thoughts on where it can be improved! OUTDATED: CLICK HERE (for a behavior tree framework) Source Download: FastUpload - 1.1 (25 11:00 Jan 2023) Changes 1.1 - removed redundant if condition in deserialize method. 1.0 - initial release. Setup Create a "DeepButler" folder in OSBot's Data folder (getDirectoryData). Create a "deepbutler.json" file in the "DeepButler" folder. Use the example decision tree (and later have fun making your own!) Modify your OSBot to allow reflection (add "-allow reflection" to run.bat). Enter W326 and a secondary world to test the framework. Remarks This framework has not been tested on any scripts yet. I intend to use a similar iteration of this framework on a F2P PKing Script. Create new Conditions and Tasks, and change the decision tree as required. The decision tree doesn't necessarily have to be processed in "onLoop". In fact, I think there's great potential by listening for game tick events. Every Task is a Condition. It makes sense to simply return "true" in Tasks that do not branch anywhere (prompt a re-loop), otherwise use them as a condition & a task if there's subsequent decisions to be processed. The "Cond" annotation is something I was trialing in lieu of reflection. Not integrated at the moment. Snippets deepbutler.json DeepButler.java Decision Tree Parser (deserialize method)
  16. Solution: In order to properly flag a subclass of Event for termination, you must call "setFinished". Complete code: // MyScript.java // // @onLoop execute(new MyEvent()); // MyEvent.java public class MyEvent extends Event { public MyEvent() { } public int execute() { // Do stuff // ... // Ready to finish. setFinished(); return 0; } } Thank you @Gunman for referring me to this thread below as API Docs for execute confused me (lead me to believe a negative number returned would terminate the Event).
  17. Hey folks, I'm writing a custom Event and the MethodProvider 'execute' method doesn't provide my event to the engine for execution. I expect "Running event." to be output in the OSBot client logger; however, nothing is output. // Events.java public class MyEvent extends Event { @Override public int execute() { log("Running event."); // Debug info. return -1; // Immediately stops. } } // MyScript.java // // in @onStart this.myEvent = new MyEvent(); //this.myEvent.exchangeContext(getBot()); **See follow-up** // in @onLoop execute(this.myEvent); return 20000; // to avoid repeated executions. Follow-up: I shouldn't call exchangeContext in @onStart because Event is a subclass of MethodProvider. That said, when I remove that call, I now run into a different issue where "Running event." is continuously output to the OSBot client logger rather than once. I expected it to be output once because I return -1 in myEvent.execute. Does anyone know how to solve that? Follow-up: If I set the return value from -1 to 2000, then it behaves as expected (outputting "Running event." every 2000ms to OSBot client logger). So, I *think* my question is, how do I properly flag that my event is ready for termination?
  18. I came up with something similar, although both solutions still feel a bit weird. I'm quite new to Java and OSBot, am I reading the docs right when they state "Creates an instance of this filter, which filters out Entity objects based on whether their Position falls inside the Area." -- does this mean for the API area filter, it must convert these positions to an Entity before I can filter them? To me, it seems this native functionality is only applicable to filtering out objects from an area, not pathing? According to the docs, entities can only be: Character, GroundDecoration, GroundItem, InteractableObject, NPC, Player, WallDecoration, WallObject? Character p1 = myPlayer(); Area x = p1.getArea(1); Area y = p1.getArea(2); List<Position> walkable = y.getPositions().stream().filter( pos -> !x.contains(pos) ).collect(Collectors.toList());
  19. Can someone explain how to use the API area filter to filter undesirable positions from my next walk. I've figured out how to achieve this by converting the area to a list of positions & applying stream filter. That said, if there's a way native to the OSBot API, I'm definitely keen on using it. For example: Character player = myPlayer(); Area nowalk = player.getArea(1); // 3x3 area on player Area canwalk = player.getArea(2); // 5x5 area on player // How do I use the API Area Filter to exclude the list of "nowalk" positions from "canwalk". The desired output is an area of 16 tiles (outer edges of the 5x5).
  20. 100% I forgot about achovy pizza into swordfish combo eat. The switch from 2h back to bow if they're eating during my run animation is definitely a good idea too. I'll add them both to the decision tree. I'm starting with an easy and cheap pk bracket and looking at the results before I invest more time into a more expensive or p2p bracket. It's a script that I should be able to see immediate returns within a couple days, not necessarily for generating gold but having fun advancing the decision tree. It can be read as a "proof of concept" for future iterations of an automated PK script.
  21. Hey folks, I'm looking for some discussion on a simplified F2P brid pking decision tree (for an upcoming script I'm working on). It's my first time on the OS Bot community and looking forward to learning the API and designing some nifty tools. What are your thoughts on some of the decisions it needs to handle? For the time being, I omitted potting & prayer flicking to keep it as a simple & achievable script to hack together within a couple days. The account I will be building it for is 40 attack/40 strength/60 ranged/13 prayer.
×
×
  • Create New...