• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

variables buffer overflow

Messages
8
Country
us-maryland
I am coding a hanger with a number of dimensions calculated based on the input width and depth. While I have a number of Uvars I am no where near the 200 Uvars limit mentioned in the SCASM docs (my macro has 60).
When I compile the hanger in scenery using FSSC and SCASM v2.88 I get multiple ->variables buffer overflow messages
Then I get ->unknown variable messages for variables calculated using the Uvars preceding the ->variables buffer overflow messages

Anyone seen this before?
Anyone have a fix?
 
Hi,

Can you maybe post a piece of your SCASM code? That makes it easier for us to spot where the problem is. I have not seen such problems before, so I can not tell you right away what the problem could be.
 
Here is some of the code:

Area( 5 %1 %2 6 )
Set( BUF 15000 )
;BASIC Calculations
; Front/back wall dimensions
mif( [ %6 > 480 ] ) ; no greater than 10 units of 48 feet each
Uvar( $FBW [ 480 ] )
melse
Uvar( $FBW [ %6 ] )
mifend
mif( [ $FBW < 60 ] ) ; side no less than 60 feet
Uvar( $FB [ 60 ] )
melse
Uvar( $FB [ $FBW ] )
mifend

Uvar( $xp [ round[ $FB / 2 ]] ) ; front and back - door walls - full width points
; Front and back - door walls - upper width calculations
Uvar( $riwx [ round[ $xp * 0.8 ]] ) ; rough upper wall / roof - 1/2 width
; use texture multiplier of 5.3125 for all texture points
Uvar( $Rp [[ $riwx - 24 ] / 48 ] ) ; number of roof end sections (not including center 48 foot panel)
Uvar( $RpF [ int[ $riwx - 24 ] / 48 ] ) ; number of full roof end sections beyond middle
Uvar( $RpT [ $Rp - $RpF ] ) ; fractional remainder tail section
Uvar( $RTxR [ $RpT * 48 ] ) ; calculated right x point of outer wedge section
Uvar( $Twx [[ round[ $RTxR / 4 ]] * 4 ] ) ; Triangle x point (rounded to nearest multiple of 4)
Uvar( $Iwx [ 24 + [ $RpF * 48 ] + $Twx ] ) ; Final inner (upper) wall and roof 1/2 width
Uvar( $Rz [ round[ $xp * 0.42 ]] ) ; roof peak height
Uvar( $Owz [ round[ $Rz * 0.5 ]] ) ; outer wall height - tranform z value for lower panels above doors
Uvar( $OwzT [ int[ $Owz * 5.3125 ]] ) ; outer wall upper texture value for less than 48 ft panels
Uvar( $UOwz [ $Owz - 48 ] ) ; outer wall upper panel above base 48 ft panel
Uvar( $UOwzT [ int[ $UOwz * 5.3125 ]] ) ; outer wall upper texture value for panels above 48 ft panels
Uvar( $Dz [ int[ $Owz * 0.95 ]] ) ; door height
Uvar( $Iwz [ round[ $Rz - [ $Iwx * 0.25 ]] ) ; inner upper wall height - transform z value for roof wedges
Uvar( $Pbz [ $Rz - 6 ] ) ; Center peak base height- transform z parameter
Uvar( $IOz [ $Iwz - $Owz ] ) ; differential height outer wall to inner wall - for texture use
Uvar( $IOzT [ round[ $IOz * 5.3125 ]] ) ; top points for textures above door and below roof wedges
Uvar( $Mpz [ $Pbz - $Iwz ] ) ; middle panel height below peak and above lower panels
Uvar( $MpzT [ int[ $Mpz * 5.3125 ]] ) ; middle panel top texture point
Uvar( $RwT [ int[ $Twx * 5.3125 ]] ) ; Right Outer wedge outer texture point
Uvar( $LwT [ 255 - $RwT ] ) ; Left Outer wedge outer texture point
Uvar( $Tiz [ $Twx / 4 ] ) ; inner height of outer wedge section
Uvar( $TizT [ int[ $Tiz * 5.3125 ]] ) ; inner height of outer wedge section texture value
Uvar( $1TPz [ $Mpz - 12 ] ) ; outer height of 1st outer wedge section from middle section
Uvar( $1TPzT [ int[ $1TPz * 5.3125 ]] ) ; texture point value at outer height of 1st outer wedge section
Uvar( $2TPz [ $1TPz - 12 ] ) ; outer height of 2nd outer wedge section from middle section
Uvar( $2TPzT [ int[ $2TPz * 5.3125 ]] ) ; texture point value at outer height of 2nd outer wedge section
Uvar( $3TPz [ $2TPz - 12 ] ) ; outer height of 3rd outer wedge section from middle section
Uvar( $3TPzT [ int[ $3TPz * 5.3125 ]] ) ; texture point value at outer height of 3rd outer wedge section


.... and here are the first few error messages

Error in macro file D:\FSSCEN~1\Macros\ACM\KAPG\ACMHNG~1.API line 185
-> Uvar( $Tiz [ $Twx / 4 ] )
-> variables buffer overflow
Error in macro file D:\FSSCEN~1\Macros\ACM\KAPG\ACMHNG~1.API line 186
-> Uvar( $TizT [ int[ $Tiz * 5.3125 ]] )
-> unknown variable "$Tiz * 5.3125 ]"
Error in macro file D:\FSSCEN~1\Macros\ACM\KAPG\ACMHNG~1.API line 187
-> Uvar( $1TPz [ $Mpz - 12 ] )
-> variables buffer overflow
Error in macro file D:\FSSCEN~1\Macros\ACM\KAPG\ACMHNG~1.API line 188
-> Uvar( $1TPzT [ int[ $1TPz * 5.3125 ]] )
-> unknown variable "$1TPz * 5.3125 ]"
Error in macro file D:\FSSCEN~1\Macros\ACM\KAPG\ACMHNG~1.API line 189
-> Uvar( $2TPz [ $1TPz - 12 ] )
-> unknown variable "$1TPz - 12 ]"

As you can see the first -> variables buffer overflow results in a chain of other errors

Could this have something to do with the fact that I am using a series of calculations with subsequent variables being calculated from earlier ones?
 
Hi,

Humm, I have never seen these errors before. And when I used UVar's it were only 1 or 2, so I never tried something as complex as this. At this moment I can not tell you what the problem is. Maybe Luis will read this thread, I think he has used UVar's more in his macros.
 
Arno;
I went to the source...Manfred Moldenhauer ... and here is his response (for the benefit of all us dinosaurs still using SCASM)

"this error happens when the total number of variables exceeds the maximum number. In older versions this value was 200 and the actual version handles 500 user variables. Perhabs a change to a newer version will solve your problem.

BTW, the maximum number is "per file" and not per macro. So if you have one file including several macros this number can grow very quick if each macro generates its own variables."

It appears that my macro caused the total for the scenery to exceed the 500 Uvar limit Manfred identified.
 
Hi,

Thank you for sharing the explanation.

Regards, Luis - an happy SCASM dinosaur :)
 
Yes, thanks as well for sharing. It is good to know undocumented "features" like this :D.
 
Back
Top