FSXA pilot activated lighting problem

#1
Hi,


I'm working on a pilot activated lighting which should switch off after a fixed period of time.
But the light stays on all the time, which it shouldn't.The code is based on the wiki.


I checked the code pretty much times but actually it's not working.

I would say the problem is the counter itself it doesn't count up so the target which is checked by IFIN1 is never reached.
I don't have a clue where the fault is in detail located. It's getting so frustrating so I decided to ask you guys.



thank you very much in advance :)


P.S.
if you need the asm or asm_0 file just let me know



Trinity
Code:
test_MasterScale_1 label BGLCODE
    BGL_FTAG "MasterUnitConve", 0.00               ; Node 2

    ; Node 2 - MasterUnitConversion transform:

     BGL_SET_MATRIX_INDIRECT    1
    BGL_FTAG "RotateAroundX", 0.00               ; Node 3

    ; Node 3 - RotateAroundX transform:

     BGL_SET_MATRIX_INDIRECT    2
    BGL_FTAG "LIGHT_NAV", 0.00               ; Node 4

    ; Node 4 - LIGHT_NAV transform:

     BGL_SET_MATRIX_INDIRECT    3

     


test_MasterScale_2 label BGLCODE

BGL_JUMP_32 skiptables

light_table_localvars label word
   dw  0  ; switch
   dw  0  ; flag
   dw  0  ; counter

light_table_addone label word
   dw  2
   dw  0,1,999,1000

skiptables label BGLCODE



LOCAL_BASE_32 light_table_localvars

VAR_BASE_32 VAR_BASE_GLOBAL

IFIN1 timelights, 07C0h, 1400h, 1400h    ;  NAV1 on 114.0
VAR_BASE_32 VAR_BASE_LOCAL
SETWRD 0h, 1                    ; turn the light switch on
SETWRD 2h, 0                    ; reset the flag
SETWRD 4h, 0                    ; reset the counter
BGL_JUMP_32 lightson
timelights label BGLCODE


LOCAL_BASE_32 light_table_localvars
IFIN1 nolights, 0h, 1, 1        ; check the light switch
VAR_BASE_OVERRIDE VAR_BASE_GLOBAL ; switch to the local variable space for one command only
IFMSK holdlights, 05FCh, 0010h  ; add one to the count every 1.78 seconds
IFIN1 skipcount, 2h, 0, 0       ; flag skips the counter until tick18 completes cycle
BGL_INTERPOLATE VAR_BASE_LOCAL,4h,\
                VAR_BASE_LOCAL,4h,\
                VAR_BASE_LOCAL, (offset light_table_addone - light_table_localvars)
SETWRD 2h, 1

skipcount label BGLCODE
IFIN1 lightson, 4h, 80, 1000   ; should count to 80
SETWRD 0h, 0                    ; turn the switch off
SETWRD 2h, 0                    ; reset the flag
SETWRD 4h, 0                   ; reset the counter
BGL_JUMP_32 nolights

holdlights label BGLCODE
SETWRD 2h, 0                    ; reset the flag

lightson label BGLCODE

VAR_BASE_32 VAR_BASE_GLOBAL

BGL_LIGHT LIGHT_NAV, 10.0, 0.5, 0.0, 40, 0.60, 0.40, 0FFFFFFFFh, 0.0, 0.0, 1.0

nolights label BGLCODE

BGL_RETURN

bgl_riff_end_test    label    BGLCODE
 
Top