Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi Pete, Just a quick question.

 

I understand how to call the pulldown items with their associated control number using the ipc.control(n) and ipc.control(n, param) from within a Lua script, but is there a way to call them by their descriptive pulldown name.

 

For example if I wanted to call (Zoom In) and (Zoom Out) from Lua, Can I do something like ipc.macro("Zoom In") or ipc.macro("Zoom Out")

 

I have tried this using the macro command but it doesn't seem to work, However it does not say in the manual that it would do that, I was just thinking that the pulldown items might have been like a macro in nature.

 

Anyhow have I missed something or is the only way to do this via the ipc.control(n) command, It would be a nice feature to be able to call them from Lua by descriptive names. 

 

Regards Glenn. 

 

Posted
I understand how to call the pulldown items with their associated control number using the ipc.control(n) and ipc.control(n, param) from within a Lua script, but is there a way to call them by their descriptive pulldown name.

 

For example if I wanted to call (Zoom In) and (Zoom Out) from Lua, Can I do something like ipc.macro("Zoom In") or ipc.macro("Zoom Out")

 

You#d need to define variables with those names, then use those. for instance:

 

ZoomIn = 65655

Zoomout = 65656

 

To have this pre-set for you in Lua for all 500-600 controls would take an extra 20k or more of stack space for each and every Lua plug-in running even if they used none of them. To do it using string names and have these looked up in a table could work okay but would be a lot slower. I'm really not sure it is worth it, especially since you'd usually need to look up the precise names in any case -- one character wrong and it would fail -- so if you are checking that from the document supplied you might as well use the number alongside it.

 

Regards

Pete

Posted

OK no problems Pete,

I had already thought about defining variables as you described.

I just wanted to make sure I was not doing something wrong, I will simply stick with the control numbers and ipc.control commands in that case.

Thankyou for the quick reply.

Cheers Glenn.

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.