Jump to content
The simFlight Network Forums

Macro that triggers known offset functions?


Recommended Posts

I'll preface this by saying I'm not a programmer and my FSUIPC experience is relatively limited.  In any event, my question is for the iFly 737 NG in P3D v.5 with FSUIPC (full version), but I guess it could apply to other situations too. 

So, I have assigned several buttons on a Honeycomb Alpha to a known offset: 

11=P3,25,Cx03009400,x00000007     -{offset dword set, offset 9400}-
12=P3,24,Cx03009400,x00000008     -{offset dword set, offset 9400}-

The above turns the taxi lights off and on.  I would like to write a macro that assigns multiple offset triggers to turn off the landing lights and then assign it to a button in the regular way -- something like this:

1=LandingLightOff
1.1=Cx03009400,x00001255
1.2=Cx03009400,x00001258
1.3=Cx03009400,x00001261
1.4=Cx03009400,x00001264

Is this possible? Are the macros limited only to mouse macros? Or I am just doing it wrong?  Thanks for any guidance you can provide.

Finally, I apologize in advance if this has been addressed.  I did spend about an hour trying to hunt down the answer before I posted.

 

Edited by Iadbound
Link to comment
Share on other sites

15 hours ago, Iadbound said:

I would like to write a macro that assigns multiple offset triggers to turn off the landing lights and then assign it to a button in the regular way -- something like this:

1=LandingLightOff
1.1=Cx03009400,x00001255
1.2=Cx03009400,x00001258
1.3=Cx03009400,x00001261
1.4=Cx03009400,x00001264

Is this possible? Are the macros limited only to mouse macros? Or I am just doing it wrong?

No, macros are not limited to mouse macros. That should work - if it isn't, then please attach the relevant files -the macro file, your .ini file, and your .log file, with Button + Event logging activated.

Note that to have multiple assignments in a single button, you can also overload your assignments by editing the ini file.
So, for example, to have 'landing lights off' on your controller with id3 on button 23 (for example), you could have:

Quote

11=P3,25,Cx03009400,x00000007     -{offset dword set, offset 9400}-
12=P3,24,Cx03009400,x00000008     -{offset dword set, offset 9400}-
13=P3,23,
Cx03009400,x00001255
14=P3,23,Cx03009400,x00001258
15=P3,23,Cx03009400,x00001261
16=P3,23,Cx03009400,x00001264

John

Link to comment
Share on other sites

John,

 

Thank you so much for your assistance.  Upon further investigation, I determined that the simplest combination of offsets to turn on/off the landing lights and runway turnoff lights (yes I was intending to add those too) is shown below from my ini file -- 13 is a mouse macro that triggers a special animation, 14, offset "4" turns on the runway turnoff lights, 15, offset "2" turns off the landing lights together, and 16, "5" turns off the runway turnoff lights:

13=P3,23,CM12:2,1     -{Macro ifly737: LandingLightsOn}- 
14=P3,23,Cx03009400,x00000004     -{offset dword set, offset 9400}-
15=P3,22,Cx03009400,x00000002     -{offset dword set, offset 9400}-
16=P3,22,Cx03009400,x00000005     -{offset dword set, offset 9400}-

Lines 13 and 14 execute correctly for button 23.  But button 22 only triggers line 15.  Nothing happens with line 16.  That was one reason I had tried a macro too.  It's as if it doesn't like two offset commands in a row.  Similarly, I also tried a mouse macro to click the runway turnoff and/or landing lights individually and it wouldn't execute multiple commands of the same kind either.  Here are my log, ini and macro files.  

Thank you for your assistance and patience.

Dan

 

Edited by Iadbound
Link to comment
Share on other sites

The forum file uploading tool won't let me upload the ini file.  A size limit of all attachments of 20kB total seems to be blocking me.  Here's the specific section I'm working in though:

[Profile.iFly 737 AB]
1=iFly 737-800 United N77295
2=iFly 737-800 KLM PH-BXZ

[Buttons.iFly 737 AB]
0=P1,20,K65,9     -{Key press: shft+A}-
1=P1,25,K65,9     -{Key press: shft+A}-
4=P1,8,C66066,0     -{SPOILERS_ARM_ON}-
5=U1,8,C66067,0     -{SPOILERS_ARM_OFF}-
6=R1,28,C65966,0     -{THROTTLE1_DECR}-
7=U1,28,C65967,0     -{THROTTLE1_CUT}-
8=R1,29,C65971,0     -{THROTTLE2_DECR}-
9=U1,29,C65972,0     -{THROTTLE2_CUT}-
11=P3,25,Cx03009400,x00000007     -{offset dword set, offset 9400}-
12=P3,24,Cx03009400,x00000008     -{offset dword set, offset 9400}-
13=P3,23,CM12:2,1     -{Macro ifly737: LandingLightsOn}-
14=P3,23,Cx03009400,x00000004     -{offset dword set, offset 9400}-
15=P3,22,Cx03009400,x00000002     -{offset dword set, offset 9400}-
16=P3,22,Cx03009400,x00000005     -{offset dword set, offset 9400}-

Edited by Iadbound
Link to comment
Share on other sites

11 minutes ago, Iadbound said:

Here are my log, ini and macro files.  

Could you please attach a full log, not a continuation log. i.e. do NOT start a new log file.

9 minutes ago, Iadbound said:

A size limit of all attachments of 20kB total seems to be blocking me.  Here's the specific section I'm working in though:

I need to see the complete file. If its too large, just zip it.

Are you sure FSUIPC wasn't running when you edited the ini file? If so, you need to reload the assignments before they take affect.

16 minutes ago, Iadbound said:

It's as if it doesn't like two offset commands in a row. 

This shoudn't be a problem and is a common technique.

19 minutes ago, Iadbound said:

Similarly, I also tried a mouse macro to click the runway turnoff and/or landing lights individually and it wouldn't execute multiple commands of the same kind either.

This should also be fine - can you attach the macro file please.

John

Link to comment
Share on other sites

14 minutes ago, John Dowson said:

Could you please attach a full log, not a continuation log. i.e. do NOT start a new log file.

Done.  But it still won't let me upload more than 3.1 kB now.  The zip file is 13kB.

14 minutes ago, John Dowson said:

Are you sure FSUIPC wasn't running when you edited the ini file? If so, you need to reload the assignments before they take affect.

Yes.  But I also restarted and double checked.

14 minutes ago, John Dowson said:

This should also be fine - can you attach the macro file please.

In the zip file.

Again, thanks for looking at this.

Edited by Iadbound
Link to comment
Share on other sites

21 hours ago, Iadbound said:

So zip file is attached above.

Your log shows both assignments on joystick3 button 23 being performed:
 

Quote


   217344 Button changed: bRef=0, Joy=3, Btn=23, Pressed
   217344 [Buttons.iFly 737-800 United N77295] 13=P3,23,CM12:2,1
   217344 Macro: mouse action OK: Rect X400001a9, Action 3 (LeftSingle)
   217344 [Buttons.iFly 737-800 United N77295] 14=P3,23,Cx03009400,x00000004
   217344 IPC Offsets Control: Ctrl=x0300, Length=4, Offset=9400, Param=x4
 

That also shows your LandingLightsOn macro being executed.

There are no assignments to your compound runwayturnoff macro, so I cannot check that.

Therefore I cannot see any issues. Could you maybe explain again what your problem is, and provide an appropriate log and ini file if you want me to look into this further.

John

Link to comment
Share on other sites

49 minutes ago, Iadbound said:

My apologies for the confusion.  The issue is on button 22

Button 22 has one assignment:
    15=P3,22,Cx03009400,x00000002     -{offset dword set, offset 9400}-
which your log shows being pressed and the ssigned vontrol sent:

Quote

   183625 Button changed: bRef=0, Joy=3, Btn=22, Pressed
   183625 [Buttons.iFly 737-800 United N77295] 15=P3,22,Cx03009400,x00000002
   183625 IPC Offsets Control: Ctrl=x0300, Length=4, Offset=9400, Param=x2
 

 

53 minutes ago, Iadbound said:

However, I have to run some additional tests.  I will get back to you.  

Ok.

Link to comment
Share on other sites

John,

So I went back to the drawing board and tested the commands just using keyboard assignments.  It turns out, the iFly just wanted a pause between the entry of the two offset commands.  In the end, I have one simple lua script assigned through FSUIPC:

ipc.writeUW("9400",2)
ipc.sleep(700)
ipc.writeUW("9400",5)
 

Works as as intended.  Thanks again for assisting. 

Link to comment
Share on other sites

13 hours ago, Iadbound said:

It turns out, the iFly just wanted a pause between the entry of the two offset commands. 

Ok. Note that there is also an FSUIPC Pause Control (1152)which can also be used to achieve this, in overloaded assignments or compound macros, if/when needed.

John

Link to comment
Share on other sites

On 1/6/2022 at 5:17 AM, John Dowson said:

Ok. Note that there is also an FSUIPC Pause Control (1152)which can also be used to achieve this, in overloaded assignments or compound macros, if/when needed.

John

Thanks.  I'll check that out.

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.