Using variables in dynamic scenery

Arno,
don't forget to mention, that these are variables used for static scenery and are available mainly for section 9. For dynamic scenery, there are different variables which can also be used like:

0018 objects pitch, bank and heading data (readonly)

0024 different objects flag, readonly!
values to check:
0x0001 anti collision stopping disabled
0x0002 unused
0x0004 gear bit
0x0008 unused
0x0010 day
0x0020 dawn / dusk
0x0040 night
0x0F00 mask for density bits (0...4 valid)
0x1000 object is considered "other traffic"
0x2000 object is considered "service traffic"
0x4000 object is considered "ground aircraft traffic"
0x8000 object is considered "airborne aircraft traffic"

for example: IfVarRange( :AntiCollision_disable 0024 0x0001 0x0001 )

0026 timer variable, I think it's the same as 5FC (readonly)

002C Object radius in meters (read-write!)
SetVar( 002C 0 )
IfVarRange( :toosmall 002C 0 2 )

0030, 0032, 0034, 0036, 0038, 003A, 003C, 003E (read-write) - color or user variables 0-7
for ex.: SetVar( 0030, 1 )

There are also other but for dynamic scenery these are by my opininon the most important.

To come back to section 9 variables. ADF frequency has 2 variables, not only one. First one, 7C6 is used for checking whole numbers, then there is another 7CA or sth like that, that can be used for reading decimal numbers.

Arno, do You need some examples for SCASM and ASM? I can help You with the SCASM (I am just learning ASM+gmax+...).

Hope it helps and best regards,
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Good point, these are indeed the variables as they are available to the scenery (and aircraft). Dynamic scenery can not access them, but has their own local variable space with the variables you listed above. These are also documented rather nice in the Fs2000 SDK.

For this tutorial I plan to stick with the variables for section 9 objects only, as I also want to give ASM/SCASM examples of code tweaks you can do. Dynamic scenery is an entirely different subject.
 
arno said:
Dynamic scenery can not access them, but has their own local variable space with the variables you listed above.
I wouldn't agree. In dynamic scenery object You can access them but with a trick. You can read and write to these variables as normally. ;)
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Yes, you can copy them from the global to the local variable space, but you can not work with them directly.
 
An interesting subject ! I work with vars in dynamic scenery all the time but...
Does anybody know how the heading Var ( 1bba ) is represented in Fs.
I've looked at it in FsInterrogate, ( At 0580 as it is in fsuipc ) and only got weird values. When trying to use it dynamic scenery, as a trigger, it doesn't matter which values ( hex, dec ) I test.

Regards, Peter
 
arno said:
Yes, you can copy them from the global to the local variable space, but you can not work with them directly.
Negative!
Use Varbase[-1] and You are working with them normaly ;) But don't forget to end Varbase!
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Gorchi said:
Negative!
Use Varbase[-1] and You are working with them normaly ;) But don't forget to end Varbase!
Ah, that is good to know. It's a very long time ago I tried to work with dynamic scenery, but back then I got mainly crashes when I tried to access certain variables :).
 
I must thank for this tip from somebody else, don't know exactly from my head (must check email) but I used it in my scenery :)
 
Hallo ! Ofcourse, why didn't I think of testing that way ! I shall try it immediately. Do you have full control in the Varbasestuff nowadays ? :wave:
Thanks, Peter
 
Hallo !
I've now tested to solve the problem described above with the heading Var through Varbaseprogramming but the result is the same. It seems like the Variable is connected to the engine:s rpm (?!). I got funny blinking effects on the object when moving the throttle. Is there someone who have some more tips...
Cheers, Peter
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi Peter,

I only used the heading variable (wind for example) to rotate an object. In that case you do not check the value itself. So I think the first thing you should try to find out is which format it is.

Is it 0 till 360?
Is it 0 till 65536?

Once you have found out what the format of the heading is, you can do other checks with it.
 
Hi Arno !
I've looked on the values with FSInterrogate. To me they make no sense. They could differ from time to another even if I have the same heading.
I've also tested with various values from 0 to 60000 but the result of the tests are the same. When shutting the engine off the blinking effect ends.
I've also tested with different hexValues but the only result I get is that the object dissapperar a couple of second then starts blinking. Is the Var 1BBA really holding the heading ?
Cheers, Peter
 
Hi Peter!
I have never tried 1BBA variable, but here is the code which fills up tanks by fuel truck:

Code:
:Polni
IfVarRange( :Dontfuel 0032 1 1 )
Varbase( :[0] )
SetVar( 288 1 )
Varbase( :[-1] )
Jump( :EndV )

:Dontfuel
IfVarRange( :EndV 0032 0 0 )
Varbase( :[0] )
SetVar( 288 0 )
Varbase( :[-1] )

:EndV
Hope it helps! :)
 

rhumbaflappy

Moderator
Staff member
Resource contributor
Hi Peter.

I haven't tried this...

FSInterrogate ( used with FSUIPC ) shows the location of 0580h as planeheading. The format is a longword ( 4 bytes ). The expression used is:

( # * ( 360 / ( 65536 * 65536 ) ) )

or ( # * 0.00000008381903171539306640625 )

The number would probably be expressed as hex, but BGLC will accept decimal if a "d" or "t" is appended to the code.

So, 1BBAh ( named plane0heading ) should contain a number that could be tested, if it follows the same format ( and we are actually reading the heading!!! ).

90* would be:

( 90 / 0.00000008381903171539306640625 ) = 1073741824d

converted to hex... 1073741824d = 40000000h

So for a static object:

Code:
IFIN1 labelname, 1BBAh, 0, 40000000h
would be the type of code that would only display an object if the heading of the aircraft is between 0* and 90*

Using this in dynamic objects is a bit beyond where I have the patience to go. :)


Dick
 
Last edited:
Thank you guys for all tips !

My intensions from the beginning when starting fiddling with this heading-var was to have it as a component in some sort of "random"-function where I should use the this and the minutes of hour Vars together . Even used with the formula above and used as ; IfVarRange ( :NoDisplay 1BBA 0x0 0x40000000 ) it doesn't work. The funny blinking effect I got, I think of it as the same effect as if you are using the timer Vars 282 to 310 on dynamic objects. So all sceneryVars are not possible to use in dynamic scenery or....

Cheers, Peter
 
Top