Results 1 to 5 of 5
  1. #1
    25+ Posting Member
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    60
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    (sioc) create a static var?

    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,
    henri

  2. #2
    500+ This must be a daytime job
    Join Date
    Jul 2013
    Posts
    948
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: (sioc) create a static var?

    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

  3. #3
    25+ Posting Member
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    60
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: (sioc) create a static var?

    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

  4. #4
    150+ Forum Groupie pdpo's Avatar
    Join Date
    Nov 2005
    Location
    belgium
    Posts
    280
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: (sioc) create a static var?

    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
    FS9+PM+AST+opencockpits

  5. #5
    25+ Posting Member
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    60
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: (sioc) create a static var?

    Hi peter,
    Thx for the idea! It works great.
    zalig kerst,
    groeten Henri