Zenz101 1 Posted June 5, 2023 Afaik this bot has been around for a while and I don't know this is version 3 of the bot? And I was wondering why it's such a hassle to write a decent script with this API? Since Java 8 we've started using streams and writing reactive code even though I'm more of the oldschool programmer but I feel this API is on a whole other level on the negative side. Since RSBot 5 which I think was late 2012 we had something like a query API where you could poll items/gameobjects/... For instance to search a GameObject with id 1337 and location 1000,2000 you could simply do the following final GameObject gameObject = ctx.gameObjects.poll().forId(1337).location(1000,2000).get(0); if(gameObject != null) { //Do stuff... } When I'm using the Dreambot API it gets cumbersome and I have to do final List<GameObject> objectList = GameObjects.all(gameObject -> { final Tile location = gameObject.getTile(); return gameObject.getID() == 1337 && location.getX() == 1000 && location.getY() == 2000; }); if(objectList.size() > 0) { final GameObject gameObject = objectList.get(0); if(gameObject != null) { //Do stuff... } } I mean GameObjects.getObjectsOnTile returns an array and the other functions return a List<GameObject> ??? How is this supposed to be modular? So every time I want to filter out gameObjects I have to retrieve the whole array fetched from the client every time the script loop is called. Isn't this too CPU intensive? I also hate the fact that the API is closed source to the bone so you couldn't even check this out <.< When I turn on "Enable Inventory Tool" it lags as hell which I suppose has something to do with it. I also hate the fact that in AbstractScript the onStart/onExit method isn't abstract and it's a void instead of a boolean? What do you have to do if you want to run logic before the script starts but you eventually don't want the script to start? Normally onStart should return "false" in this case. These methods also aren't even described in the Script Skeleton tutorial so how would a noob even know about these in the first place? They would execute their GUI in the loop. I've just recently started using this bot and writing my first script on it. I've been out of the scene for +5 years but I can see a lot of improvements which could be done to the API which is lacking at the moment. I'm just using this thing to get my private stuff up and running but please for the sake of the sanity of your developers optimize this thing and consider improving the architecture of your API to more modern technologies. I'm using this bot over Tribot because I heard this bot is more capable and mature but I'm starting to consider now... This is just my 2c and I had to get it out because it's frustrating me. /end rant
camelCase 304 Posted June 6, 2023 21 hours ago, Zenz101 said: why it's such a hassle to write a decent script with this API? its not you are just doing crazy shit 21 hours ago, Zenz101 said: final List<GameObject> objectList = GameObjects.all(gameObject -> { final Tile location = gameObject.getTile(); return gameObject.getID() == 1337 && location.getX() == 1000 && location.getY() == 2000; }); if(objectList.size() > 0) { final GameObject gameObject = objectList.get(0); if(gameObject != null) { //Do stuff... } } why didnt you just gameobjects closest with a filter? getting the tile is redundant the getX and getY methods both come from locatable interface so you can just use the object instead 21 hours ago, Zenz101 said: final GameObject gameObject = ctx.gameObjects.poll().forId(1337).location(1000,2000).get(0); if(gameObject != null) { //Do stuff... } why did you get(0) is this example but not in the first example, this would work for both unless im missing something, i dont recommend it though just use predicates 21 hours ago, Zenz101 said: So every time I want to filter out gameObjects I have to retrieve the whole array fetched from the client every time the script loop is called. no you use filters (predicates) i think all the accessors take them 21 hours ago, Zenz101 said: the API is closed source to the bone idk what you mean by this, the javadocs exist, kinda ebil but fernflower exists 21 hours ago, Zenz101 said: What do you have to do if you want to run logic before the script starts but you eventually don't want the script to start? put it in onloop i guess, onstart boolean might be better but i dont think it would be worth forcing a refactor on literally every script to avoid like 3 loc yeeter 1
camelCase 304 Posted June 6, 2023 22 hours ago, Zenz101 said: GameObjects.getObjectsOnTile try getTopObjectOnTile(Tile t) np
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now