Sign in to follow this  
stinger2k2

How to find function names

Recommended Posts

Hi all,

I am just starting out using linda. I want to write some of my own lua code For the Carenado Phenom 300. I see that i can get a list of Lvars using the tracer but i am stuck on function names.

 

The first switch i am having a go at is for the emergency lights. Here is the Lvar for it......ASD_SWITCH_EMER_LIGHT_EMB500

 

Can i Work out the function name from the above Lvar or do i need to source it elsewhere?

 

thanks

 

Stinger

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Good luck on jumping straight in to write your own module for the Phenom. The best advice I can offer as someone who has only worked on one module and modified a couple of others is to find a similar aircraft and study its module to see how it works for that aircraft and then modify the module for your own purposes.

 

The Lvars are data variables provided by or sent to the aircraft addon via FSUIPC4. You can use the Tracer page and console to monitor what values the addon provides for specific switch positions and inject values to see what effect they have on the addon. Most are either 0 or 1 or range from 0 to 100 - but don't quote me.

 

Function names should be description for their purpose. In LUA they are case sensitive and must have no spaces - underscores and dashes are acceptable. The normal convention is to start with an aircraft specific prefix (ie. P300_). There are also a set of 'standard' self-explanatory suffixes like _on, _off, _toggle, _up, _down, etc which should be in lowercase. These are useful for assignment functions to buttons as the alternative function can be automatically selected.

 

Using the LINDA Editor you will see a shortcut (top left) for ensure the correct function format.

 

In answer to your other question on the Development thread, there is no documentation available for LINDA developers.

Share this post


Link to post
Share on other sites

Function names should be description for their purpose. In LUA they are case sensitive and must have no spaces - underscores and dashes are acceptable.

 

Are you saying here that I can make up my own function name as long as I follow the convention? The reason I ask this is that my first attempt at a lua code for my emergency lights switch is not working and I thought that the reason it is not is that I have used the wrong function name?

 

As an aside, I have a more fundamental issue. I am using a custom box based on a Leo Bodnar card. Linda recognises the card ok but the"On Release" doesn't seem to work. I have tried assigning a standard FSX aircraft (the baron) with button 29 (my leo box switch number as seen light up in Linda). I assigned button 29 "On press" to nav lights on, and "on release" to nav lights off. When I turn the leo switch on I get the nav lights switch on in fsx but when I turn the leo switch off the nav lights stay on in FSX? Any clues on this one.

 

Thanks for looking and the reply

 

Stinger

Share this post


Link to post
Share on other sites

As with any programming language you can give your functions any name but it is useful if you make them meaningful to you and LINDA users. If you base you new module on an existing one, then there is a higher probably of your's working as many of the base structure will already exist.

 

There is an issue with OnRelease in 2.8.5 which I am testing a solution. The work around is to click Reload LUA Engine after any significant save or program change. 

Share this post


Link to post
Share on other sites

Thanks for the reply again

 

My plan is to use fsuipc and linda to assign as many of my custom cockpit switches, buttons etc, as i can. Any that i can't, i hope to be able to overcome it by writing my own. I realise this is no simple task but hope fully once i have managed one or two it will get easier.

 

All the best

Stinger

Share this post


Link to post
Share on other sites

Hi Stinger

 

Did you manage to get the to config button up and running? I'm helping a friend to get started with LINDA, but I can't find the correct variable for it.

 

Kind regards

Tomas

Share this post


Link to post
Share on other sites

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
Sign in to follow this