Posted: 28th Jun 2007 12:32
i had some code that went along the lines of this:
+ Code Snippet
global ConsoleSprite as integer
...
ConsoleBGSprite = FreeSprite()
...
sprite ConsoleBGSprite,0,0,ConsoleBGImage
...
delete sprite ConsoleBGSprite


this code would not not work until i made this change
(i would get an error saying that the sprite number has to be above 0)
+ Code Snippet
global Console[i]BG[/i]Sprite as integer


i am very confused as to how a logically unrelated object was the cause, i am at fault for labeling it wrong but all the other instances of the variable are labelled right...very confusing
Posted: 28th Jun 2007 13:25
well ConsoleBGSprite is not a global variable, were you trying to alter the sprite inside a function using the variable ConsolBGSprite?
Posted: 28th Jun 2007 13:31
yeah thats probly the problem(they were in seperate functions),
although my code still hates me, i have an empty placeholder function (that i plan to fill soon) that compile before without incident, but now it says SetupWeapons() command is not recognised, and when i REM the SetupWeapons() call it says that the type declaration is not valid on a type that is not linked in any way to this function (and i say again...the function is empty)
maybe codesurge just needs a rest

EDIT: it happens in the default IDE too!!!
Posted: 28th Jun 2007 15:32
You've probably got a function and variable/array with identical names.

That first post of yours is purely your bug - it was definitely your code that was the problem if the ConsoleBGSprite variable was set in the function without a matching global declaration
Posted: 28th Jun 2007 15:59
yeah i know, i didnt take global variables into account, im terrible at troubleshooting code, i normally go straight over the bug.

also i searched the entire code for anything with the SetupWeapons name and it only turned up the function and its calling command

EDIT: Found it!, turns out i didnt have an endfunction command on the end of one of my player functions and the setup weapons function was being declared inside another function (its odd how dbpro doesnt point straight to the problem)
Posted: 28th Jun 2007 16:03
Is the function closed with 'endfunction' or 'end function'? The first one is the correct one.
Posted: 28th Jun 2007 16:04
ha, we both said the same thing at the same time lol