Psvxe Posted June 30, 2015 Share Posted June 30, 2015 (edited) Seems I forgot to set the initial "currentNodeSet". I uploaded this without testing, which seems to always be a problem. I'll make sure to test anything I release in the future To fix this, you're going to need to find a set that best fits your bot when it starts. You can do this in a few different ways. I recommend setting it in onStart, right before continuing to onLoop: void onStart() { manager.add(...); manager.add(...); manager.initCurrentSet(); }Within the Manager class, you would add public void initCurrentSet() { for(Node node : allNodes.values()) { if(node.canProcess()) { currentNodeSet = nodeSets.get(node); break; } } }I'll be fixing this up shortly after my current project, which will make it easier for people to apply it to their scripts. Sorry for the inconvienence (wrote these systems from my phone ) Thanks for your time answering, and as always, the incredible detailed posts. However, should I make a ArrayList to get all the current nodes? As you haven't defined AllNodes. EDIT: public void initCurrentSet() { for (Node node : NodeLinkerManager.allNodes.values()) { if (node.validate()) { NodeLinkerManager.currentNodeSet = NodeLinkerManager.nodeSet.get(node); break; } }EDIT2:I guess you ment the NodeLinkerManager, rather than the class Manager. Edited June 30, 2015 by Psvxe 1 Quote Link to comment Share on other sites More sharing options...
Psvxe Posted June 30, 2015 Share Posted June 30, 2015 (edited) Still gives me a error. [ERROR][Bot #1][06/30 09:08:10 PM]: Error in script executor! java.lang.NullPointerException at fts.linked.NodeLinkerManager.run(NodeLinkerManager.java:49) at nl.psvxe.scripts.fightcave.Manager.onLoop(Manager.java:37) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(qh:114) at java.lang.Thread.run(Unknown Source) Same codes, just did what you said. Edited June 30, 2015 by Psvxe Quote Link to comment Share on other sites More sharing options...
fixthissite Posted June 30, 2015 Author Share Posted June 30, 2015 (edited) After taking another look at the code, I've made a fatal mistake. The nodeSet map is mapping class types to node: Map<Class<? extends Node>, Node[]> nodeSet; //should be named nodeSetMap But in initCurrentSet, I told you to do nodeSet.get(node), when node is an instance of the class, not the class type (since allNodes.values() returns a Set<Node> and not a Set<Class<? extends Node>>). Map<Class<? extends Node>, Node> allNodes; for(Node node : allNodes.values()) { if(node.canProcess()) { currentNodeSet = nodeSet.get(node); break; } } What I told you before (the code I just showed) should have actually generated a compiler error. On top of that, I found a few little mistakes I didn't tend to (such as validating that you actually specified nodes in @Linked), so try this out: http://pastebin.com/QHTEg53H It's still messy. The fixes I added were quick fixes (making the design look even messier), but I'm cleaning this up as we speak, since apparently a re-upload is much needed. Let me know if the new LinkerManager works for you! And thank you for finding these problems for me. As I've said before, I've never actually ran this. I released it shortly after the person who requested it told me he got it working (with a few minor tweaks). Never release without testing X_X Edited June 30, 2015 by fixthissite 1 Quote Link to comment Share on other sites More sharing options...
Psvxe Posted June 30, 2015 Share Posted June 30, 2015 After taking another look at the code, I've made a fatal mistake. The nodeSet map is mapping class types to node: Map<Class<? extends Node>, Node[]> nodeSet; //should be named nodeSetMapBut in initCurrentSet, I told you to do nodeSet.get(node), when node is an instance of the class, not the class type (since allNodes.values() returns a Set<Node> and not a Set<Class<? extends Node>>). Map<Class<? extends Node>, Node> allNodes; for(Node node : allNodes.values()) { if(node.canProcess()) { currentNodeSet = nodeSet.get(node); break; } }What I told you before (the code I just showed) should have actually generated a compiler error. On top of that, I found a few little mistakes I didn't tend to (such as validating that you actually specified nodes in @Linked), so try this out: http://pastebin.com/QHTEg53H It's still messy. The fixes I added were quick fixes (making the design look even messier), but I'm cleaning this up as we speak, since apparently a re-upload is much needed. Let me know if the new LinkerManager works for you! And thank you for finding these problems for me. As I've said before, I've never actually ran this. I released it shortly after the person who requested it told me he got it working (with a few minor tweaks). Never release without testing X_X Well, it's impossible to had it fully running. Doubt the guy implemented it right, lewl. The pastebin gives compile errors. At the moment I'm fixing them. Do you have way of talking outside the forums? Or could you enable your PM system? Quote Link to comment Share on other sites More sharing options...
fixthissite Posted June 30, 2015 Author Share Posted June 30, 2015 Well, it's impossible to had it fully running. Doubt the guy implemented it right, lewl. The pastebin gives compile errors. At the moment I'm fixing them. Do you have way of talking outside the forums? Or could you enable your PM system? Didn't realize my pm system was disabled. I'm not sure how to re-enable it. I'll send you a message (which hopefully you could reply to).I couldn't run the final pastebin I uploaded (not at a computer, so I removed references of OSBot before testing), but I ran a mock version of it which worked fine. Hopefully I didn't mess anything up while re-implementing the OSBot stuff (the MethodProvider reference) Quote Link to comment Share on other sites More sharing options...
Psvxe Posted June 30, 2015 Share Posted June 30, 2015 Didn't realize my pm system was disabled. I'm not sure how to re-enable it. I'll send you a message (which hopefully you could reply to). I couldn't run the final pastebin I uploaded (not at a computer, so I removed references of OSBot before testing), but I ran a mock version of it which worked fine. Hopefully I didn't mess anything up while re-implementing the OSBot stuff (the MethodProvider reference) I kept the imports from the old file and replaced all the other with the pastebin version. Compile error 1: Fix: Compile error 2: Fix: Compile error 3: Fix: ???? Quote Link to comment Share on other sites More sharing options...
fixthissite Posted June 30, 2015 Author Share Posted June 30, 2015 (edited) I kept the imports from the old file and replaced all the other with the pastebin version. Compile error 1: Fix: Compile error 2: Fix: Compile error 3: Fix: ???? True champ For the first one, we need to check if the array passed in (through the parameters) has at least 1 value. Change linkedNodes.length (in the original code, not the one you modified) to linkedNodeTypes.length.The second one, you should actually be initializing the currentNodeSet variable with the value obtained from nodeSet.get(node). Change that line to currentNodeSet = nodeSet.get(node); For the last one, replace put(nodeType, linkNodes(...)) with put(node, linkNodes(...)) I promise these kinds difficulties will not appear in future guides/snippits. I'm not at home right now, so I can't do much when it comes to running the code I release on here, and if I only released these things while I was on a computer, I'd never get to it (too many other things to focus on while on a computer). But I will make sure others have tested before releasing anything in the future. As for the other guy implementing it right, keep in mind that not everyone is at the same programming skill level. He probably saw the problems himself and fixed it up Edited June 30, 2015 by fixthissite 1 Quote Link to comment Share on other sites More sharing options...
Psvxe Posted June 30, 2015 Share Posted June 30, 2015 True champ For the first one, we need to check if the array passed in (through the parameters) has at least 1 value. Change linkedNodes.length (in the original code, not the one you modified) to linkedNodeTypes.length. The second one, you should actually be initializing the currentNodeSet variable with the value obtained from nodeSet.get(node). Change that line to currentNodeSet = nodeSet.get(node); For the last one, replace put(nodeType, linkNodes(...)) with put(node, linkNodes(...)) Error, once again. haha [ERROR][Bot #1][06/30 11:11:11 PM]: Error in script executor! java.lang.NullPointerException at fts.linked.NodeLinkerManager.run(NodeLinkerManager.java:64) at nl.psvxe.scripts.fightcave.Manager.onLoop(Manager.java:37) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(qh:114) at java.lang.Thread.run(Unknown Source) public void run() { for(Node node : currentNodeSet) { // <----- line of problem. if(node.validate()) { currentNodeSet = nodeSet.get(node.getClass()); node.execute(); } } Quote Link to comment Share on other sites More sharing options...
fixthissite Posted June 30, 2015 Author Share Posted June 30, 2015 (edited) Error, once again. haha [ERROR][Bot #1][06/30 11:11:11 PM]: Error in script executor!java.lang.NullPointerException at fts.linked.NodeLinkerManager.run(NodeLinkerManager.java:64) at nl.psvxe.scripts.fightcave.Manager.onLoop(Manager.java:37) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(qh:114) at java.lang.Thread.run(Unknown Source) public void run() { for(Node node : currentNodeSet) { // <----- line of problem. if(node.validate()) { currentNodeSet = nodeSet.get(node.getClass()); node.execute(); } } This is the version I actually tested:http://pastebin.com/ukJPBLhA You're going to need to add the constructor which access the MethodProvider, then go down to getConstructor().newInstance() and pass it to the newInstace() method. The previous pastebin I sent you was me trying to apply the changes from the version I actually tested to the version with the MethodProvider already implemented. This is the one I have ran, which I know works. You're going to have to fix up the imports, though. The other version should have worked after the changes, though. Are you sure you called "initCurrentSettings" in onStart()? And you've change nodeSet.get(node) to currentNodeSet = nodeSet.get(node) in initCurrentSettings, yeah? currentNodeSet should not be null. If it is, that means the value isn't in the map, which I've added to the map in the add method [nodeSet.put(node, linkNodes(...))]. I tried messaging you, but it keeps on saying the site lost connection. Idk what's wrong, I'ma have to report it. Edited June 30, 2015 by fixthissite Quote Link to comment Share on other sites More sharing options...
Psvxe Posted June 30, 2015 Share Posted June 30, 2015 This is the version I actually tested: http://pastebin.com/ukJPBLhA You're going to need to add the constructor which access the MethodProvider, then go down to getConstructor().newInstance() and pass it to the newInstace() method. The previous pastebin I sent you was me trying to apply the changes from the version I actually tested to the version with the MethodProvider already implemented. This is the one I have ran, which I know works. You're going to have to fix up the imports, though. The other version should have worked after the changes, though. Are you sure you called "initCurrentSettings" in onStart()? And you've change nodeSet.get(node) to currentNodeSet = nodeSet.get(node) in initCurrentSettings, yeah? currentNodeSet should not be null. If it is, that means the value isn't in the map, which I've added to the map in the add method [nodeSet.put(node, linkNodes(...))]. I tried messaging you, but it keeps on saying the site lost connection. Idk what's wrong, I'ma have to report it. @Override public void onStart() { manager = new NodeLinkerManager(this); try { manager.add(AttackHandler.class); manager.add(EatHandler.class); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { e.printStackTrace(); } manager.initCurrentSet(); } (tried both in the try catch block, and outside) public void initCurrentSet() { for(Node node : allNodes.values()) { if(node.validate()) { currentNodeSet = nodeSet.get(node); return; } } throw new IllegalStateException("No nodes can be processed"); }Do you have teamviewer or skype? Quote Link to comment Share on other sites More sharing options...
fixthissite Posted June 30, 2015 Author Share Posted June 30, 2015 @Override public void onStart() { manager = new NodeLinkerManager(this); try { manager.add(AttackHandler.class); manager.add(EatHandler.class); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { e.printStackTrace(); } manager.initCurrentSet(); } (tried both in the try catch block, and outside) public void initCurrentSet() { for(Node node : allNodes.values()) { if(node.validate()) { currentNodeSet = nodeSet.get(node); return; } } throw new IllegalStateException("No nodes can be processed"); }Do you have teamviewer or skype? Please meet me in the Chatbox and I'll give you my skype there Quote Link to comment Share on other sites More sharing options...
Joseph Posted June 30, 2015 Share Posted June 30, 2015 Team view the poor guy Quote Link to comment Share on other sites More sharing options...
fixthissite Posted June 30, 2015 Author Share Posted June 30, 2015 (edited) Team view the poor guyI did. We found out that1. I forgot to set the retention policy for the annotations. For some reason, AIDE (my mobile IDE) doesn't care for the retention of annotations 2. He was attempting to use the two systems (link and fragment) as one, which I have mentioned does not work with the first release. I created an integrated version, but apparently I forgot to release it. I'll be revamping this entire thread, with a working, cleaner version of these systems that wirk seemlessly together. Sorry for the inconvienence people. Take this as an example of what not to do when releasing snippits :P Edited June 30, 2015 by fixthissite 2 Quote Link to comment Share on other sites More sharing options...
Psvxe Posted July 1, 2015 Share Posted July 1, 2015 Team view the poor guy what you on about? Quote Link to comment Share on other sites More sharing options...
Joseph Posted July 1, 2015 Share Posted July 1, 2015 what you on about? I didnt write much on this thread but I was creeping around and read everything. Quote Link to comment Share on other sites More sharing options...