• 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.

A Little Coding Problem that's Driving me Mad

gadgets

Resource contributor
Messages
9,388
Country
ca-britishcolumbia
Question of the day. Why won't the counter "pclTimer" increment. It appears to remain at 1 after initialization and after the transponder code is changed to other than "0066". I've been looking at this code for two days now (and it hasn't helped). I guess I'm "too close to the forest to see the trees".

Don
db 'R','I','F','F' ; RIFF file identifier
dd bgl_data_end - $ - 4 ; size of RIFF data
db 'M','D','L','9' ; file identifier (FS9 model)
db 'M','D','L','H'
dd visual_model_header_end - $ - 4
dd visual_model_header_end - $ - 4
dd 0
dd 0
dd 10
dd 0
dd 0
dd 152
db 'F','S','8','0'
dd 2304
visual_model_header_end label dword
db 'I','S','F','T'
dd ver_end - $ - 4
db "Airfield Lights Toolkit 1.1.00(h)",0
ver_end label word
db 'B','B','O','X'
dd bounding_box_riff_end - $ - 4
real4 -0.5, 0.0, -0.5
real4 0.5, 1.0, 0.5
bounding_box_riff_end label word
db 'E','X','T','E'
dd exterior_riff_end - $ - 4
db 'B','G','L',' '
dd bgl_riff_end - $ - 4
JUMP startBGL_Lights
localVars label word
localVars_PCL label word
pclFlag label word
dw 0
pclTimer label word
dw 0
pclTable label word
dw 2
dw 0, 1, 999, 1000
startBGL_Lights label BGLCODE
VAR_BASE_32 VAR_BASE_GLOBAL
IFIN1 timeLights, trans_freq, 066h, 066h ; lights to be on when code "0066" selected
startTimer label BGLCODE
LOCAL_BASE_32 localVars_PCL
SETWRD offset pclTimer - localVars_PCL, 1 ; start the counter <----- INITIALIZATION
JUMP drawBGLLight
timeLights label BGLCODE
LOCAL_BASE_32 localVars_PCL
IFIN1 chkOperatingHours, offset pclTimer - localVars_PCL, 1, 540 ; 0-15 minutes
VAR_BASE_OVERRIDE VAR_BASE_GLOBAL
IFMSK skipCount, BGL_TICK18, 01h ; add one to the count every second tick
IFIN1 drawBGLLight, offset pclFlag - localVars_PCL, 0, 0 ; flag skips the counter until tick18 completes cycle
BGL_INTERPOLATE VAR_BASE_LOCAL, offset pclTimer - localVars_PCL, VAR_BASE_LOCAL, offset pclTimer - localVars_PCL, VAR_BASE_LOCAL, offset pclTable - localVars_PCL
SETWRD offset pclFlag - localVars_PCL, 1
JUMP drawBGLLight
skipCount label BGLCODE
VAR_BASE_32 VAR_BASE_LOCAL
SETWRD offset pclFlag - localVars_PCL, 0 ; reset the flag
JUMP drawBGLLight
chkOperatingHours label BGLCODE
insideOperatingHours label BGLCODE
VAR_BASE_32 VAR_BASE_GLOBAL
IFIN1 lightsOff, tod, 2, 4 ; if not daytime
drawBGLLight label word
VAR_BASE_32 VAR_BASE_GLOBAL
BGL_LIGHT BGL_LIGHT_TYPE_SMALL_HALO, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0C0C0C0h, 0.0, 0.0, 0.0
BGL_LIGHT BGL_LIGHT_TYPE_SMALL_HALO, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0C0C0C0h, 0.0, 0.0, 0.0
endLightsOn label word
lightsOff label word
end_BGL_LIGHTs label word
BGL_END
BGL_RETURN
bgl_riff_end label BGLCODE
exterior_riff_end label BGLCODE
bgl_data_end label BGLCODE
 
Last edited:
And the answer is, it doesn't appear that the BGL_INTERPOLATE can be used to effect an up-counter simply by reversing the values in the "standard" count-down table. Once I restored count-down operation, all was well. Who knew???

Don
 
Back
Top