Reply to Re: Procedure opening/closing brackets
If you don't have an account, just leave the password field blank.
Something I noticed by accident is that any code left at the end of a script, outside of define procedures that do have opening and closing brackets can also get called.
Not sure why, or what the circumstances are, but I have a script with a main(), hit() and a touch() procedure that still calls some other code I have outside of these procedures, kinda like a set_callback_random(). This was code I originally had in the touch procedure designed to move the sprite somewhere, that I decided to see what would happen if I removed it. So I thought, I'll just cut and paste that and stick outside of any defined procedures in case I want to bring it back later.
Then when I went to test the script in DinkHD, that orphaned code was still getting executed even though it sits within it's own opening/closing curly brackets outside of the three defined procedures. This also occurred in YOD.
If I give this code a custom procedure name, like void badcode(void) then it stays isolated and un-used.
Not sure why, or what the circumstances are, but I have a script with a main(), hit() and a touch() procedure that still calls some other code I have outside of these procedures, kinda like a set_callback_random(). This was code I originally had in the touch procedure designed to move the sprite somewhere, that I decided to see what would happen if I removed it. So I thought, I'll just cut and paste that and stick outside of any defined procedures in case I want to bring it back later.
Then when I went to test the script in DinkHD, that orphaned code was still getting executed even though it sits within it's own opening/closing curly brackets outside of the three defined procedures. This also occurred in YOD.
If I give this code a custom procedure name, like void badcode(void) then it stays isolated and un-used.