I found and borrowed some code for using a pot to set rudder trim. The code listed below works. My question is what do the various math steps do. I would like to understand HOW it works, not just copy.
The code is: Var 0085, Link FSUIPC_OUT, Offset $2EC0, Length 8, Numbers 2 // inicio scrip rudder trim
Hopw you understand it with the following explanation :
1) the middle point of the pot should result in 0 so 126 * 155 = 19530 => V0085 will be 0 if the V0400 = 126
(I would probably change this to 125*155=19375 => so V0085 would be 0 at V0400=125)
2) the pot can increase then its value to 255 => V0085 = 19.995
or it can decrease to 0 => V0085 = -19.530
turning of the rudder trim pot will result in a value from -19.530 to 19.995.
Now we have defined here the FSUIPC_OUT to have Numbers 2.
This will make the value be divided by 100 ... so actually the value in the offset will be
-0.19530 to 0.19995
if you convert this to degrees you se a rudder trim deflection between - 11.5 to 11.5 degrees.
in fact , you could rewrite this code and not divide L0 by 1000 to get V0085
but define the fsuipc_output with Numbers = 5
This is a quote form the help file in config_sioc.exe
"Numbers : If we work with 8 bytes FLOAT, this attribute sets the division factor. If we set 1 and FLOAT is 123, the variable will store 12.3."
the help file is the one from CONFIG_SIOC.EXE , not the sioc.exe ...
Anyway, its only when you truly understand an example code that you can start
fiddling yourself. Once you get the basics , and you understand them well you can
try out some variations and new things with it....
Thats my main reason that I dont get started in programming windows (visual C++) ...
so many classes existing and not really seeing how they work and interact ...