August 6, 201510 yr I have just released my framework's source code to the public over at GitHub. Not much explanation necessary. Criticise, learn from and improve on as you please https://github.com/carbage/OSBot-Framework
August 6, 201510 yr Why would you only execute the first available node? Isn't the entire idea of nodes to have multiple things happen in the same loop? Regarding this in NodeScript: for (Node n : nodes) { if (n.validate()) { return getContext().getAbhelper().getNextDelay() + n.execute(); } }
August 6, 201510 yr Why would you only execute the first available node? Isn't the entire idea of nodes to have multiple things happen in the same loop? Regarding this in NodeScript: for (Node n : nodes) { if (n.validate()) { return getContext().getAbhelper().getNextDelay() + n.execute(); } } What if you have two contradicting nodes that both return true? Then in the same loop one node starts to execute, before it can finish the next one fights for control. If you break on the first valid node it allows for a sort or priority. This is how it should be done. Edited August 6, 201510 yr by Mysteryy
August 6, 201510 yr Author Why would you only execute the first available node? Isn't the entire idea of nodes to have multiple things happen in the same loop? Regarding this in NodeScript: for (Node n : nodes) { if (n.validate()) { return getContext().getAbhelper().getNextDelay() + n.execute(); } } It's more of a hacky approach to priorities.
August 6, 201510 yr What if you have two contradicting nodes that both return true? Then in the same loop one node starts to execute, before it can finish the next one fights for control. If you break on the first valid node it allows for a sort or priority. This is how it should be done. There would be no fighting over control as this is all ran synchronously. I mean I could understand if it was separate threads but this is all synchronous right?
August 6, 201510 yr There would be no fighting over control as this is all ran synchronously. I mean I could understand if it was separate threads but this is all synchronous right? I guess if you have not experienced what we are talking about then its difficult to understand what I mean. Say you have 10 nodes in your list. During the next loop, 2 of those nodes are going to return valid, meaning they will execute(). The first valid node is hit, it executes. But one iteration is not enough to make this node complete. i.e. it needs to execute() at least one more time before it completes successfully. For example, you are trying to click a magic spell, the first iteration thru the loop opens the magic tab, but doesn't click the spell. The second iteration would click the magic spell now that the tab is open. But since you are executing 2 nodes, there is a node after it that will execute. Say this node is to eat food. The eat food node is going to open the inventory tab to eat the food. So the first iteration in the loop, the inventory tab is opened. The second iteration the food will actually be clicked. So in your first loop this is what happened: -The magic tab is opened and ready to click a spell -Our hp was low so eat food node executed, the inventory tab opened to eat food Now the next loop these 2 nodes need to execute again -Magic node executes, since we opened the inventory, we need to open the magic tab again. -Now the eat node is hit, we should be clicking the food, but we have a conflict between these 2 nodes, so the inventory tab is opened again. These 2 nodes would just get stuck fighting eachother over and over. Breaking on the first valid node allows for the complete removal of any chance of this happening. Edited August 6, 201510 yr by Mysteryy
August 6, 201510 yr I guess if you have not experienced what we are talking about then its difficult to understand what I mean. Say you have 10 nodes in your list. During the next loop, 2 of those nodes are going to return valid, meaning they will execute(). The first valid node is hit, it executes. But one iteration is not enough to make this node complete. i.e. it needs to execute() at least one more time before it completes successfully. For example, you are trying to click a magic spell, the first iteration thru the loop opens the magic tab, but doesn't click the spell. The second iteration would click the magic spell now that the tab is open. But since you are executing 2 nodes, there is a node after it that will execute. Say this node is to eat food. The eat food node is going to open the inventory tab to eat the food. So the first iteration in the loop, the inventory tab is opened. The second iteration the food will actually be clicked. So in your first loop this is what happened: -The magic tab is opened and ready to click a spell -Our hp was low so eat food node executed, the inventory tab opened to eat food Now the next loop these 2 nodes need to execute again -Magic node executes, since we opened the inventory, we need to open the magic tab again. -Now the eat node is hit, we should be clicking the food, but we have a conflict between these 2 nodes, so the inventory tab is opened again. These 2 nodes would just get stuck fighting eachother over and over. Right, I see. Thanks for explaining
August 6, 201510 yr The enums containing data and the webwalker are the things which seem the most helpful, I've taken a look at the enums going to take a skim of web walker as well. Overall it looks pretty neat!