
John Dowson
Members-
Posts
13,264 -
Joined
-
Last visited
-
Days Won
271
Content Type
Profiles
Forums
Events
Gallery
Downloads
Everything posted by John Dowson
-
P3Dv5, Sky Demon, missing Initial.lua
John Dowson replied to John Fee's topic in FSUIPC Support Pete Dowson Modules
Yes, please create a User Contribution for this - I think that would be useful! John -
PMDG 737 and myevents.txt for issuing the commands
John Dowson replied to AlMassimo's topic in FSUIPC7 MSFS
There are two methods to use the PMDG custom controls: one is via the Rotor Brake Control, and the 2nd method is to use the custom control number. EVT_MPM_AUTOBRAKE_SELECTOR is defined in the PMDG SDK header file PMDG_NG3_SDK.h: So the custom control number would be 69632 + 460 = 70092. For the values the control takes, you need to see what the associated variables holds: Generally you would use custom controls via the Rotor Brake method to emulate mouse clicks, and the custom control methos can send actual values (as well as emulate mouse clicks). See the followinf FAQ entries on using both methods, and on how to determine the control number/parameter to use" Note that there also special offsets for PMDG aircraft, so, for example, the current value of MAIN_AutobrakeSelector would be held in offset 0x6607 (if/when PMDG offsets are enabled and data broadcasting has been activated): John -
How can I decide if the aircraft loaded is a helicopter?
John Dowson replied to kaha's topic in FSUIPC7 MSFS
Two things wrong here: - there is no such type as S16 - use S32. And 4 bytes is too small - that should probably be 16 - the simvar name is AIRCRAFT OBJECT CLASS, not object_class Ah, missed that one, and that one is better as it also exists in MSFS2020. Just tried this in both MSFS2020 and MSFS2024 with the following entry in the myOffsets.txt file: and this seems to work in both MSFS2020 and MSFS2024: John -
PMDG 737 and myevents.txt for issuing the commands
John Dowson replied to AlMassimo's topic in FSUIPC7 MSFS
You could do that, but that is an issue - you would have to remember to not install that file each time you updated. I don't see any advatantage in doing this. Really I should process the myevents.txt file first, so the control numbers for the presets always start from that file. I could change this in the next release I guess, as anyone who is using the control numbers for presets is most probably not using the events.txt file for this reason. I think this is because you are writing the parameter AFTER the control number to offset 0x3110. As I said, you should write the parameter first, then write the control number to offst 0x3110 after the parameter has been written. The change in that version was to allow the same control number written to 0x3110 to still trigger the events. I will do some more testing on this next week, Well, that is surprising as the preset/calc code should be the same as sending the Rotor Brake control. I will also test this next week. Yes - this is what hat patched version was supposed to address, so I am not sure why it isn't working. I will get back to you sometime next week when I have had time to test a bit more. John -
Maybe better to send a fixed number of events on a short press rather than using the time, where the number of events could vary. To do this, use a counter instead of elapsed time: initialse the counter to zero before the loop, increment the counter in the loop and the loop condition should exit when the flag is cleared and the counter is above the minimum needed.
-
Here's an updated script with that added: local trimUpControl = 65615 local trimDownControl = 65607 function trimControl(flag) startTime = ipc.elapsedtime() nowTime = startTime if flag == 0 then -- trim up while ipc.testFlag(0) or nowTime - startTime < 100 do ipc.control(trimUpControl) nowTime = ipc.elapsedtime() end elseif flag == 1 then -- trim down while ipc.testFlag(1) or nowTime - startTime < 100 do ipc.control(trimDownControl) nowTime = ipc.elapsedtime() end end end event.flag(0, "trimControl") -- trim up event.flag(1, "trimControl") -- trim down ipc.log("*** lua elevator Trim (repeat) script now running") elevTrimRepeat.lua
-
Yes - and I corrected my previous post.
-
Use the ipc.elapsedtime function just before the loop starts (startTime) , and again after the control has been sent (nowTime). Then change the condition in the while loop to only exit the loop when the flag is not set or the difference between the two times is > 100 (i.e. ipc.testFlag(1) or nowTime - startTime < 100).
-
Note also that all auto-ran lua scripts are killed and restarted when you go back to the main menu. If you are having the script auto-ran from the general [Auto] section (as opposed to a profile [Auto.xxx] section, you can just exit the script if you don't want to use it with the loaded aircraft, as this would save resources. I would not recommend changing aircraft without going back to the main menu (e.g. via devmode aircraft selector or other means) as this method is not fully supported by FSUIPC. John
-
The script I provided will be a lot more efficient as there is no timer running and it just re-acts to the flag-change events. Why are you testing/checking the aircraft name - are you running the script for all aircraft? Much better to just have the lua script auto-started in a profile for the aircraft that need it. John
-
Try the following: local trimUpControl = 65615 local trimDownControl = 65607 function trimControl(flag) if flag == 0 then -- trim up while ipc.testFlag(0) do ipc.control(trimUpControl) end elseif flag == 1 then -- trim down while ipc.testFlag(1) do ipc.control(trimDownControl) end end end event.flag(0, "trimControl") -- trim up event.flag(1, "trimControl") -- trim down ipc.log("*** lua elevator Trim (repeat) script now running") Have that script auto-ran via your profile [Auto.xxx] section, then assign your trim buttons to: trim Up: press to 'LuaSet <luaScriptName>' with parameter 0, release to 'LuaClear <luaScriptName>' with parameter 0 trim Down: press to 'LuaSet <luaScriptName>' with parameter 1, release to 'LuaClear <luaScriptName>' with parameter 1 if its too fast, add an ipc.sleep(n) (where n is the number of ms to sleep, start with 10 and adjust as needed) after the ipc.control calls. John elevTrimRepeat.lua
-
MSFS 2024, none of the aircraft presets are working
John Dowson replied to igorekDE's topic in FSUIPC7 MSFS
First, you posted in the main support forum - please use the FSUIPC7 sub-forum for all issues/questions on using FSUIPC7 with MSFS2020/MSFS2024. I have moved your post. Looking at your log file, this is because the WASM module is not installed: Presets, lvars. hvars and calculator code will not work without the WASM. So please re-install and make sure the WASM is installed. If there are issues instaling the WASM, please show me / attach your InstallFSUIPC7.log file. Your log file also showa connection issue with quite a few connection attempts. You manually started FSUIPC7 before starting MSFS. If manually starting FSUIPC7, then it is always better to do this after FSUIPC has started. If you wnt to start FSUIPC7 before MSFS, then you need to set the ini parameter DetectToConnectDelay to the same value as DetectToConnectDelayAuto to prevent too many connection attempts once MSFS has started. It is generally better to use the auto-start facility, but if starting FSUIPC7 manually then do this once MSFS has started and arrived at the main menu (or adjust that parameter appropriately). John -
Ok, let me know how it goes or if you have any issues/further questions. Thinking about this, it won't be that straight forward, as you need to repeat sending the control while the button is held down, and stop sending them when the button is released. This can be tricky in lua. Off-hand, I can think of a couple of ways of doing this, but each may have issues and will need testing: 1. Use event.button and have the script auto-run (in the profile). The event.button handling function should loop forever sending the control. To stop the controls being sent, you need to assign the same button, but on release, to restart the lua script. This will then kill the existing script (and end the forever loop) and restart it ready for the next button press. The downside of this solution is that there may be a small delay after releasing before pressing will work again, as the script needs to be restarted (and recompiled first). 2. Again, have the script auto-ran (in the profile), but use event.flag instead, and assign the button press to LuaSet <luaScript> and the release to LuaClear <luaScript> (or maybe just both to LuaToggle), with the parameter for both being any flag number (0-255). In the event.flag handling function, you would either: - start an event.timer, which would call a handing function at regular intervals which sends the appropriate inc/dec control - cancel the existing timer using event.cancel. The downside of this solution maybe the speed/throughput, which will need testing. Note also you could either use one script for both in/dec, or have separate scripts. Let me know how it goes, I could maybe take a deeper look over the weekend (or next week) and see what works best, and provide you with a lua template script if needed. John
-
The log file you attached shows that FSUIPC could not connect to MSFS. Nothing is going to work if it cannot connect. Try tuning your start-up parameters (namely the DetectToConnectDelayAuto ini parameter which may need updating/increasing) - see the Asvanced User guide for details, or the following FAQ entry: But the ini file you attached shows you do not have any axes/levers assigned in the general section of FSUIPC - your [Axes] config section is empty. You only have 10 button assignments, to prop pitch, throttle and elevator trim. So the axes must be assigned in MSFS, so check there. You also have one profile defined for the 'FSS Embraer E170 American', but this is empty (i.e. no assignments).
-
That is interesting, as this means that what you wrote to the offset was actually applied, as the read values are populated from what is received from the FS, not what is written (there are separate memory addresses for read and write).. Strange this has no effect then. Do you see the (read) values change in that offset when you actually change the trim? Ok, let me know how it goes or if you have any issues/further questions. John
-
Setting the ButtonRepeat ini parameter will apply to all buttons, as you say. If you want to change for a single button, you could try using a lua script (using event.button) instead of a direct assignment. But if this is for trim, doesn't the standard method of setting up trim work? i.e. rather than sending more/repeated inc/dec controls, set the elevator trim percent via offset 0BC0? You can also use different inc/dec deltas to have a fast and a slow increase/decrease. This is the standard method of assigning to replicate a trim wheel. For example, these are the assignments I use on a rotary to control the trim (for most aircraft): There are also some more advanced lua solutions in this FAQ entry: John
-
No. It is generally better to assign with Send direct to FSUIPC calibration (and calibrating). Only use Send to FS as normal axis if sending to calibration causes issues or doesn't work, which can happen with some aircraft. Note that, by default, axes assigned using Send to FS as normal axis are still calibrated in FSUIPC (if a calibration section exists), but this is performed after the event has been received back from the FS (which is masked/blocked). John
-
What has this got to do with FSUIPC? You can control how FSUIPC sees/reacts to button presses/holds/releases, but FSUIPC cannot do anything with what any other application, including the FS, receives/reacts to these button events. FSUIPC only sees and reacts to button press/releases, it does not send them on to other applications (that is windows' job!). The ButtonRepeat ini parameter controls how FSUIPC reacts to a held button press, and specifies the time between the button press and the first repeat, and the time for subsequent repeats, AS SEEN by FSUIPC. Changing this effects the button handling in FSUIPC only, not how other applications see/react to the button press. Note that FSUIPC does have a 'hold' action on button presses: However, I am not exactly sure what this does - looks like it is used when assigning a button to send a key press and will then hold the assigned keypress until the button is released. So if that is what you are looking for, you could try that. Normally you would just use repeat (R), i.e. the assigned control is continually sent while the button is held down, and set by checking the 'Control to repeat while held' checkbox in the assignments panel. John
-
PMDG 737 and myevents.txt for issuing the commands
John Dowson replied to AlMassimo's topic in FSUIPC7 MSFS
Yes. Hopefully that modified version I attached above will allow the same control yo be resent via 0x3110 - let me know if that works. And as I said, I can't really help with SIOC. However, I do see that you had similar issues sending presets via SIOC 3+years ago, which you reported in this thread: Understandable - and that is why I was using parameters > 0, and just setting back to 0 in the event handler rather than in the client after sending the proper parameter, as you seem to be doing when using SIOC. I have looked at this several times now and just don't understand why lua executes so much slower in FSUIPC7 compared to previous versions of FSUIPC. There has been no real change in the lua engine or how this runs in FSUIPC7 (threads, etc) compared to previous versions, just updates to the additional lua library functions. So I don't understand the performance difference in FSUIPC7. I will look at this again when time permits, but as well as not having the time/resources for this at moment, I am not sure even where to start... John -
PMDG 737 and myevents.txt for issuing the commands
John Dowson replied to AlMassimo's topic in FSUIPC7 MSFS
I don't get that many fast updates as I was using the same parameter for both the press and release. As these alternate, it makes more sense to use different values, so the offset is actually changing on each click. So if I change: to - clockwise slow press, assigned to Offset Byte Set (on 0xA030) with value 1 - clockwise slow release, assigned to Offset Byte Set (on 0xA030) with value 2 - clockwise fast press, assigned to Offset Byte Set (on 0xA030) with value 3 - clockwise fast release, assigned to Offset Byte Set (on 0xA030) with value 4 - anti-clockwise slow press, assigned to Offset Byte Set (on 0xA030) with value 5 - anti-clockwise slow release, assigned to Offset Byte Set (on 0xA030) with value 6 - anti-clockwise fast press, assigned to Offset Byte Set (on 0xA030) with value 7 - anti-clockwise fast release, assigned to Offset Byte Set (on 0xA030) with value 8 then I can get around 11 callbacks on the fast button per second: Not as fast as using flags, and only applicable if your rotary buttons alternate between a press and release, in which case you should use separate parameters/values for press and release so that the offset change is triggered. John -
PMDG 737 and myevents.txt for issuing the commands
John Dowson replied to AlMassimo's topic in FSUIPC7 MSFS
I have made a few tests here. Some observations: 1. my rotary buttons alternate between presses and releases, so I assign the same control to both the press and release 2. only offset changes will cause an event to be triggered, i.e. if you are writing the same value, no event gets triggered. Observation 2 is the killer here, and it means that you have to reset the value in the offset to pick up further changes. However, this is best done in the function that handles the offset event. This is the lua I am using for this test: And I assign my rotary buttons as follows: - clockwise slow, assigned to Offset Byte Set (on 0xA030) with value 1 - clockwise fast, assigned to Offset Byte Set (on 0xA030) with value 2 - anti-clockwise slow, assigned to Offset Byte Set (on 0xA030) with value 3 - anti-clockwise fast, assigned to Offset Byte Set (on 0xA030) with value 4 With these assignments, I can get up to 7 or 8 slow button changes per second: However, when turning the dial two fast, the events aren't triggered: What seems to be happening is that although the offset is being reset back to 0, it is getting updated back to the fast value again (2) too fast to trigger the event. This makes the fast rotary buttons almost impossible to use consistantly. But if I switch to using flags to trigger the change, using the following lua: and assign my rotary buttons to: - clockwise slow, assigned to LuaToggle <luaFileName> with parameter of 1 - clockwise fast, assigned to LuaToggle <luaFileName> with parameter of 2 - anti-clockwise slow, assigned to LuaToggle <luaFileName> with parameter of 3 - anti-clockwise fast, assigned to LuaToggle <luaFileName> with parameter of 4 then I get a lot better throughput with both the slow and fast buttons - here you can see 23 change events logged in under a second: So maybe try switching to assign your buttons to a lua flag toggle (in SIOC, if this is possible...), and use event.flag in your lua scripts to pick up the button press (there are 255 flags available per script). Yes, this is a problem when using offset 0x3110, as only changes to the value in the offset trigger the event, so if you are writing the same control (i.e. Rotor Brake control number 66587) then only the first one will be sent and the subsequent ones ignored as there is no change in value in 0x3110. I will look into this in more detail when I have time, but can you try the attached version where I have reset the (internal) contents of 0x3110 once the event has been sent. Hopefully this will work but I don't have time to test this at the moment. Let me know if this works better when sending the same control.. John -
P3Dv5, Sky Demon, missing Initial.lua
John Dowson replied to John Fee's topic in FSUIPC Support Pete Dowson Modules
That is not an issue - that is just a lua file that is ran on start-up if found. If its not found, a message is logged but this is not a problem. Have you configured GPSOut in FSUIPC6 (you didn't attach your FSUIPC6.ini file)? As far as I am aware, SkyDemon just needs the GPSOut data which needs to be configured via virtual COM ports.. Maybe check the following post (and the posts it references): John -
Trim in MSFS2020 gone crazy in 7.5.2/7.5.3?
John Dowson replied to Luis Hernández's topic in FSUIPC7 MSFS
Ok, I thought that would be the issue - no need to look at your files. Ooh - sounds like a bit of a pain. How did that happen? Did you check your Recycle Bin? John -
PMDG 737 and myevents.txt for issuing the commands
John Dowson replied to AlMassimo's topic in FSUIPC7 MSFS
Yes, but this can depend heavily on the system and configuration. There are various polling parameters that can be tuned, but you need to determine where the bottle-neck is first. And over-tuning can make things worse. But you probably won't get more than 5 or 6 clicks/button presses a second on rotaries when using lua (in MSFS2020/2024), Also, be aware that many rotaries have two buttons in each direction, one activated on a fast turn and another on a slow turn. There is also a lua script that can convert rotaries with a single button in each direction to work with 2 virtual buttons in each direction instead (see Rotaries.lua in the example lua scripts). What you would normally do is assign the fast rotary button to a large delta, and the slow button to a small delta, so the increments/decrements on a fast turn are a lot larger than a slow turn. You shouldn't need to do this (i.e. set the parameter to 0 first). And it is writing the control number that triggers the event being sent, so this should be written AFTER the parameter has been written. So, what is probably happening is that the previous parameter is being sent when you write the control number. Try writing the parameter first before the control number, and no need to reset to 0 or add a delay. But I think there is an issue with offset 0x3110 in that the control is not triggered if the value is not changed, so maybe this was added to get around this? With direct assignments to rotary buttons, I get a 15-35ms delay between each recognised button press. However, it will be a lot slower in lua. In the next few days I can write a short lua script that waits on an offset change, and assign the rotary buttons to set the offset, and I will se what speeds I can get. Note also that some rotaries alternate between emitting button presses and button releases. For such rotaries, you can assign to both the press and release to double the throughput. John -
custom button control for PMDG 747
John Dowson replied to Flyer626's topic in FSUIPC Support Pete Dowson Modules
Yes - you always add the value to THIRD_PARTY_EVENT_ID_MIN, which is defined as the hex number 0x00011000 which is 69632 in decimal.