Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello,

I am looking for offset controling the  compressor for Zlin Aeroplane model.

I found that the Lvar is L:kompresszor

When I execute in lua :    vvr = ipc.getLvarId("L:kompresszor")

the value vvr is 115     thats  rgal 0073 in Hex

Suppose the compressor is ON (=1)

when I call

ipc.writeUB(vvr,0)    No thing in the compressor

When I call

ipc.writeLvar("L:kompresszor", 0)    It works  perfectly and the compressor go to OFF.

Why I cannot call the compressor variable with wrtieUB ? is there mistakes ?

Regards

 

 

Posted

Hi,

there is no error.

Quote

vvr = ipc.getLvarId("L:kompresszor")

Here you create a variable vvr and store the value returned by ipc.getLvarId("L:kompresszor")

Quote

ipc.writeUB(vvr,0)    No thing in the compressor

Here you write to the Offset (value of vvr) the value 0 (zero).

As in your case as you say the value of vvr = 0x73, it means you just write to Offset 0x0073 but not at all to the L:var you did read before. Check the maunual, ipc.write / ipc.read uses Offsets only. But Offsets are not linked to Lvars/ LvarIDs.

Thomas

Posted

Thank you for  your response.

I did some thing like thise and I understood that the ID of LVARS correspond to Offset  of the FIUIPC blackboard memory

If not, how can I access to the variable with offset or like offset   without using named Lvar ?

Regards

 

Posted

Hi,

Lvars don't correspond to Offsets! FSUIPC doesn't know the Lvars. You can read them and write to them via Lua plug-in by using their names, you have to know them of course.

You can only write to Lvars by using their name. By using free available Offsets you can of course write to a specific Lvar via functions in your script.

Thomas

Posted
58 minutes ago, samir_robot said:

Why I cannot call the compressor variable with wrtieUB ? is there mistakes ?

The compressor variable is an L:Var, which is only addressable by name. There is no offset equivalent to an L:Var. 

23 minutes ago, samir_robot said:

I did some thing like thise and I understood that the ID of LVARS correspond to Offset  of the FIUIPC blackboard memory

No, no, they don't! Local Variables (L:Vars) are known only by NAME. Offsets are memory addresses where non-local variables are stored for reading and writing -- variables supported by the underlying Sim Engine, not only by a local gauge specific to an aircraft, add-on or default.

Quote

If not, how can I access to the variable with offset or like offset   without using named Lvar ?

You can't. And why do you need to? You use ipc.writeLvar, as you posted, the equivalent of the ipc.readLvar for reading. The two make up a complementary pair!

Pete

 

Posted

Hello

thanks Alot.

Sorry I made confusion because the returned ID of the  ipc.getLvarId("L:kompresszor")  call return ID thats value is 0 to 65535. It means that its another memory space.

But if getLvarId ixist what I can do with the ID ? nothink ?

Thanks alot for your Help.

 

Posted
7 minutes ago, samir_robot said:

Is there document explaining  the difference between Lvars, offsets ..etc

The FSUIPC SDK deals with offsets. But the list of offsets in your FSUIPC Documents folder should show you enough to see what those handle.

And L:Vars are really the province of aircraft addon makers. There's no way of predicting what an add-on may have or what names they will be using. The only thing you know beforeghand is that they use NAMES for identifiers, not NUMBERS (like offset addresses).

Pete

 

Posted
9 hours ago, samir_robot said:

It means that if I want to write Visual C++ program to interface owner modules, we can't access to Lvars ?

The only solution is to write some coes in LUA level ?

No. FSUIPC provides methods for accessing things by name via offsets too -- Macros and L:Vars are both identified by names!

If you search for L:Var in the offsets list I mentioned you will find details of how to read them and write them via offsets, using the L:Var name (NOT a number). Only the values of L:Vars are numbers, their identities are names!

Pete

 

Posted

Hello

here is my code and it works am Using the offset 0x9000 to communicate outside with Visual C++ program.


function compresseur(offset,val)
    if(val==0) then
            val=0
    else
            val=1
    end
    ipc.writeLvar("L:kompresszor", val)
end

event.offset("9000","UB","compresseur")

 

It works perfectly

thaks for your recommandations.

Regards

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.