PDA

View Full Version : (sioc) create a static var?



henri
12-22-2011, 10:35 AM
hi,
I'm wondering if there is a way to make a (sioc)var static.
ex: the offset 126C gives the amount of fuel in a tank, and i need that amount
to be constant and not become less. This is because i want to calculate the
amount of fuel used.
thnx and a merry christmas to all,:-D
henri

fordgt40
12-22-2011, 04:16 PM
Henri

I would use the Var 0, Value 0 initialisation construct to do this. See Nico Kiek`s site here

http://www.lekseecon.nl/howto.html

Define a variable to hold the initial fuel quantity - say init_fuel

var 1, name init_fuel

Var 0, Value 0
{
L2 = offset value for FSUIPC fuel quantity
&init_fuel = L2
}

This code will be run once at start up and as init_fuel gets its value once at start up and from a local variable (L2) it will not subsequently change unless you code it to elsewhere

I believe this will work, though there may always be a simpler more elegant answer :)

David

henri
12-22-2011, 07:17 PM
Hi David,
THX if thought of something like that and that, but it did not worked. I'll try it again.
thnx again.
regards,
henri:D

pdpo
12-23-2011, 05:32 AM
What you could do too is the following (i have something done like that)

put somewhere in your cockpit a switch. When the switch is on you set a variable to 1 (I called it RmpAsSetup). The you can check in the body of other pushbuttons if this value is set or not and do different things depending on it.
So for example you could use the pushbutton to toggle the fuel valve of engine 1 (just example) to copy the current fuel levels to some variables which you use then as initial values if the value is set and toggle the fuel valve if not set.
In this way I use my airbus radio panel as refuel, center of gravity and initial trim calculator panel when the RmpAsSetup value is true and when it is false the buttons go back to normal radio function.

Greetz Peter

henri
12-23-2011, 09:47 AM
Hi peter,
Thx for the idea! It works great.
zalig kerst,
groeten Henri