Jump to content
The simFlight Network Forums

small request


Recommended Posts

19 hours ago, adrem said:

Could you please add a function to the lua library for firing mouse macros without using macro files, something like this: ipc.macro(0x25C01807, 13)?

Why not just call the names macro using the existing form of ipc.macro? Seems more complicated for both you and us to have extra work to do, reading .mcro files for you and more complex code for us.

The existing facility is surely adequate and clearer, and in fact more flexible in case of updates to the add-on aircraft causing the macro rectangle numbers to be changed. You'd only have the macros to re-make, note the Lua files to be edited too.

Pete

 

Link to comment
Share on other sites

On 2/22/2020 at 2:01 PM, Pete Dowson said:

Why not just call the names macro using the existing form of ipc.macro? Seems more complicated for both you and us to have extra work to do, reading .mcro files for you and more complex code for us.

The existing facility is surely adequate and clearer, and in fact more flexible in case of updates to the add-on aircraft causing the macro rectangle numbers to be changed. You'd only have the macros to re-make, note the Lua files to be edited too.

Pete

 

I'm making a lua library for FSLabs' cockpit controls. I have a JSON file that's generated with the help of a PDK dll - I interact with the control, the dll looks which lvar has changed its value and maps the macro to the lvar. I then manually add a field specifying which mouse action on that rectangle rotates a switch left/right etc. The lua library loads the file and makes cockpit control object from lvar names. If an FSLabs update changes the macro, I load the dll and interact with the control.
I can leave with the current system, of course - by auto-generating entries in a macro file.

Link to comment
Share on other sites

6 hours ago, adrem said:

I can leave with the current system, of course - by auto-generating entries in a macro file.

If that is just as easy, fine. If not then, whilst it should be easy enough to add to the ipc.macro facility, it probably won't see release for a while due to other pressures. But let me know, and I'll take a look before John can get to it. 

Pete

 

Link to comment
Share on other sites

Hi,

can you please try the attached dll: FSUIPC5.dll

I've added a new function called ipc.mousemacro, taking two arguments, the first being the rectangle id as an unsigned int, and the second the mouse operation.

  e.g. ipc.mousemacro(0x25C01807, 13)

I've not added much (any!) error checking yet, so please use/test with caution.

Cheers,

John

Link to comment
Share on other sites

15 hours ago, John Dowson said:

Hi,

can you please try the attached dll: FSUIPC5.dll

I've added a new function called ipc.mousemacro, taking two arguments, the first being the rectangle id as an unsigned int, and the second the mouse operation.

  e.g. ipc.mousemacro(0x25C01807, 13)

I've not added much (any!) error checking yet, so please use/test with caution.

Cheers,

John

Thanks, that was fast.
I've already encountered an issue, however: with consecutive macro actions lua eventually crashes (Crash C0000005).
You can try the following code with the default raptor (it's the HUD button, located in the row of buttons just under the HUD):

while true do
   ipc.mousemacro(0x40000039, 3)
   ipc.sleep(1000)
   ipc.mousemacro(0x40000039, 13)
   ipc.sleep(1000)
end

It crashes on my system within a few seconds (if I remove the sleeping - immediately).

Of course, it doesn't crash if I replace ipc.mousemacro with ipc.macro and a macro file (same rectangle and click types).

Link to comment
Share on other sites

What aircraft are you using - the FSLabs A320? I don't have that aircraft so cannot reproduce here. What function is your rectangle id (0x40000039) activating?

I've tried here using an A2A Cherokee and cannot reproduce, even with no delay, and have tried various multi-mouse operations. Can you try see if you can reproduce with a default aircraft so I can reproduce here?

John

Link to comment
Share on other sites

38 minutes ago, John Dowson said:

What aircraft are you using - the FSLabs A320? I don't have that aircraft so cannot reproduce here. What function is your rectangle id (0x40000039) activating?

I've tried here using an A2A Cherokee and cannot reproduce, even with no delay, and have tried various multi-mouse operations. Can you try see if you can reproduce with a default aircraft so I can reproduce here?

John

0x40000039 is pressing the HUD button in the default F-22 Raptor - like I said in my previous post 🙂 

Link to comment
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
×
×
  • 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.