May 1, 201312 yr Developer Ok, I want to discuss this with you script writers. Basically, we have a system setup which allows you to load random events simply by putting the files in the correct folder and it will be activated once the onActivate() method returns true. For most randoms, this will work fine. For example if you get the strange box, or if you're taken to the surprise exam, you want to solve it on the spot in most cases. But what if you get the evil chicken? Then you want to specify your own way out, either to run away, either to kill it etc. So I was thinking, we need to provide you with a random management system. See, we as OSBot will provide most and eventually all randoms through the SDN. These will be written by us and, as has already been done by some, people from within our community. But what if you're at the fight caves and you get an evil chicken outside? Well obviously the easiest way to avoid the random would be to hop back into the cave again. tl;dr I want to suggest to have a library with an unique id for each random (to be documented in the API), where for each id you can subscribe your own handler to with parameters to completely override the preprogrammed random behaviour, or to extend it in such a way that your handler will perform its logic and after that the code inside the random will take over. Before I start writing an implementation for this, I want you to think about any functionality you see fit in this system that we did not come across. Discuss.
May 1, 201312 yr This sound good so far. But what I was thinking is that you should give people the options to override the class using classLoader Eg. random.replace(String randomName, Class<?> class); or you can go even more simple by replacing the Class<?> class with RandomEventSolver Edited May 1, 201312 yr by Doout
May 1, 201312 yr And what if you are using a script where you are under attack all the time. Then you CANNOT solve the strange box. You can use something like: @Overridepublic void onRandomActivate(RandomEventSolver res) { if(res instanceof StrangeBox) { runSomewhereSafe(); }}@Overridepublic void onRandomDeactivate(RandomEventSolver res) { if(res instanceof StrangeBox) { runBack(); }} would be nice. You don't have to script your own random code this way. You can just execute a part of your code, before the OSBot random code gets executed. And you could use: @Overridepublic void onRandomActivate(RandomEventSolver res) { if(res instanceof EvilChicken) { res.stop(); // onRandomDeactivate() gets called too. runIntoFightCave(); }} Edit: Above answer sounds good to for totally overriding the OSBot random system. Edited May 2, 201312 yr by SXForce
May 1, 201312 yr This sound good so far. But what I was thinking is that you should give people the options to override the class using classLoader Eg. random.replace(String randomName, Class<?> class); or you can go even more simple by replacing the Class<?> class with RandomEventSolver Bot class is obfuscated but you can still remove osbot randoms in this version. //unload bot broken randoms List<RandomEventSolver> solvers = bot.H(); int loginIndex = -1; for(int i = 0; i < solvers.size(); i++){ if(solvers.get(i) == null) continue; if(solvers.get(i).getName().equals("Login")) loginIndex = i; } if(loginIndex > -1){ bot.H().remove(loginIndex); System.out.println("Removed Login, index:"+loginIndex); } Anyway, some randoms, mostly the combat ones, should be be made by scripter as it's not feasible to have a solver that will guarantee your account security in all places/situations. if the bot give's us a platform to do it or not, doesn't really matter.
May 1, 201312 yr Bot class is obfuscated but you can still remove osbot randoms in this version. //unload bot broken randoms List<RandomEventSolver> solvers = bot.H(); int loginIndex = -1; for(int i = 0; i < solvers.size(); i++){ if(solvers.get(i) == null) continue; if(solvers.get(i).getName().equals("Login")) loginIndex = i; } if(loginIndex > -1){ bot.H().remove(loginIndex); System.out.println("Removed Login, index:"+loginIndex); } Anyway, some randoms, mostly the combat ones, should be be made by scripter as it's not feasible to have a solver that will guarantee your account security in all places/situations. if the bot give's us a platform to do it or not, doesn't really matter. Can you read my post before posting random stuff.
May 2, 201312 yr Can you read my post before posting random stuff. lol Read the code, what you suggested can be done with remove+add methods on randomsolver list...