bofhlusr Posted August 28, 2023 Report Posted August 28, 2023 (edited) Hello, I need some help or clarification with regards to button programming on the following: How often is the .ini file read? Does it get read or reloaded each time a button is pressed? In a repeating button, does the value alternate between 1 and 0? How do I create an internal/external view toggle using the same joystick button ie. I'd like to create a view toggle using just one joystick button? Does FSUIPC actually run or execute commands (as opposed to print) from top to bottom in the .ini file or does it follow the entry numbers instead? Is there some sort of 'debugger' for the program ie. watchpoints for "modifier keys", breakpoints, etc.? How do I create "modifier keys" in FSUIPC's Options and Settings/Buttons & Switches screen (without manually editing the .ini file with a text editor)? How do I change the value or toggle the state of a modifier key (eg. joystick 0, button 0) without issuing a keypress or a control? I couldn't get 'flag' to work. Can I mix a key press with a joystick button? For example: press the Ctrl key on the keyboard AND Button 3 or 4 on the joystick = results in a left or right brake Thank you in advance. Edited August 28, 2023 by bofhlusr
John Dowson Posted August 28, 2023 Report Posted August 28, 2023 2 hours ago, bofhlusr said: How often is the .ini file read? Does it get read or reloaded each time a button is pressed? It gets read at various points, but not when you press a button. You can also force a reload by pressing one of the reload buttons in the assignment panels. 2 hours ago, bofhlusr said: In a repeating button, does the value alternate between 1 and 0? Sorry but I don't understand this....what do you mean by "value"? There is no value associated with a button press. A repeating button will just send button press events until the release is sent. 2 hours ago, bofhlusr said: How do I create an internal/external view toggle using the same joystick button ie. I'd like to create a view toggle using just one joystick button? You can have multiple assignments to set the view mode based upon the current view mode, using offset conditions (see Advanced User guide) on offset 0x8320 (current view mode). 2 hours ago, bofhlusr said: Does FSUIPC actually run or execute commands (as opposed to print) from top to bottom in the .ini file or does it follow the entry numbers instead? If there are multiple assignments to a button or key press, then they are executed in index number order. 2 hours ago, bofhlusr said: Is there some sort of 'debugger' for the program ie. watchpoints for "modifier keys", breakpoints, etc.? There is only logging - for example, logging for Buttons & Keys will show you which assignments are executed, as well as those not executed due to compound button conditions or offset conditions on an assignment. 2 hours ago, bofhlusr said: How do I create "modifier keys" in FSUIPC's Options and Settings/Buttons & Switches screen (without manually editing the .ini file with a text editor)? Not sure what you mean....there are no "modifier keys" for button and switch assignments. 2 hours ago, bofhlusr said: How do I change the value or toggle the state of a modifier key (eg. joystick 0, button 0) without issuing a keypress or a control? I couldn't get 'flag' to work. Again, there are no "modifier keys" for button and switch assignments. 2 hours ago, bofhlusr said: Can I mix a key press with a joystick button? For example: press the Ctrl key on the keyboard AND Button 3 or 4 on the joystick = results in a left or right brake Not directly, but you can achieve this using flags or offsets. You would set a button flag (one for a button/device that you are not using) on the key press, and clear it on key release. Then, on the button assignment, you would use a compound button condition on the state of the flag. Alternatively, you could write a value (1) to a spare FSUIPC offset on the key press, and clear the value (0) on key release, and use an offset condition on the button assignment to check the value of the offset. John
bofhlusr Posted August 28, 2023 Author Report Posted August 28, 2023 1 hour ago, John Dowson said: various points Which points? 1 hour ago, John Dowson said: Sorry but I don't understand this....what do you mean by "value"? The value of 1 or 0 (on or off). A "1" when the key is pressed virtually or programmatically, or a "0" when it is unpressed virtually or programmatically, a "1" again when it is pressed virtually or programmatically again...and a "0" when it is repeatedly unpressed or released and so on again and again... so 1, 0, 1, 0, 1, 0.... 2 hours ago, John Dowson said: no value associated with a button press I'm a little confused here... when a button is pressed, doesn't a bit (the 'bit' in a byte) change 'state' ie. from 1 to 0 or 0 to 1? 2 hours ago, John Dowson said: Not sure what you mean....there are no "modifier keys" for button In the line below, the modifier key I'm referring to are in bold. Is there any way I can assign this in the FSUIPC panel (and not have to manually edit the .ini file)? <Entry number> = <Action><Joy#>,<Btn#>,K<key>,<shifts> Very much appreciating the quick reply. Thank you.
John Dowson Posted August 29, 2023 Report Posted August 29, 2023 12 hours ago, bofhlusr said: Which points? Different sections and even specific parameters are read when needed, others are only read at start-up. I am not going to go through each parameter to see when it is read. Just assume they are read wither at start-up or aircraft load, unless explicitly stated otherwise in the documentation. 12 hours ago, bofhlusr said: The value of 1 or 0 (on or off). A "1" when the key is pressed virtually or programmatically, or a "0" when it is unpressed virtually or programmatically, a "1" again when it is pressed virtually or programmatically again...and a "0" when it is repeatedly unpressed or released and so on again and again... so 1, 0, 1, 0, 1, 0.... But there is no value associated to a key press - there is a key press event and a key release event. 12 hours ago, bofhlusr said: I'm a little confused here... when a button is pressed, doesn't a bit (the 'bit' in a byte) change 'state' ie. from 1 to 0 or 0 to 1? Well, there is a flag associated to every button (Button Flags) of that is what you mean, but a button press is an event. 12 hours ago, bofhlusr said: 14 hours ago, John Dowson said: Not sure what you mean....there are no "modifier keys" for button In the line below, the modifier key I'm referring to are in bold. Is there any way I can assign this in the FSUIPC panel (and not have to manually edit the .ini file)? <Entry number> = <Action><Joy#>,<Btn#>,K<key>,<shifts> That is not a modifier key, but the format of a button assignment line when assigned to send a key press or release. This is set when using the left-hand side of the button assignments window, where you enter the key press (combination) to be sent on the button press.
bofhlusr Posted August 29, 2023 Author Report Posted August 29, 2023 1 hour ago, John Dowson said: 13 hours ago, bofhlusr said: In the line below, the modifier key I'm referring to are in bold. Is there any way I can assign this in the FSUIPC panel (and not have to manually edit the .ini file)? <Entry number> = <Action><Joy#>,<Btn#>,K<key>,<shifts> That is not a modifier key, but the format of a button assignment line when assigned to send a key press or release. This is set when using the left-hand side of the button assignments window, where you enter the key press (combination) to be sent on the button press. Apologies. I gave you the wrong example. I actually meant the bold +0,0 in the line sample below. Is there any way I can assign this in the FSUIPC panel (and not have to manually edit the .ini file)? 1=CP(+0,0)0,1,C65561,0 -{PAUSE_TOGGLE}- 1 hour ago, John Dowson said: But there is no value associated to a key press - there is a key press event and a key release event. How are key press events stored in memory and how does one access/track and use or manipulate key press events?
John Dowson Posted August 29, 2023 Report Posted August 29, 2023 55 minutes ago, bofhlusr said: Apologies. I gave you the wrong example. I actually meant the bold +0,0 in the line sample below. Is there any way I can assign this in the FSUIPC panel (and not have to manually edit the .ini file)? 1=CP(+0,0)0,1,C65561,0 -{PAUSE_TOGGLE}- That is a compound button control and can only be added by editing the ini file. 56 minutes ago, bofhlusr said: How are key press events stored in memory and how does one access/track and use or manipulate key press events? I am not going to go into details on how FSUIPC implements assignments, but key and button press events are not stored in memory. The events are received from either windows or via SimConnect when they occur and are then acted upon. These events are not "stored in memory". Why do you want to know this? You don't "access/track and use or manipulate key press events". You just assign an action to be performed on a key press/repeat/release event. As a user, you should concentrate on how to use the functionality, not how it is implemented. What are you actually trying to achieve?
bofhlusr Posted August 29, 2023 Author Report Posted August 29, 2023 4 hours ago, John Dowson said: I am not going to go into details on how FSUIPC implements assignments, but key and button press events are not stored in memory. The events are received from either windows or via SimConnect when they occur and are then acted upon. These events are not "stored in memory". Why do you want to know this? You don't "access/track and use or manipulate key press events". You just assign an action to be performed on a key press/repeat/release event. As a user, you should concentrate on how to use the functionality, not how it is implemented. What are you actually trying to achieve? I'm likely asking this the wrong way. The reason I want to know is because I'm trying to figure out how to code two "similar" (eg. stop/slow down the plane or internal/external view) keypress events using the same joystick button. I'll try clarifying the question by describing what I'm trying to do: This is for a jet aircraft. I assigned joystick Button 2 to spoiler toggle (the code K191 -see Rule 1 below, the first line). I also coded Button 1 + Button 2 to reverse thrust (the code K113 - see Rule 2 below, the second line). 1=P0,2,K191,8 ; (spoiler) 2=CR(+0,0)0,2,K113,8 ; (reverse thrust) The Problem: -- When I press Button 2 in Rule 2 I get a reverse thrust AND a spoiler also. -- How do I code Rule 2 so that I get reverse thrust only and not the spoiler also? In other words, how do I execute Rule 2 without also executing Rule 1?
John Dowson Posted August 29, 2023 Report Posted August 29, 2023 The spoilers assignment will be triggered whenever button 2 on joystick 0 is pressed. The reverse thrust assignment will be triggered when button 2 on joystick 0 is triggered, but only if button 0 on joystick 0 is pressed. If you want to prevent the spoiler assignment from also being triggered, then you have to add another compound condition to only send this when button 0 is not pressed, i.e. 1=CP(-0,0)0,2,K191,8 ; (spoiler) John
bofhlusr Posted August 29, 2023 Author Report Posted August 29, 2023 I don't know why I didn't think of that! I'm going to try it. Probably the case for "seeing the forest for the trees". It looks like I have much to learn. Thank you.
bofhlusr Posted September 4, 2023 Author Report Posted September 4, 2023 A follow-up question: In the code snippet below, line 10 pauses the sim. However, pressing line 10 a second time also runs the next line. How do I prevent the next line from running when line 10 is pressed a second time? 10=CP(+0,0)0,6,C65561,0 -{PAUSE_TOGGLE}- 20=CR(-0,0)0,6,C65607,0 ;TRIM DN -{ELEV_TRIM_DN}- 30=CR(-0,0)0,7,C65615,0 ;TRIM UP -{ELEV_TRIM_UP}-
John Dowson Posted September 5, 2023 Report Posted September 5, 2023 Line 10 is not pressed.... when you press button 6 on joystick 0 then the assignments on that button, which are stored/saved in your ini file, are triggered, The assignment stored in line 10 is only activated when button 0 on joystick 0 is also pressed, and the assignment stored on line 20 is only activated when button 0 on joystick 0 is not also pressed. 11 hours ago, bofhlusr said: However, pressing line 10 a second time also runs the next line. Pressing button 6 (on joystick 0) will trigger the assignment stored in line 10 if button 0 is also pressed, and the assignment stored in line 20 if not. 11 hours ago, bofhlusr said: How do I prevent the next line from running when line 10 is pressed a second time? By also pressing button (joystick 0) at the same time, This will then trigger the assignment at line 10 and not the one on line 20. But all this should be obvious, so I don't understand what/why you are asking this... please use FSUIPC's logging facilities to see what is happening - activate logging for Buttons & Keys and open the logging console and this will show you what is happening in real-time. Any further issues or questions, please raise a separate relevantly titled topic - but only after checking the documentation and also this forum for similar issues first. And any problem with assignments, please attach your FSUIPC7.ini and FSUIPC7.log files (with relevant logging activated). I am closing/locking this topic now. John
Recommended Posts