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

    SIOC expert needed

    Hi all,

    i tried to get the following working with SIOC:

    If Aircraft on ground and Engine is running, than one LED should go on.
    If the Engines are off the LED should be off.

    If the Aircraft is in the Air, the LED should be off, except if the Flapstatus is >0 than the led should be again on.

    I tried it with the following (without Flap Status in this example.):

    Code:
    Var 0013, name Aircft_GND, Link FSUIPC_IN, Offset $0366, Length 2 //
    Ground=1 / air=0
    
    {
    
    IF &Aircft_GND = 1
    
    {
    
    IF &OilP1 > 2383
    
    {
    
    &_Eng1_RAM_Door = 1
    
    }
    
    IF &OilP1 < 2383
    
    {
    
    &_Eng1_RAM_Door = 0
    
    }
    
    }
    
    ELSE
    
    {
    
    &_Eng1_RAM_Door = 0
    
    }
    
    }
    the next what i tried was with subroutines:

    Code:
    Var 0013, name Aircft_GND, Link FSUIPC_IN, Offset $0366, Length 2     // Ground=1 / air=0
    {
      IF &Aircft_GND = 1
      {
        CALL &sub1
      }
      ELSE
      {
        &_Eng1_RAM_Door = 0    
      }
    }
    
    Var 0014, name Flapsstate, Link FSUIPC_IN, Offset $0BDC, Length 4     // Flaps state 0=up
    
    Var 0015, name sub1, Link SUBRUTINE
    {
      IF &OilP1 < 2380
      {
        CALL &sub2
      }
      ELSE
      {
        &_Eng1_RAM_Door = 1    
      }
    }
    
    Var 0017, name sub2, Link SUBRUTINE
    {
      &_Eng1_RAM_Door = 0    
    }
    The status of the LED is only correct when i reload the script with SIOC.
    Any Ideas how to get this working correct??

    thanks for all hints,

    Markus

  2. #2
    2000+ Poster - Never Leaves the Sim
    Join Date
    Mar 2008
    Location
    France,Nice
    Posts
    2,426
    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 expert needed

    The use of subroutine is the way to go, your second approach is almost correct.

    Bear in mind that the FSUIPC In/Out code will only be executed when the corresponding variable actually changes.
    So you need to declare a FSUIPC variable for each condition you need:
    -Aircft_GND
    -OilP1 (by the way there is an offset for engine running flag, instead of using oil pressure, see $0894)
    -Flapsstate

    And each condition should call the same subroutine, which could look like this
    Code:
    IF &Aircft_GND = 1
    {
    IF &OilP1 > 2383
    {
    &_Eng1_RAM_Door = 1
    }
    ELSE
    {
    &_Eng1_RAM_Door = 0
    }
    }
    ELSE
    {
    IF &Flapsstate> 0
    {
    &_Eng1_RAM_Door = 1
    }
    ELSE
    {
    &_Eng1_RAM_Door = 0
    }
    }

  3. Thanks markusr thanked for this post
  4. #3
    75+ Posting Member
    Join Date
    Jan 2009
    Location
    Austria
    Posts
    120
    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 expert needed

    thanks for the hint.

    it worked.

    So, i can only use 1 variable that i have decalred in sioc at one time.
    I already had the OilP1 variable used for another thing.

    Code:
    Var 0013, name Aircft_GND, Link FSUIPC_IN, Offset $0366, Length 2     // Ground=1 / air=0
    {
      CALL &sub1
    }
    
    Var 0014, name Flapsstate, Link FSUIPC_IN, Offset $0BDC, Length 4     // Flaps state 0=up
    {
      CALL &sub1
    }
    
    Var 0017, name oilp1_2, Link FSUIPC_IN, Offset $08BA, Length 2
    {
      CALL &sub1
    }
    
    Var 0015, name sub1, Link SUBRUTINE
    {
      IF &Aircft_GND = 1
      {
        IF &oilp1_2 > 2380
        {
          &_Eng1_RAM_Door = 1    
        }
        ELSE
        {
          &_Eng1_RAM_Door = 0    
        }
      }
      ELSE
      {
        IF &Flapsstate > 0
        {
          &_Eng1_RAM_Door = 1    
        }
        ELSE
        {
          &_Eng1_RAM_Door = 0    
        }
      }
    }

  5. #4
    2000+ Poster - Never Leaves the Sim
    Join Date
    Mar 2008
    Location
    France,Nice
    Posts
    2,426
    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 expert needed

    To be more precise look at this variable declaration:
    Code:
    Var 0013, name Aircft_GND, Link FSUIPC_IN, Offset $0366, Length 2     // Ground=1 / air=0
    {
      " WHATEVER CODE FUNCTIONS YOU NEED"
    }
    the code will only be executed in two cases:
    1) the ACFT was prior on ground then took off, thus offset $0366 changed from 1 to 0
    2) the ACFT was prior in flight then touched down, thus offset $0366 changed from 0 to 1

    While in flight or on ground , if any other parameter changes, this one won't change unless one of the two conditions above is met. Problem is, SIOC reacts only on "change events". Thus the code won't be executed unless 1 or 2.

    Am I clear?

  6. Thanks markusr thanked for this post
  7. #5
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    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 expert needed

    Quote Originally Posted by jeehell View Post
    Problem is, SIOC reacts only on "change events".
    That is not a problem, it is by design! That makes SIOC so powerful.

    One should bear in mind that SIOC is not a procedural programming language but an event based scripting language.
    The value change of a variable is such an event.

    If you assign the same value a second time to a variable, nothing will happen.

  8. #6
    2000+ Poster - Never Leaves the Sim
    Join Date
    Mar 2008
    Location
    France,Nice
    Posts
    2,426
    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 expert needed

    Don't get me wrong, I never said SIOC was flawed. I used the word "problem" here in regards of what Markus tried to achieve with the first code he wrote, which clearly meant he hadn't yet grasped the concept of events.

Similar Threads

  1. Resident Opencockpits Card Expert Needed!!!
    By blueskydriver in forum OpenCockpits General Discussion
    Replies: 1
    Last Post: 03-01-2010, 09:59 AM
  2. SIOC help with low volts light needed
    By Steve1970 in forum General Aviation (GA) Builder Disccusion
    Replies: 9
    Last Post: 02-23-2010, 09:47 PM
  3. qestion for expert builders????
    By spiro in forum General Builder Questions All Aircraft Types
    Replies: 6
    Last Post: 04-18-2009, 08:02 PM
  4. FAQ on the Windows XP Expert Zone
    By MS Expert Zone RSS Feed in forum Computer Hardware Setup
    Replies: 0
    Last Post: 12-28-2006, 11:30 AM
  5. Katy (network expert) .. aquestion
    By John White in forum PM General Q & A
    Replies: 0
    Last Post: 12-10-2004, 11:26 AM