Hi again MrTAToad,
Here is sample code, just a small sample from my project, but enough to demonstrate the bug.
Please notice a few things.
The offsetX% and screenWidth% LOCAL variables defined below the TYPE definition.
In both embedded functions, offsetX% is an argument. The function called testInput() has no problem using the argument name offsetX%.
However the next function called draw() will not allow it.
This is the compile error:
_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.8.044 SN:380c888f - 3D, NET
Wordcount:11 commands
compiling:
C:\DOCUME~1\jasonl\LOCALS~1\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\DOCUME~1\jasonl\LOCALS~1\Temp\glbasic\gpc_temp0.cpp:93: error: `screenWidth' was not declared in this scope
C:\DOCUME~1\jasonl\LOCALS~1\Temp\glbasic\gpc_temp0.cpp:97: error: `offsetX' was not declared in this scope
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 1.4 sec. Time: 17:28
Build: 0 succeeded.
*** 1 FAILED ***
Also, please note I duplicated the draw() function and commented it out again, but with the suspect argument names changed to new unique names.
If you comment the original draw(), and uncomment the altered draw(), you will see changing the names fixes the problem.
Note that the testInput() function is still using the original argument offsetX% successfully.
Here is the sample code:
// --------------------------------- //
// Project: TypeBugSample
// Start: Wednesday, September 15, 2010
// IDE Version: 8.085
SYSTEMPOINTER TRUE
SETCURRENTDIR("Media")
TYPE bowl
file$
id%
id2%
chnInst% = 4
chn% = 0
chn2% = 0
vol# = 0.8
dur%
rep%
sTime%
cTime%
phase%
x%
y%
width%
height%
color%
FUNCTION testInput: touchX, touchY, offsetX%
IF (touchX >= (self.x% + offsetX%)) AND (touchX <= (self.x% + self.width% + offsetX%)) AND (touchY >= self.y%) AND (touchY <= (self.y% + self.height%))
RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ENDFUNCTION
FUNCTION draw: screenWidth%, offsetX%
IF (self.x% + offsetX% + self.width% > 0) AND (self.x% + offsetX% < screenWidth%)
DRAWRECT self.x% + offsetX%, self.y%, self.width%, self.height%, self.color%
ENDIF
ENDFUNCTION
// FUNCTION draw: scrWidth%, offset_X%
// IF (self.x% + offset_X% + self.width% > 0) AND (self.x% + offset_X% < scrWidth%)
// DRAWRECT self.x% + offset_X%, self.y%, self.width%, self.height%, self.color%
// ENDIF
// ENDFUNCTION
ENDTYPE
LOCAL screenWidth% = 480
LOCAL offsetX% = 0
Regards,
Dave