November 13, 20187 yr I have an if statement inside of my onLoop which contains all of the code that would normally be in the onLoop. The only way the code will run is if "started" equals "true", and the only place "started" is changed from "false" to "true" is inside of the action listener for my start button in the GUI. However, about 25% of the time the code inside of onLoop and the if statement runs even if you haven't hit "Start" in the GUI. Using the search tool I've found nowhere else in my code that changes "started" to true besides for that action listener. I don't know what to do.
November 14, 20187 yr Author 45 minutes ago, Juggles said: Use paint and see if the action is returning true sometimes I'll try this, but if it's returning true sometimes for no reason, how would I fix that?
November 14, 20187 yr Move your check to onStart() and remove the if from your onLoop(). if (!started) { stop(); return; }
November 14, 20187 yr I have ran into similar problems in the past that I believe were caused by caching issues between script executions. However, it would be worth seeing your code and for me to test whether I encounter the same problem. Edited November 14, 20187 yr by liverare
November 14, 20187 yr If you're saving the isStarted boolean as a static and you're using this in a local script, you need to hit the refresh button on the script selector once to make sure all the static variables are being 'reset'. Edited November 14, 20187 yr by Eagle Scripts
November 19, 20187 yr Author On 11/14/2018 at 7:51 AM, Eagle Scripts said: If you're saving the isStarted boolean as a static and you're using this in a local script, you need to hit the refresh button on the script selector once to make sure all the static variables are being 'reset'. I need to refresh the script selector every time I run the script but this worked. However is this only because it's a local script? If it was an SDN script or a private script would it not have the issue? Also is there a way to fix this issue with code? Edited November 19, 20187 yr by Jack Shep
Create an account or sign in to comment