Search the Community
Showing results for tags 'kotlin'.
-
Good day, botters! I want to introduce you to a devlog about my development experience to create AIO bot! Now it sounds ambitious but I see success in small victories. I won't be aiming to make grandeur AIO script to compete with others, since it is nearly impossible to accomplish that alone. However, I find it intriguing developing a bot. I've never coded one before, but by playing a bit of RSPS with friends, I realized I'd like to see what problems you need to solve to create a bot. Currently I am at v0.01 and I plan to bump the version every weekend and post an update about the progress. Started working on the project two days ago, but as of now, I don't plan to open-source nor release the bot, but in the future it might happen depending on the progress. To make this process a bit harder (or easier) I decided to use a modern approach to coding a bot by choosing Kotlin. My aim is to use its idiomatic way of coding, coroutines and StateFlow. By checking the forums, I lacked people who use Kotlin, so I'd love to change that. If everything goes well, I could make some tutorials about developing with Kotlin and more! Anyways, back to the bot. Currently I have implemented these features: - Woodcutting logs in Lumbridge with banking - Mining copper and tin in Varrock East with banking - Random Task Scheduling - State Machine - Simple Custom Login Solver to expose onLoggedIn event Humble beginnings as I build the architecture and structure of the project. No interesting botting yet. I'd like to rundown a bit about what I got so far. First, let's rundown the flow. Smallest unit of action is State which can be WalkToBank or ChopTree, next up is Task. It can be either Mining or Woodcutting that consists of multiple states to execute the task. In the future I plan to add Job that consists of multiple tasks. For example Job that combines ShearingSheep and Crafting to output jewelry and so on. Goal is to make it all dynamic. Now, how does it look like in code? Here's a snippet how WoodcuttingTask is built with states: private fun buildStatesList(): List<State> { return listOf( WalkToBank(lumbridgeBankArea, lumbridgeBank) { Inventory.isFull() }, WalkToBank(lumbridgeBankArea, lumbridgeBank) { !isAxeAvailable() }, WalkToArea("Walking to Lumbridge tree area", lumbridgeLogsArea) { !Inventory.isFull() && isAxeAvailable() }, FindingTree("Looking for tree in Lumbridge area"), ChoppingTree("Chopping a tree in Lumbridge area"), DepositItems(ItemDB.get("Logs"), condition = { isAxeAvailable() }), WithdrawItems(ItemDB.get("Bronze axe"), condition = { !isAxeAvailable() }) ) } By putting small actions into individual classes I can easily build all kinds of tasks in the future. Now, there is some hard-coding involved like lumbridgeBankArea. However, in the future everything should be abstracted. Now here is the bot in action... Pretty simple stuff, it is cutting the wood. Hopefully with time I'll have more things to show. As of now, I want to make a SkillTracker, Priority Queue for tasks, combine Kotlin with Swing and use MVVM architecture. Expose state of the bot to UI via StateFlow and so on. Many things to work on! Anyways, it is already a long post. If you've read it. Congrats and thanks for sticking by. If you have any questions, feel free to ask, I'll be happy to answer:) Have a good one, Lizergas:)