Jump to content
The simFlight Network Forums

dmordogan

Members
  • Posts

    20
  • Joined

  • Last visited

Posts posted by dmordogan

  1. 1 hour ago, John Dowson said:

    Ok, then what you need to do is spoof the offset value with the modified lvar value. Just take the lua script I previously told you about and linked the post where available, change that script to use the offset you want to spoof, i.e this:
     

    
    local spoofOffset = 0x0BC8  -- Parking Brake offset, unsigned word (2 bytes)

    to this:

    
    local spoofOffset = 0x3367  -- Exit Open offset, bit per door (1 byte)

    Change the variable to read your lvar:

    
    ...
    local pBrakePosition = 0
    ...
      pBrakePosition = ipc.readLvar("L:A32NX_PARK_BRAKE_LEVER_POS");
    ...

    to

    
    ...
    local doorMainState = 0
    ...
      doorMainState = ipc.readLvar("L:DOOR_MAIN_DOOR_POS");
    ...

    Then you can apply whatever transformation on that value you require to write/spoof offset 3367. If it is as you say, its very easy to assign a new local variable to the value you want to set, based upon the lvar value, then adjust the ipc.writeStruct statement to your requirements.

    Hopefully that should give you enough information to do what you require. 

    in fsuipc7.ini file i put the "auto" section for crjdoor.lua file

     

    [Auto]
    1=Lua crjdoor

     

    lua script;

    ------

    local spoofOffset = 0x3367  -- Exit Open offset, bit per door (1 byte)
    local doorMainState = 0

    while true do

    doorMainState = ipc.readLvar("L:DOOR_MAIN_DOOR_POS");
    doorMainState = doorMainState / 100

    ipc.writeStruct(0x3367, "1UW", doorMainState)

    ipc.sleep(100)

    end

    --------

    Lvar value is when door open "0" when closed "100"

    thats why i divided with 100

    if closed 0/100=0

    if open 100/100 =1

    with ipc.writeStruct i tried to bind to offset(3367) value "0" or "1"

    but no luck

    dorr value still always "0"

     

    thank you for help...

     

  2. 1 hour ago, John Dowson said:

    Maybe an example will help you....
    Door 1 is bit 0, so to open just that door, you would set bit 0, i.e. write 0x1, or just 1.
    Door 2 is bit 1, so to open just that door, you would set bit 1, i.e. write 0x2, or just 2.
    Door 3 is bit 2, so to open that door, you would set bit 2, i.e. write 0x4, or just 4

    If you write 0x3, or just 3, that is 0b11, so that would open doors 1 and 2 (bits 0 and 1 set).

    So, as I said, if you write 100 (in decimal), that is in binary 0b1100100, which is:
       - door 1 closed 0b1100100 - bold is bit 0
       - door 2 closed  0b1100100 -  bold is bit 1
       - door 3 open  0b1100100 - bold is bit 2
       - etc

    To change single doors, you need to read the offset value as it is, then change the bit (using the lua logic library) for the door you want to control.
    You should or the original value with the bit flag you want to set, or and to clear.

    I understand this may sound advanced for your understanding, but it really isn't that difficult. If you can tell me exactly want you want to achieve (i.e which aircraft and, if applicable, which mod, and which doors) then I can maybe help you further if you have issues.

    John

    [Note some folks call bit 0 bit 1, which is confusing. But you can usually tell by context]

    thank you very much again for explanation

    what i want to do is;

    taking Lvar value of DOOR_MAIN_DOOR_POS (which is belong to aerosoft crj lvar exist in list and value when closed "0" when open "100")

    and apply to responding offset (which is 3367) to make sure when door open (main door its probably exit1 or it can de all doors) offset value equals "1" and when closed "0"

    I want to do it besause our flight management application reads this offset to determine whether door is open or closed.

  3. 10 minutes ago, John Dowson said:

    No! That is, sorry, just rubbish. 0c indicates hexadecimal. 0b binary. )c3367 is the offset address, which is 1 byte, 8 bits. We are talkimng about bits here...
    Sorry, but you are obviously not  computer literate. Please just follow my advise....

    I am sorry about that

    I came from x-plane and wrote many lua script there but here is different there is a concept "offset" which i am trying to understand

     

  4. Just now, John Dowson said:

    No!

    Please re-read my posts....

    It is a 1 byte offset, but each bit in that byte represents a value, 0 or 1, depending if the door for that bit is open or closed

    ....you seem to be posting many messages before I can respond...I suggest you read my posts and digest first....

     

    "....you seem to be posting many messages before I can respond...I suggest you read my posts and digest first...."

    sorry for that

  5. Just now, dmordogan said:

    I am planning to change tha value of Lvar   "value/100"  then when door closed value =0/100=0  when door open value=100/100=1 and then trying to bind the offset like you did A320ParkBrake.lua to the 0x3367

    and value is 0 or 1 then i should use UB size for that i suppose

  6. 1 minute ago, John Dowson said:

    Ok. But note that offset 3367 is a byte-oriented offset. So the value in each bit is a different door. So, a value of 100 is 0b1100100, so that is doors exit3, exit6 and exit7.
    Write the appropriate value (for the doors you want to control) from the relevant lvars. o.e. if different doors are different lvars, they are distinct bits on the offset.

    I am planning to change tha value of Lvar   "value/100"  then when door closed value =0/100=0  when door open value=100/100=1 and then trying to bind the offset like you did A320ParkBrake.lua to the 0x3367

  7. 1 minute ago, John Dowson said:

    You can adjust for this in the lua script. Once the lvar value is read, just change it to the correct value in the lua script before writing.

    I understand that 3367 is not a user offset 

    that means we cannot change it even there is no value for that in msfs?

    if i would spoof it via lua script and change then can i write it to the offset 3367 with lua?

  8. our flight management system reads values via psuipc offsets to determine flight status

    but in msfs there is no door value (3367 offset is empty)

    thats why system cannot see the door is open

    I though that if i can get Lvar(DOOR_MAIN_DOOR_POS) value to the offset(3367) then system can read it

    and the other problem is in Lvar when door is closed value=0 but if it is open value=100

    I thing offset value can be 0 or 1

  9. Hello

    I wanted to get door open lvar (DOOR_MAIN_DOOR_POS) to offset linked to the door (3367)

    I tried these to manage it on Fsuipc7.ini file

    [LvarOffsets.CRJ]
    0=DOOR_MAIN_DOOR_POS=UD 0x3367

    [LvarOffsets.CRJ]
    0=DOOR_MAIN_DOOR_POS=UD 3367

    [LvarOffsets.CRJ]
    0=DOOR_MAIN_DOOR_POS=UD 15x3367

    also i tried to use size as SB and SW

    but no luck

    What do i do wrong?

    Thank you.

     

  10. Hello Pete,

     

     

    I started to use prepar3d. And flying our virtual airline Turkish Virtual (www.turkishvirtual.com). We have a Flight data recorder working with fsuipc. 

     

    When using FSX i have no problem about our Flight Data Recorder,

     

    But when i use prepar3d our flight data recorder says that "supporting only FSX FS9 and ESP"

     

    as i know ESP is P3D but sonmehow it doesnt see the simulator although fsuipc is installed on P3d.

     

    I thing that is about some adjustment with fsuipc.

     

    Our recorder just takes information about flight and recording it over fsuipc.

     

    Please help me on this.

     

    Deniz Mordogan

    dmordogan@gmail.com

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.