Quote: "1. Use-defined functions are written at the endpart of the code."
Official line: "Yes" again, it's not strictly true, ut code is much easier to read, and more efficient if you do this
Quote: "2. Gosub jumplabels are written in the middle of the entire code. Possibly inside the main do-loop"
If you're meaning.
gosub myJumpLabel inside your loop, and
myJumpLabel: outside your loop, then you're spot on.
Your main game loop should be as few lines as possible, preferably consisting only of gosubs or function calls. This way you only read bits of code relevant to that subroutine (such as handling the camera) and not code for other subroutines (such as moving the player). When all of the relevant code is grouped together, it's easier to debug if something goes wrong.
Quote: "3. The main do-loop is written at the beggining right after initialization."
Not necessarily, suppose you want a nice graphical menu before loading your main game, this would likely be it's own loop that goes ahead of your main game loop
Quote: "4. the select-case is written in the go-subs or main do-loops"
definately not in the main loop. Write it with the function sub that uses it. If none of your existing functions or subs use it. Determine whether it should even be in your code, or if you should delete it.
Quote: "1.No looping code including a main do-loop should exist in user-defined functions."
Why not... to determine an object number that has not yet been used, so you can assign it to an object you are about to create
function findFirstObject()
[b]for x = 1 to 65535[/b]
if object exist(x) = 1 then exit
[b]next x[/b]
endfunction x
Quote: "3.No gosubs should exist within a gosub jumplabel."
There's nothing wrong with further dividing existing subroutines. An example being moving the player.
One branch for getting the list of currently being pressed,
One for translating those keys into which action they perform,
And one more for performing the actions.
Quote: "4.No select-case should exist within a select-case."
Why would you need to do this?
Quote: "5.No user-defined functions should be written within a user-defined function."
Ah, the biggie... You cannot declare a function within another function. You can leave it as that, or I can attempt to explain why (in the code box)
Firstly, all functions have to be global (accessible from any line of code). When inside a function. anything inside the function is local (can only be seen by that function, thus not accessible from anywhere).
Secondly, suppose two functions are called A and B... B is inside A. Calling function A would cause the program to run into the declaration of function B...
Function declarations (function myFunction(myParameter as integer)) must exist, but that line of code must never be reached.
Think of it like this: if a function call is reached, and the function is run, the parameters it takes have not been specified, and it will not work as you intend.
Also if your function returns a value, there is no variable to assign it to.
Of course this is most likely not the reason, but think of it this way to avoid complicating the issue