Now, even though that is not true (as it has a structure), it still errors out. I would love to see the ability to declare variables based on a structure in a future version of PB.
Its not working in PB 3.90 for me. .. Oh nvm, I was trying to use the variable in a For....Next Loop... bleh, I gotta remember that the loops in PB are very restrictive ....any chance of using variables in the future with loops?
Structure MapRec
Levels.l
MaxX.l
MaxY.l
EndStructure
MapHeader.MapRec ;The map header
L.l
X.l
Y.l
ML.l
ML = MapHeader\Levels
MX.l
MX = MapHeader\MaxX
MY.l
MY = MapHeader\MaxY
For L = 1 To ML
For X = 1 To MX
For Y = 1 To MY
;Empty Loop
Next
Next
Next
*sigh* It still gives the error message, Even with numbers assigned to them. I found a way around this (AFAIK) "bug". Declare the variable as an array, and it will run.
Can anybody move this back into the bugs section for Fred's attention?
Structure MapRec
Levels.l
MaxX.l
MaxY.l
EndStructure
MapHeader.MapRec ;The map header
MapHeader\Levels = 2
MapHeader\MaxX = 3
MapHeader\MaxY = 3
ML.l = MapHeader\Levels
MX.l = MapHeader\MaxX
MY.l = MapHeader\MaxY
If OpenConsole()
L.l : X.l : Y.l
PrintN("L,X,Y")
PrintN("-----")
For L = 1 To ML
For X = 1 To MX
For Y = 1 To MY
PrintN(Str(L)+","+Str(X)+","+Str(Y))
Next Y
Next X
Next L
Input()
CloseConsole()
EndIf
End
That seems to work for me. Hrm, I wonder why ah... cant assign constants to variables in structures can we? lol. Thats the only diff in code. hrm and them being in diff files.. argh, what a PITA.
I figured out the problem!! The variable must be declared as a global in order to be referenced in a procedure Thanks guys!