I have a fairly complex scratch project that is akin to the old favorite "Breakout" but am getting a weird issue.
I have several scripts that start out:
[blocks]
<when green flag clicked>
<hide>
<forever if> some_variable = 1
<show>
[/blocks]
If I click the green flag once, everything shows up and starts running; the stuff I expect to show up, and the stuff I expect to be hidden even though the forever if condition is not met. I verified this with variable reporting on screen. However, if I click the green flag a second time, everything will restart and be properly hidden.
Any ideas?
Offline
Add a wait 0 seconds at the start.
Offline
What might be happening is that the script you provided is getting executed before the script that sets your variables at the start of your project, thus the values it reads are those left from the last time you ran the project - this would also explain why it all works the second time you run it.
Like scimonster suggested, you can try adding a wait block at the beginning, but to completely guarantee that it will not bug out, move all the [set variable to] blocks to your variable detecting scripts.
Offline
Thanks to both scimonster and myredneptune for the responses. It was more practical, although admittedly less clean to just add the wait 0 seconds to the beginning of those scripts. It worked like a charm, I think they were indeed executing first before my other script.
Thanks for the help
Nick
Offline
You're welcome.
Common problem.
Offline