Iceking007 Posted February 21, 2022 Report Posted February 21, 2022 Hello, I finally just recently delved into the world of FSUIPC customizing (literally yesterday). I know! But hay, better late than never. I get that my system is old, outdated, and unsupported; I'm just looking for a few helpful hints if I may. Firstly, what I'm essentially attempting to accomplish is this... I want to control 5 vButtons with vButton flags, so for each condition they react accordingly (well 4 of the 5 do). The 5th button was initially intended to be a static use; however I'm now thinking it would be great if "buttons" '2-5' would reset a timer, under certain flag conditions that is. Whilst this timer is running "button 1" would then activate a feature according to conditions of flags. I'm confident I can handle the flag condition(s); I need a hand figuring out the timer. The timer only really needs to be 3-5,000ms I figure, once elapsed it will reset some flags and restore conditions to "default". I hope that is clear, I appreciate any assistance. My system is an old Windows XP running FS2004, I think it's probably FSUIPC3.XXXX but I'm not on my system at the moment, I can report back if needed. Thank you for your time.
John Dowson Posted February 21, 2022 Report Posted February 21, 2022 4 minutes ago, Iceking007 said: My system is an old Windows XP running FS2004, I think it's probably FSUIPC3.XXXX but I'm not on my system at the moment, I can report back if needed. Yes, I need to know what version of FSUIPC you are using. If its FSUIPC3, that is no longer supported, sorry. But, you can achieve what you want by using a lua script (including having your button assignments in lua). However, I've never used FSUIPC3 (before my time!) and have no idea if lua is even available in that version... But, why use a timer? It would be simpler to use a compound button control, where the function of a button depends upon whether another button is pressed. See the Advanced User guide for details on compound button assignments. John
Iceking007 Posted February 21, 2022 Author Report Posted February 21, 2022 Yes, it is intact 3.999z9b (I believe, as far as I can tell) I'm fairly certain that it accepts Lua, however I'm not a programmer so that's over my head. I did thoroughly read through the advanced user guide... that's how I'm on this path now. To answer your inquiry, I want "button 1" to be at a default state the majority of the time, it's essentially a 'master'; other flags then change the functions of "buttons 2-5" according to my selection - they also default with vB1, but I have inputs that select their "mode" in addition to. Here's a brief example: 》vB1 toggles modes 1&2 for vB2-5 = Flag vB120,11 | sets vB120,10 F+ 》1,5 set flags 120,8 + & 120,9 - & 120,10 - 》1,6 set flags 120,8 - & 120,9 -& 120,10 - 》1,7 :: +,+,- 》1,8 :: -,+,- 》vB2-5 If F+/- 120,8 or 120,9 and F-120,10 Then: accordingly 》vB1 If timer + (True), If F+/- 120,8 or 120,9 Then: accordingly Essentially when I activate vB1 I want it to toggle 120,11 and set 120,10 true. However on occasion if buttons 1,5-8 are used they change the 120,10 bit for vB2-5 to change their modes, I can select my settings (say dial in a heading or Altimeter & VS and click vB1 to activate Autopilot; however I don't always need to activate AP so after a timeout vB1 should go to its normal state. So essentially I have 5 groups/ groupings, but only 4 mode selections; instead of cycling through it, I want to set a default. Hopefully that clears it up. Thank you for your input.
Iceking007 Posted February 21, 2022 Author Report Posted February 21, 2022 I do have FSUIPC Lua Library.pdf in my FSUIPC documents folder, and Example LUA Plugins... so I'm assuming it's "Lua" compatible.
Iceking007 Posted February 21, 2022 Author Report Posted February 21, 2022 I have another problem with what I'm attempting also... I'm not sure if you can get me a solution for a timer function, my fingers are crossed; but I'm trying to figure out this key offset thing. For example, I have: [Keys] 109=121,11 - then I need to offset to activate vButton 11,11 110=122,11 vB11,12 Looking at the offset table (which there are no specific examples for and no clear instructions), I see a list of x0100zzz - x7C00zzzz. My brain is scrambled so let me try to collect my thoughts here for you. 1) I have a basic understanding that these are hexadecimal values (0-9, a=10, upto f=15 for 16 characters | each digit after the first is multiplied by values of 16 to get decimals :: x16 second digit, x16 x16 third digit...) 2) I'm thinking that I just add what ever my input value is into where the zzzz is. 3) I tried to reverse engineer someone's post that used the offsets to send to a different joystick configuration something like j62 b4... but I thought for virtual buttons you can only use j0-15 and b0-31... anyways, his code was 0x00014000 but I don't see anything starting 0001 making his add on 4000 for the Button; perhaps it's multiplied or added... 4) Then I'm assuming I add this to my code 109=121,11,0x########? I then have: [Buttons] 100=CP(F+11,10)(F+11,11)11,12,C##### 🤯
Iceking007 Posted February 22, 2022 Author Report Posted February 22, 2022 Okay, I think I found another piece... FSUIPC Control 1070 allows me to activate a key or a button; however I cannot goes the format, is it... 109=121,11,1070,2827 (vBJ11,B11) 109=121,11,1070,11,11 109=121,11,1070,J11B11 Do I need brackets, C1070?
Iceking007 Posted February 22, 2022 Author Report Posted February 22, 2022 Alright... I'm making progress; I can't delete those posts so I'll update: key :: 109=121,11,C1070,2827 is the solution and works. I'm working on my flags now, but they aren't working very well... For example, I have two lines for the same button to accomplish two different tasks: 100=CP(F+11,11)11,11,C1 101=CP(F-11,11)11,11,C2 Only C1 works, I tried even forcing itself to swap Flags either with 1005 or 1003/4 but those didn't improve the situation...
John Dowson Posted February 22, 2022 Report Posted February 22, 2022 8 hours ago, Iceking007 said: For example, I have two lines for the same button to accomplish two different tasks: 100=CP(F+11,11)11,11,C1 101=CP(F-11,11)11,11,C2 Only C1 works, I tried even forcing itself to swap Flags either with 1005 or 1003/4 but those didn't improve the situation... Of course only C1 works, as you are testing the flag on the button that is being pressed. So, flag 11,11 is always set when button 11,11 is pressed, and it is never not set when the button is pressed, which is what you C2 assignment is checking for. For C2 to work, you would need to do it on release, i.e. 101=CU(F-11,11)11,11,C2 But then this us the same as not using a compound condition at all, as in effect you are saying that you only want the press event to be sent when the button is pressed, and only want the release event to be sent when the button is released. This makes no sense. You should only use such compound conditions on different buttons (or button flags) to the one you are assigning. So you should dedicate one button that is used to determine what the other buttons send. When it is on (or the latch flag for that button is set), your other buttons would perform one function. When it is off (or the latch flag is cleared), your buttons would perform the second other function. 10 hours ago, Iceking007 said: I'm not sure if you can get me a solution for a timer function, my fingers are crossed; No, sorry. That would be pretty complicated (all your button assignments would also need to be done in lua) and I don't have time to look into such requests, sorry. John
Iceking007 Posted February 22, 2022 Author Report Posted February 22, 2022 Interesting, I was under the impression that a button flag is independent of its button being pressed, ie on one press the flag is set + on the next press the flag is set -. So what is the difference between the flag and the button state: "F+/-" VS +/-"? I can get around it using another vButton flag and manually setting it, thank you for the input. No need to be sorry, I completely understand. If I have a few months of spare time I might look into that Lua thing. Thank you for your contribution. P.S. As I was working on things I was getting funny results, stuff stopped working, errors would come and go... if I restated fs VS reloading the flight. It's frustrating just testing the results of code changes this way. Not sure if there's a better work method but generally I edit the .ini file, save that and save a copy (I find sometimes FSUIPC just ignore it and overwrites mine), go back into Sim, select 'choose a flight' (while currently in a flight) - to essentially reload everything, and then test the code. Takes time...
John Dowson Posted February 22, 2022 Report Posted February 22, 2022 1 minute ago, Iceking007 said: I was under the impression that a button flag is independent of its button being pressed, ie on one press the flag is set + on the next press the flag is set Each button has a flag, so how can that be independent of the button being pressed? But yes, sorry, for the "latch flags", on one press the flag is set, on the next, the flag is cleared. However, I think the issue is that compound button conditions are meant to allow 'you to specify actions for one button which are dependent on the state of another button'. I just don't think this will work correctly if using for the state of the same button. But is doing this of any use, even if it did work? The result would be that C1 and C2 would be triggered on alternate button presses, so you would get C1 on the first press, C2 on the second, C1 on the third, C2 on the fourth, etc I guess there is no reason why it shouldn't work (in theory), but i would have to look at the code and test in FSUIPC6 or 7 to see why, and only those versions would be updated. 10 minutes ago, Iceking007 said: P.S. As I was working on things I was getting funny results, stuff stopped working, errors would come and go... if I restated fs VS reloading the flight. It's frustrating just testing the results of code changes this way. Not sure if there's a better work method but generally I edit the .ini file, save that and save a copy (I find sometimes FSUIPC just ignore it and overwrites mine), go back into Sim, select 'choose a flight' (while currently in a flight) - to essentially reload everything, and then test the code. Takes time... FSUIPC will re-write the ini (or certain sections of it) at different times. If you are manually changing the ini buttons sections, the best way to do this is to - open the FSUIPC button assignments tab - load or reload the ini in your editor, make your manual changes and save - click the 'Reload' button in the button assignments tab to load your changes John
Iceking007 Posted February 22, 2022 Author Report Posted February 22, 2022 Yes! That is exactly the condition I am trying to generate, C1 then C2 then C1 and so on... that's why I was using the button flag to toggle the modes. (I'll give up on the button timer for the time.) I'll use your reload method, the instructions say to change AC but I was just "reloading" the flight; I did actually reload the flight on a couple occasions, but I figured actually re-selecting the flight would definitely refresh all the data and I was more at ease knowing that wouldn't create problems.
John Dowson Posted February 22, 2022 Report Posted February 22, 2022 2 minutes ago, Iceking007 said: I'll use your reload method, the instructions say to change AC but I was just "reloading" the flight; I'm not sure why it says that, but then again I have never used FSUIPC3 - or even seen the documentation. That is why FSUIPC3 is not supported. My advice relates to FSUIPC4,5,6,7, and may apply to FSUIPC3, but I cannot be certain, sorry. Was thinking a bit more about your issue with the button flags. It should work - I tested something similar in FSUIPC6. Maybe its an issue in FSUIPC3, but I cannot test or do anything about this. However, why don't you just use an unused joystick button flag? For example, instead of: 16 hours ago, Iceking007 said: 100=CP(F+11,11)11,11,C1 101=CP(F-11,11)11,11,C2 Change this to use, for example, the flag on joystick 15 button 2 (update to any joystick/button not in use), use: 100=P11,11,C1005,3842 101=CP(F+15,2)11,11,C1 102=CP(F-15,2)11,11,C2 The first assignment says execute Control 1005 whenever your button is pressed. Control 1005 is "Button Flag Toggle". The parameter '3842' identifies the Flag: 256 x joystick 15 + button 2. So, this flag will now alternate between being set and clear each time you press the button. John
Iceking007 Posted February 22, 2022 Author Report Posted February 22, 2022 Please do not be sorry at all; I completely understand! I certainly am grateful for you spending time with me on this, sincerely! Yes, so that's what I was changing my idea to now instead of you suggested 15,2, I'm just going to use 11,10 (same same). I have this planned for next time I get in the Sim: =CP(F+11,10)11,11,C1005,2826,C1003,2825,C1 =CP(F-11,10)11,11,C1005,2826,C1003,2825,C2 They're is another wonder of mine, the list of fs commands is extensive but not ALL INCLUSIVE. Is there a way to use the 'hidden' commands. For example in fs2004 you can set keys to something like ~selection decrease~ or ~selection increase~ there are many many more... but that 5 digit code is not in the fs list, nor is it in the FSUIPC custom list. There's something else In wondering but I forgot. Thank you. Oh, I remembered one thing, the problems I was having with the flag could very well be my specific setup; I'm going to do some tests with simple keyboard keys to rule that out, ex "h" triggers vB11,11 etc.
John Dowson Posted February 22, 2022 Report Posted February 22, 2022 1 minute ago, Iceking007 said: Yes, so that's what I was changing my idea to now instead of you suggested 15,2, I'm just going to use 11,10 (same same). I have this planned for next time I get in the Sim: =CP(F+11,10)11,11,C1005,2826,C1003,2825,C1 =CP(F-11,10)11,11,C1005,2826,C1003,2825,C2 I wouldn't do it that way - see my example. Toggle the flag in a separate assignment, before the assignments that check the flag. And the button flag for the button you are pressing is automatically toggled - no need to explicitly toggle (or set) the flag again. 11 minutes ago, Iceking007 said: They're is another wonder of mine, the list of fs commands is extensive but not ALL INCLUSIVE. Is there a way to use the 'hidden' commands. For example in fs2004 you can set keys to something like ~selection decrease~ or ~selection increase~ there are many many more... but that 5 digit code is not in the fs list, nor is it in the FSUIPC custom list. No - they need to be known by FSUIPC (and be available via SimConnect). Og FSUIPC doesn't know about them, they are either not available via SimConnect or were missed/not known at the time. John
Iceking007 Posted February 22, 2022 Author Report Posted February 22, 2022 I see, okay. It doesn't really matter to me if the flag toggle is prior to the event or during... I just assumed put it in the event. Thank you for your input, I'll work on that at some point later. Good to know about Sim Connect, thank you for the explanation.
Iceking007 Posted February 23, 2022 Author Report Posted February 23, 2022 Okay, so this is what's frustrating... I have been racking my brain trying to figure this out but nothing I am doing seems to be working... (I understand I'm probably on a short leash with you as I'm working with an older version you don't support; no one else has come in with experience with 3.9; so you're really my only hope...) I started from scratch to test this out step by step: n=P2,1,C1 (real joystick button works everything is good) :: C1 is performed I can see the augment inside FSUIPC buttons page; every way I look at it no problem. n=CP(F+2,1)2,1,C1 n=CP(F-2,1)2,1,C2 again works as I want [Keys] n=79,8,1070,513 :: "o" selects button 2,1 :: I can see this in FSUIPC, Evelyn looks good everywhere, press o and nothing happens. Even if I just change the button code to P2,1,C1 zip... the hard button works the keyboard button doesn't. So then I think maybe my keyboard is malfunctioning. I go to one of my panels that is using keys to input commands through FSUIPC, the button works properly in its current configuration, however when I change the code to activate 2,1, again, nothing happens. So I know it's not an input problem. And I also know fsuipc is registering what I want to do because I see it in both the buttons and keys settings... but there's a disconnect somewhere. And the kicker is, I swear I had one or two attempts over the weekend that did work successfully at one point; and then something broke.... Any help?
Iceking007 Posted February 24, 2022 Author Report Posted February 24, 2022 Another strange thing is if I try: =CP(F+11,10)(F+11,11)2,#,C# (real joystick button) it works however if I change to: =CP(F+11,10)(F+11,11)11,10,C# and add: =P2,#,C1070,{vB multiplier - verified numerous times ie 2828 for 11,12} the code doesn't work... One step forward two steps back. I have been making all sorts of check intervals ie: stage one turns on AP HDG HLD, suave 2 AP NAV HLD; that way I can verify if all lights are on all the flags are set. All the flags set correctly; the buttons just don't go through. I'm don't for the night, but I'm copying my .txt files to my phone; if you think it'll be helpful I can post some of my actual code, so you can see whether I'm a lunatic or not. lol (If anyone's still there, thanks for staying tuned! Don't be a stranger if you have an idea.)
Iceking007 Posted February 24, 2022 Author Report Posted February 24, 2022 Perhaps it isn't possible for a key or a button to call a procedure of a virtual button in compound statements. If this is the case I have just wasted all my time; because that is what I am attempting to accomplish. If this isn't possible in the newer FSUIPC7 then it's most likely not going to work in 3.9. I have started looking at Lua script, but that's going to take me awhile to learn...
John Dowson Posted February 24, 2022 Report Posted February 24, 2022 8 hours ago, Iceking007 said: n=79,8,1070,513 :: "o" selects button 2,1 :: I can see this in FSUIPC, Evelyn looks good everywhere, press o and nothing happens. Not sure why you would want to do this, but what do you see in the log when you press the 'o' key? I always need to see your log (or a log extract) - just saying nothing happens or it doesn't work is not enough. 5 hours ago, Iceking007 said: Another strange thing is if I try: =CP(F+11,10)(F+11,11)2,#,C# (real joystick button) it works however if I change to: =CP(F+11,10)(F+11,11)11,10,C# and add: =P2,#,C1070,{vB multiplier - verified numerous times ie 2828 for 11,12} the code doesn't work... Show me the assignments (your FSUIPC3.ini) and the log produced when you press the button. 3 hours ago, Iceking007 said: Perhaps it isn't possible for a key or a button to call a procedure of a virtual button in compound statements. You mean for a key or button to trigger a virtual button> It should be possible. I really need to see your FSUIPC3.ini to see what is happening rather than you keep pasting these individual lines. Give me a concrete example and I will take a look. However, I am extremely busy at the moment, so I won't have time to look at this until Sunday or Monday at the earliest. John
Iceking007 Posted February 24, 2022 Author Report Posted February 24, 2022 I need to be able to use keys because my hardware is not a joystick and thus can only be programmed with key mapping. Understood, I'll try to see if I can make a log file; makes perfect sense. No worries, much appreciated!
Iceking007 Posted February 25, 2022 Author Report Posted February 25, 2022 (edited) Okay... let's try this again. Here are the files as requested; Joystick buttons goes with log 1 and works 100% as intended and desired. Then I change the code to have the buttons activate virtual buttons to perform the exact same code and I don't get the results I'm looking for. - AT ALL - }}}}}}} PLEASE NOTE :: These files are a complete disaster and a mess! The log files are !HUGE! I hope you can understand that. All I did was activate, perform all 6 modes with 4 variable adjustments (three times) for each one. These files were neat and organized, but please understand I have been reworking this code for days now and changed it around hundreds if not thousands of times. This way... that way... before... after... like this... upside down... I haven't tried it in German yet; but I will of you think that will help!! Anyways, the files are an embarrassment, hopefully you can find heads or tails of it. {{{{{{{ Thank you kindly. P.S. If able, please remove these files from the server once you have them. Edited February 25, 2022 by John Dowson attachments removed
John Dowson Posted February 25, 2022 Report Posted February 25, 2022 11 hours ago, Iceking007 said: The log files are !HUGE! I hope you can understand that. That is because you have IPC read logging activated. Your log files show nothing useful. For any future logs you attach, [lease just activate logging for buttons & keys and events - turn other logging off. And show the full log - you can zip it if its large. And I am still at a loss as to what you are actually trying to achieve. You say it works 100% for joystick buttons, by then also that your hardware is not a joystick and can only be programmed using key mapping. Before I look into this further, could you please try to explain what you are actually trying to achieve. Your previous descriptions don't make much sense to me I'm afraid. And you keep talking about a timer - as I said, this is not possible without resorting to lua, so please forget that for the time being. Can you please explain what you want to achieve with your key assignments, and in a way that does not refer to buttons or virtual buttons. We can see what virtual buttons/flags you need when I see the requirements for your assignments. It seems to me that you are making things overly complicated It seems you just want to change the assignments to certain keypresses based upon whether another key (or joystick button) has been pressed, no? On 2/24/2022 at 6:34 AM, Iceking007 said: Perhaps it isn't possible for a key or a button to call a procedure of a virtual button in compound statements. A key or button press cannot call any procedure- it can only perform what has been assigned. And do not confuse button flags with buttons. If you set or change a button flag, this does not mean that the button is triggered and the assignment on that button is fired. And there is also no need to do this - the action should be triggered by the key press itself. You have multiple assignments on the key press to achieve this, one to set/clear/toggle a flag (or multiple assignments if you want to do this for more than one flag), and then additional assignments, with your compound statements, to send the actual control which would be dependent on what flags are set. In summary, key presses can set/clear/toggle button flags, they cannot trigger button presses (and there is no need!). Your key assignments can check the state of the button flags to determine what action to perform. Note also offset 0x3340 can be used to trigger virtual button presses, if needed. However, it does say 'externally signalled' - not sure why, but this may/probably means that they can't be used for 'internal' assignments, although I'm not sure why... John Later: I'm sure that offset can be used, just not sure why the documentation says 'externally'....
Iceking007 Posted February 25, 2022 Author Report Posted February 25, 2022 Okay I apologize for upsetting you; I'm doing my best here. I'm not sure I can explain any better but I will try... I have a "cockpit/panel", in that I have my controls as I'm trying to get away from using a keyboard and mouse. I have come up with a plan to utilize four buttons on my yoke and five buttons on my hardware controller to perform certain commands inside fs. The yoke is commercially purchased and is recognized by everything as a "joystick". The hardware panel unfortunately only accepts keyboard key assignments/ programming (if there's a way I can make that a "joystick" - fine that would be dandy - however for now I'm stuck with keyboard assignments. The five buttons on the hw panel are ideally going to have 4 'soft' controls that will react to whether or not I select 2,4/2,5/2,6/2,7 or press the fifth button on the hw panel. This is why I'm using flags and conditional formatting. I'm sorry I'm such an idiot. I'm not confusing button flags with buttons, trust me. I am setting flags to create conspiring for the controls I want to activate. If my key assignments cannot trigger button presses then this is all moot, because that's what I'm trying to do... use hardware to send a keypress to fsuipc to activate a command for fs. I'm not sure what offset 0x3340 is... but that sounds useful. However I'm not sure what 'externally triggered' vs 'internal assignments' means (other than the obvious). Again I'm sorry you are so upset. I started trying to understand/ learn Lua last night... but I'm on a Windows computer and Visual Studios looks too complicated to me, and Sublime wouldn't open up a "Command Line" so I could test my code... I'm going to see if I can get that working. Also I will try to get you better logs with ONLY buttons as you requested.
John Dowson Posted February 25, 2022 Report Posted February 25, 2022 One more thing - on your timer... You could assign your key press or button (the one that controls what actions the other keys/buttons perform) to toggle/set a virtual flag, and also start a lua script (in separate assignments, of course). The lua script can start a timer, and in the timer handling function, clear/toggle the virtual flag. This should be straight forward to implement. Alternatively, and maybe better to get a fixed timer period, you could just have your key/button set the virtual flag, and have an already tunning lua (i.e. auto-started) also waiting for the same keypress, and starting the timer when received, and again in the timer function you can reset/clear the virtual flag (or set/clear any others). John
John Dowson Posted February 25, 2022 Report Posted February 25, 2022 9 minutes ago, Iceking007 said: Okay I apologize for upsetting you; You are not upsetting me....don't worry about that. I am just not understanding you... 11 minutes ago, Iceking007 said: If my key assignments cannot trigger button presses then this is all moot, because that's what I'm trying to do... You can, but only virtual button presses, via offset 0x3340. You cannot use a key assignment to trigger a button press from your yoke. But, there should be no need to. Just assign to the button press. 13 minutes ago, Iceking007 said: use hardware to send a keypress to fsuipc to activate a command for fs. Are the keypresses sent by your hardware seen by FSUIPC? This may be the issue. I know this is a problem in FSUIPC7, as this is an external program, and key presses sent by non-keyboard devices are not seen by FSUIPC7. So, the first thing to clear-up is if the keypresses sent by your hardware are seen and can be assigned in FSUIPC. Can they? 17 minutes ago, Iceking007 said: Again I'm sorry you are so upset And again, I'm not upset! If your device is a hid type device, you could try using lua to control it. There is a lua script available, called 'HidDemo.lua'. This will convert non-joystick hid device type button presses to virtual joystick button presses to which you can then assign. The lua should be available in the zip file Example LUA plugins.zip. If you don't have it (don't know if that was available in FSUIPC3) let me know and I can attach it. John
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now