_blocksanitycheck is defined as an Int. It's called from another file. The error is still there if the code is in the same file, without the func call, but it disappears if it is not within a function.End Function

Use "superstrict" on top of your file - I bet you will spot errors already.What is "Block" - a list?

To "eachin" over something the "something" needs to implement ObjectEnumerators - as TList (linkedlist) and TMap do.

Edit: What is your function intended to do? It is planned to return "Block count" if the conditions were not met, or something lower if they do - is that right? Why not return the value itself -> "return block"?You pass a simple type - which is an "int" in this case - and you pass it as "copy" not "reference". Means if you modify "_blocksanitycheck" within the function, you will not change/alter it outside of the function. For this you need to use "_blocksanitycheck:int var".

yeah it's an extremely confusing error message. i only started properly using bmx a week ago, was using bplus before but it was annoying me so i switched

thanks

EDIT: The function basically just inserts a block, calling a method of the Block type to do it, and then rendering a rectangle based on the parameters passed to the method. This EachIn is checking if there is already a block in the x and y coordinate range of the block insertion area. since the project is in its very early stages (i plan to have it so you can upload levels to a site and stuff, and there will be contests), the args are hardcoded - 0,0,128,128,128,32,32 = Block at 0,0 with colour RGB 128,128,128 and a size of 32x32 pixels.