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

Time tweaking applied

Messages
374
Country
italy
Hi,
using the logic behind VGDS I'm experimenting a new thing: I would show a box with a number mapped on a face and each 0.5 secs change to the next in order to create a bouncing counter
(1..2..3..4..5..4..3..2..1)
I create a long texture with square and on each square a number drawn. To tweak I used the BGL_TICK18, here's the code:

Code:
MATERIAL 1,0 ; <255,255,255,255> COUNTER.BMP;;;
	
	IFMSK dian02, BGL_TICK18, 0020h
		DRAW_TRI_BEGIN 24, 4
		DRAW_TRI    3,   2,   0 ; poly=12 part=1
		DRAW_TRI    0,   1,   3 ; poly=11 part=1
		DRAW_TRI_END
		BGL_JUMP_32 diend	
		dian02 label word	
	IFMSK dian03, BGL_TICK18, 0024h
		DRAW_TRI_BEGIN 28, 4
		DRAW_TRI    3,   2,   0 ; poly=12 part=1
		DRAW_TRI    0,   1,   3 ; poly=11 part=1
		DRAW_TRI_END
		BGL_JUMP_32 diend	
		dian03 label word			
	IFMSK dian04, BGL_TICK18, 0026h		
		DRAW_TRI_BEGIN 32, 4
		DRAW_TRI    3,   2,   0 ; poly=12 part=1
		DRAW_TRI    0,   1,   3 ; poly=11 part=1
		DRAW_TRI_END
		BGL_JUMP_32 diend			
		dian04 label word	
	IFMSK dian05, BGL_TICK18, 0028h		
		DRAW_TRI_BEGIN 36, 4
		DRAW_TRI    3,   2,   0 ; poly=12 part=1
		DRAW_TRI    0,   1,   3 ; poly=11 part=1
		DRAW_TRI_END
		BGL_JUMP_32 diend			
		dian05 label word	
	IFMSK dian06, BGL_TICK18, 0030h		
		DRAW_TRI_BEGIN 32, 4
		DRAW_TRI    3,   2,   0 ; poly=12 part=1
		DRAW_TRI    0,   1,   3 ; poly=11 part=1
		DRAW_TRI_END
		BGL_JUMP_32 diend			
		dian06 label word			
	IFMSK dian07, BGL_TICK18, 0032h		
		DRAW_TRI_BEGIN 28, 4
		DRAW_TRI    3,   2,   0 ; poly=12 part=1
		DRAW_TRI    0,   1,   3 ; poly=11 part=1
		DRAW_TRI_END
		BGL_JUMP_32 diend	
		dian07 label word	
		
		DRAW_TRI_BEGIN 24, 4
		DRAW_TRI    3,   2,   0 ; poly=12 part=1
		DRAW_TRI    0,   1,   3 ; poly=11 part=1
		DRAW_TRI_END		
	diend label word	
    BGL_RETURN

The code itself works, but I have a strange effects. The number are shown in a different order. I guess it depends on time calculation...sincerely I dunno how to calculate time fractions. any help?
 
Hi,

I think it is related to the why you use the IFMSK command. It does not check if the value of the timer is exactly what you specify, but it checks a mask (so if all those bits are set). I guess that might give some overlap in your checks at the moment, which would explain the results.

I think you should try to make sure that the different masks you are applying don't overlap with each other.

At what rate (in seconds) do you want the textures to switch?
 
Hi Arno,
thanks for reply. I would set 0.3 or 0.2 secs as time interval.
 
Last edited:
Hi,

Given that time step you would like the animation to switch every 4 frames (based on the 18 Hz timer). To make the math slightly easier I assume you want 8 different states, so then you have 32 frames in total. Looking at binary form of the timer variable that means it should progress like this:

Code:
00 00000
01 00001
02 00010
03 00011
04 00100
05 00101
06 00110
07 00111
08 01000
09 01001
10 01010
11 01011
12 01100
13 01101
14 01110
15 01111
16 10000
17 10001
18 10010
19 10011
20 10100
21 10101
22 10110
23 10111
24 11000
25 11001
26 11010
27 11011
28 11100
29 11101
30 11110
31 11111

From this you can see we need multiple checks. I have named the labels so that they correspond with the 8 sequences you want to have. I hope it makes sense (and that it works, I did not test the code).

Code:
MATERIAL 1,0 ; <255,255,255,255> COUNTER.BMP;;;

IFMSK sq1234, BGL_TICK18, 16
IFMSK sq56, BGL_TICK18, 8
IFMSK sq8, BGL_TICK18, 4
   DRAW_TRI_BEGIN 28, 4
   DRAW_TRI    3,   2,   0 ; poly=12 part=1
   DRAW_TRI    0,   1,   3 ; poly=11 part=1
   DRAW_TRI_END
   BGL_JUMP_32 sqend
sq8 label word
   DRAW_TRI_BEGIN 24, 4
   DRAW_TRI    3,   2,   0 ; poly=12 part=1
   DRAW_TRI    0,   1,   3 ; poly=11 part=1
   DRAW_TRI_END
   BGL_JUMP_32 sqend
sq56 label word
IFMSK sq5, BGL_TICK18, 4
   DRAW_TRI_BEGIN 32, 4
   DRAW_TRI    3,   2,   0 ; poly=12 part=1
   DRAW_TRI    0,   1,   3 ; poly=11 part=1
   DRAW_TRI_END
   BGL_JUMP_32 sqend
sq5 label word
   DRAW_TRI_BEGIN 36, 4
   DRAW_TRI    3,   2,   0 ; poly=12 part=1
   DRAW_TRI    0,   1,   3 ; poly=11 part=1
   DRAW_TRI_END
   BGL_JUMP_32 sqend
sq1234 label word
IFMSK sq12, BGL_TICK18, 8
IFMSK sq4, BGL_TICK18, 4
   DRAW_TRI_BEGIN 32, 4
   DRAW_TRI    3,   2,   0 ; poly=12 part=1
   DRAW_TRI    0,   1,   3 ; poly=11 part=1
   DRAW_TRI_END
   BGL_JUMP_32 sqend
sq4 label word
   DRAW_TRI_BEGIN 36, 4
   DRAW_TRI    3,   2,   0 ; poly=12 part=1
   DRAW_TRI    0,   1,   3 ; poly=11 part=1
   DRAW_TRI_END
   BGL_JUMP_32 sqend
sq12 label word
IFMSK sq1, BGL_TICK18, 4
   DRAW_TRI_BEGIN 28, 4
   DRAW_TRI    3,   2,   0 ; poly=12 part=1
   DRAW_TRI    0,   1,   3 ; poly=11 part=1
   DRAW_TRI_END
   BGL_JUMP_32 sqend
sq1 label word
   DRAW_TRI_BEGIN 24, 4
   DRAW_TRI    3,   2,   0 ; poly=12 part=1
   DRAW_TRI    0,   1,   3 ; poly=11 part=1
   DRAW_TRI_END
   BGL_JUMP_32 sqend
sqend label word
BGL_RETURN
 
Great, do you understand the logic behind it? I guess I should turn that into a Wiki article as well.
 
I think so, seems quite simple. I will try to modify the code as I would put another 2 frames to each cycle in order to have a more smooth effects. I'll keep u informed!
 
Back
Top