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

ASM variable for 18hz timer

Horst18519

Moderator
Resource contributor
Messages
2,370
Country
germany
Once again I'm lost when it comes to coding... :eek:

After having spent lots of time on understanding separation planes, conditional tweaking and everything I have another issue I'm lost at: How do I create a running rabbit using the 18hz timer?

I tried the beacnt variable but this doesn't offer the option to "make the rabbit running" (and is too slow), so I think a 18hz timed conditional display is the way to go.

Does someone know the lines to create a simple 18hz timer and make my 8 strobes blink with maybe every tick? (1,2,3,4,5,6,7,8 - pause til 18 - 1,2,3,4...)
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi,

Tick18 is the variable 05FCh.

If you are happy with 16 instead of 18 ticks, you can use the IFMSK command to check for 0, 1, 2, 3, 4, 5, etc.

So something like this:

Code:
IFMSK lbl01, 5FCh, 0
; first light
IFMSK lbl01, 5FCh, 1
; second light
IFMSK lbl01, 5FCh, 2
; third light
IFMSK lbl01, 5FCh, 3
; fourth light

; etc
 

Horst18519

Moderator
Resource contributor
Messages
2,370
Country
germany
Just to understand what's happening, this is my code at the moment:

IFMSK nextlight1, 5FCh, 0
BGL_LIGHT LIGHT_NAV, -1.192, 0.897, -0.425, 20, 0.60, 0.40, 0FF9EC6F4h, 0.000000, 0.000000, 1.000000 ; source poly num = 53

nextlight1 label BGLCODE

IFMSK is some sort of an if trigger - if the value of 5FCh is 0 then go to nextlight1? or is it if not?

Is there a range for the 5FCh var like 0,1 or 0,0 or is there just the option to check if the value is the specific value (3 or 5 or whatever) or not?
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi,

IFMSK does not check the value of the variable, but it is a mask that checks if certain bits are set or not.

Now that I think about it, it is not as simple as I wrote before :). When the value is 3, the bits for 1 are also set for example. So what I wrote before does not work.

How quick does your rabbit have to run?
 

Horst18519

Moderator
Resource contributor
Messages
2,370
Country
germany
After a few trial-and-errors I have to agree, it's not quite that easy.

The rabbit should run like a realistic approach light rabbit, but if it's a bit faster that's ok.
 

Horst18519

Moderator
Resource contributor
Messages
2,370
Country
germany
Ok, here's my latest code. It actually works :) even though not flawless:

IFMSK light1, 5FCh, 15
BGL_JUMP_32 nextlight1

light1 label BGLCODE
IFMSK nextlight1, 5FCh, 16
BGL_LIGHT LIGHT_NAV, -43.717, 21.991, 483.841, 20, 0.60, 0.40, 0FF9EC6F4h, 0.000000, 0.000000, 1.000000 ; source poly num = 61

nextlight1 label BGLCODE



IFMSK light2, 5FCh, 14
BGL_JUMP_32 nextlight2

light2 label BGLCODE
IFMSK nextlight2, 5FCh, 15
BGL_LIGHT LIGHT_NAV, -37.644, 17.273, 412.242, 20, 0.60, 0.40, 0FF9EC6F4h, 0.000000, 0.000000, 1.000000 ; source poly num = 60

nextlight2 label BGLCODE



IFMSK light3, 5FCh, 13
BGL_JUMP_32 nextlight3

light3 label BGLCODE
IFMSK nextlight3, 5FCh, 14
BGL_LIGHT LIGHT_NAV, -32.716, 13.521, 356.465, 20, 0.60, 0.40, 0FF9EC6F4h, 0.000000, 0.000000, 1.000000 ; source poly num = 59

nextlight3 label BGLCODE



IFMSK light4, 5FCh, 12
BGL_JUMP_32 nextlight4

light4 label BGLCODE
IFMSK nextlight4, 5FCh, 13
BGL_LIGHT LIGHT_NAV, -27.505, 9.738, 297.460, 20, 0.60, 0.40, 0FF9EC6F4h, 0.000000, 0.000000, 1.000000 ; source poly num = 58

nextlight4 label BGLCODE



IFMSK light5, 5FCh, 11
BGL_JUMP_32 nextlight5

light5 label BGLCODE
IFMSK nextlight5, 5FCh, 12
BGL_LIGHT LIGHT_NAV, -22.216, 6.283, 237.591, 20, 0.60, 0.40, 0FF9EC6F4h, 0.000000, 0.000000, 1.000000 ; source poly num = 57

nextlight5 label BGLCODE



IFMSK light6, 5FCh, 10
BGL_JUMP_32 nextlight6

light6 label BGLCODE
IFMSK nextlight6, 5FCh, 11
BGL_LIGHT LIGHT_NAV, -16.876, 2.447, 177.131, 20, 0.60, 0.40, 0FF9EC6F4h, 0.000000, 0.000000, 1.000000 ; source poly num = 56

nextlight6 label BGLCODE



IFMSK light7, 5FCh, 9
BGL_JUMP_32 nextlight7

light7 label BGLCODE
IFMSK nextlight7, 5FCh, 10
BGL_LIGHT LIGHT_NAV, -11.676, 0.897, 118.263, 20, 0.60, 0.40, 0FF9EC6F4h, 0.000000, 0.000000, 1.000000 ; source poly num = 55

nextlight7 label BGLCODE



IFMSK light8, 5FCh, 8
BGL_JUMP_32 nextlight8

light8 label BGLCODE
IFMSK nextlight8, 5FCh, 9
BGL_LIGHT LIGHT_NAV, -6.443, 0.897, 59.031, 20, 0.60, 0.40, 0FF9EC6F4h, 0.000000, 0.000000, 1.000000 ; source poly num = 54

nextlight8 label BGLCODE



IFMSK light9, 5FCh, 7
BGL_JUMP_32 nextlight9

light9 label BGLCODE
IFMSK nextlight9, 5FCh, 8
BGL_LIGHT LIGHT_NAV, -1.192, 0.897, -0.425, 20, 0.60, 0.40, 0FF9EC6F4h, 0.000000, 0.000000, 1.000000 ; source poly num = 53

nextlight9 label BGLCODE

I've set the lights 2-9 to small font size for better overview.
What I did is this:

I want the individual lights to appear at count 16 and only at count 16. So if the count is above 15 (=16) then the first light appears. But if the count is above 16 (=17 or higher) the light is not called.

The same procedures for the other lights (only appear if higher than 14 but not higher than 15,...).

It works apart from the fact that some of the lights blink twice even though the code seems correct.

I could live with this though as you can't really spot it with the fast movement of the rabbit. :)


Just one thing: is there any way to make the rabbit brighter/bigger? Compared to the other approach lights it appears rather dim.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi Thorsten,

I think some blink twice because IFMSK checks for a mask. So you are not checking the value of the timer, but if the bits of that value are set. For example the bits of 8 are also set when the value is 10.

The only work around for this that I can think of at the moment is to use similar interpolation tables as the animations to make a custom counter that runs from 1 to 16 as you want. Then you can just use the normal IFIN1 checks.
 

Horst18519

Moderator
Resource contributor
Messages
2,370
Country
germany
I'm afraid that's beyond my capabilities. :D

But I think I can live with the current situation, I might create a small video if anybody wants to try it too.
 
Messages
473
Country
hungary
Hello Guys,


I'm glad to find this rather old topic. I'm working on exactly the same issue.

I was checking on the wiki the pilot activated lights (http://www.fsdeveloper.com/wiki/index.php?title=Pilot_Activated_Lighting).

According the specification of ALFS-II approach light system, there are 21 strobe lights which are called Sequenced Flashing Lights.

alsfssalr.jpg


"These lights flash in sequence, usually at a speed of two consecutive sequences per second, beginning with the light most distant from the runway and ending at the Decision Bar."

Means 0,024 is our takt time. I have checked the default FS ALFS-II (created by scasm) and it is relatively close to this.

This is way faster than the tick18 which is actually 0,055.

Question is how to do it? How to control it? Any idea?
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
Hi,

There are some old timer variables, check the fs2000 scenery sdk. I think these are faster than tick 18. But when I tried them some time ago I could not get them to run a normal animation. But for your lights with just using masking it might work.
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Messages
32,883
Country
netherlands
I guess you just start by trying :). Can't remember if the wiki has some articles about basic asm tweaking that cover this topic.
 
Messages
473
Country
hungary
Hi Arno!

As you suggested I've tried to assemble the code by myself. So far I could go:

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
SETWRD 0h, 1
SETWRD 2h, 0
SETWRD 4h, 0

VAR_BASE_OVERRIDE VAR_BASE_GLOBAL
IFMSK holdlights, 05FCh, 0020h ; 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, 1, 1
BGL_LIGHT LIGHT_STROBE, -0.083, 10.103, 0.083, 20, 0.60, 0.60, 0FFDEFF00h, 0.000000, 0.000000, 1.000000 ; source poly num = 1
lightson label BGLCODE

IFIN1 lightson2, 4h, 2, 2
BGL_LIGHT LIGHT_NAV, 39.917, 10.103, 0.083, 20, 0.60, 0.40, 0FFDEFF00h, 0.000000, 0.000000, 1.000000 ; source poly num = 14
lightson2 label BGLCODE

IFIN1 lightson3, 4h, 3, 3
BGL_LIGHT LIGHT_NAV, 79.917, 10.103, 0.083, 20, 0.60, 0.40, 0FFDEFF00h, 0.000000, 0.000000, 1.000000 ; source poly num = 15
lightson3 label BGLCODE

IFIN1 lightson4, 4h, 4, 1000
SETWRD 0h, 0 ; turn the switch off
SETWRD 2h, 0 ; reset the flag
SETWRD 4h, 0 ; reset the counter
lightson4 label BGLCODE

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


BGL_LIGHT LIGHT_STROBE, -0.083, 5.103, 0.083, 20, 1.0, 1.00, 0FFFF0202h, 0.000000, 0.000000, 1.000000 ; source poly num = 1
IFMSK bitsnotset, 05FCh, 0020h
BGL_LIGHT LIGHT_NAV, 39.917, 5.103, 0.083, 20, 0.60, 0.40, 0FFFF0202h, 0.000000, 0.000000, 1.000000 ; source poly num = 14
bitsnotset label BGLCODE
BGL_LIGHT LIGHT_NAV, 79.917, 5.103, 0.083, 20, 0.60, 0.40, 0FFFF0202h, 0.000000, 0.000000, 1.000000 ; source poly num = 15


BGL_RETURN

I've used the wiki tutorial "pilot activated light".

The code is correct in terms of asm language, it is getting assembled. The only problem is, only the first light is blinking, the second and the third not.

What I wanted to have that light_table_localvars 4h space is increasing and checked with IFIN1 to switch on the different lights (at the end it should be 25 different lights) when 26th is reached the counter gets reseted.

Thanks for all your help!
 
Top