-
Posts
104 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
-
Location
Mallorca
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
dazz's Achievements
-
Thanks, John. Turns out I had an ipc.exit() somewhere that was responsible for the thread interruption. The range wasn't being entered again before the thread completed running The LuaRerunDelay parameter could be useful for some other application, good to know. I don't think i'll need it this time around. The script is working fine already. I really need to re-read the advanced guide again. It's been a while. Muchas gracias de nuevo 😃
-
I'm super rusty and I don't seem to remember if there's a way to do what I mention in the title. I need my script (it's tied to an axis range) to complete execution, but sometimes it doesn't, I suspect it's because another input is detected for the axis, but I'm not sure because the log doesn't print the lines I have at the beginning of the script after the interruption of the previous execution. Is there a way to get a "lock" or something like that? Thanks Using FSX and FSUPIC4 v4.977, I believe it's the latest one
-
Overriding functions in a separate Lua script
dazz replied to dazz's topic in FSUIPC Support Pete Dowson Modules
Nevermind. I figured it out. All I needed to do is to ensure that the code was loaded and executed in the right order. -
Hi there, long time no see! Hope you're doing great, Pete. So I'm planning to go back to doing some flight simming after a long hiatus. Got some new gear and I'm in the process of configuring everything in FSUIPC/LINDA. I have a Lua script to map the flaps, spoilers and gear lever to a single axis using ranges. The idea is to push the lever all the way up/down to retract/deploy the gear, while a smaller input to the lever increments or decrements the flaps. Then I use the global shift utility in LINDA to duplicate that for the spoilers. I have a Lua script to take care of all that called lindaDefault.lua, which works well for aircrafts that use default controls for the gear, flaps and spoilers. The plan is to then use specific scripts for planes that require some custom logic for some or all the controls. These scripts execute a require('lindaDefault') so that they have access to all the default functions there, and then I can (hopefully) override the functions that are needed to make the script work for that specific plane. For example, the NGX uses different controls for the spoilers, so I would be overrinding those functions while using the default ones for the flaps and gear. This is a snippet of lindaDefault.lua, containing one of the functions - spoilersDeploy() - that are meant to be overriden if necessary. [code] ------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------- OVERRIDABLE FUNCTIONS --------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- function spoilersDeploy() ipc.control(66064) -- Spoilers Deploy end ------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- function AXIS_GEAR_SPOILERS_100() if SHIFT_GLOB == 0 then ipc.control(66080) -- Gear down else spoilersDeploy() end ipc.set('LEVER_MAXED_OUT', true) end FUNCTIONS = { [1] = AXIS_PARKINGBRAKES_SPOILERS_OFF, [2] = AXIS_PARKINGBRAKES_SPOILERS_ON_ARM, [3] = VOID, [4] = AXIS_FLAPS_SPOILERS_DEC, [5] = AXIS_FLAPS_SPOILERS_INC, [6] = AXIS_GEAR_SPOILERS_0, [7] = AXIS_GEAR_SPOILERS_100, } func = FUNCTIONS[f] if (func) then func() else ipc.log('nope, no function here to be called') end [/code] Then I have this lindaNGX.lua that's supposed to override the spoiler functions like this: [code] require('lindaDefault') ------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------- OVERRIDABLE FUNCTIONS --------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- function spoilersDeploy() ipc.control(86637, 16384) -- Spoilers Deploy end function spoilersRetract() ipc.control(86637, -16384) -- Spoilers Retract end function spoilersArm() ipc.control(86637, -13100) -- Spoilers Arm end function spoilersDisarm() spoilersRetract() end ------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------- [/code] This is not working. The functions in lindaDefault.lua are the ones being called. Any ideas, please? Thanks in advance.
-
Yeah, silly me. I haven't fired up my sim in ages and since all my assignments are in Lua - Linda, I just opened my NGX script and searched for "taxi" without even thinking. That parameter probably came from flipping switches in the cockpit while tracing control changes. Thanks for the clarifications
-
try this Ron: ipc.control(69749, 536870912)
-
Does that apply to loading, I don't know, the 900, then another NGX variant like the 800WL or 700 or whatever?
-
I use the path of the AIR file. function loadFunct() acPath = ipc.readSTR(0x3C00, 256) if (string.find(acPath, "00NGX") == null) then ... end end event.sim(FLIGHTLOAD, "loadFunct") [/CODE]
-
I'm testing with Fs2Crew after reloading the flight and it seems to be very wrong. Plenty of "are you sure about that" when the items are clearly correct, like anti-collision lights on, and I can't contact ground crew either, so yeah
-
Damn it! , it's also happening to me and I thought it was something in my code. I can force to restart my dll in the middle of a flight, but if I load a different flight it stops working
-
Project released, in case someone wants to check it out http://forum.avsim.net/topic/368674-a-little-project-of-mine-for-simpit-builders-ngxsdk2lua/
-
Roger that. And please Pete, don't let the FSUIPC4.dll crash steal too much of your time. It really takes a bunch of restarts to crash the sim.
-
Here's the log in the event viewer with version 4.812f Exception code: 0xc0000005 Fault offset: 0x0004f590 Faulting process id: 0x1bbc Faulting application start time: 0x01cd119264c5fc9a Faulting application path: C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\fsx.exe Faulting module path: C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\FSUIPC4.dll And I tried the event.terminate thing (this is the script I use to start & restart the dll, calling it from ipcReady with ipc.runlua, so that it runs in it's own thread): require "ngxSDK2Lua" function restartNGXSDK2Lua() acName = ipc.readSTR(0x3D00, 100) if (string.find(acName, "NGX") == null) then return end resp = ngxSDK2Lua.start(); if (resp ~= nil) then ipc.log(resp) end end function kill() ipc.log("Killing ngxSDK2Lua ...............") resp = ngxSDK2Lua.kill(); if (resp ~= nil) then ipc.log(resp) end end event.offset(0x3D00, "STR" , "restartNGXSDK2Lua") event.terminate("kill") [/CODE] ...but I don't see the "Killing ngxSDK2Lua ..............." trace printed in the log, not sure it's working
-
Ok, I'll try that version of FSUIPC. It's a very rare occurrence really so it doesn't worry me much. I need to keep restarting the dll over and over again to trigger the error, so it's not that big of a deal I think. As for the event.terminate part, I'll try that, but I'm not creating a new thread in the dll in the end. It was crashing like mad when I tried it and couldn't figure out why, but will see if event.terminate helps Thanks for the suggestions
-
Pete maybe you can give me some guidelines on how to proceed to debug this: When I restart the dll in the middle of a flight, I can do it in two ways: 1.- Call the Lua script that starts the dll. It calls a function in the dll that starts the SimConnect communication. When I do that the previous instance seems to vanish on it's own, and the new one starts just fine. Problem is that after a number of restarts I get a CTD in FSUIPC4.dll (different fault offsets, here's two examples): Exception code: 0xc0000005 Fault offset: 0x0004afc2 Faulting process id: 0x1944 Faulting application start time: 0x01cd118cc82d9b4b Faulting application path: C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\fsx.exe Faulting module path: C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\FSUIPC4.dll Exception code: 0xc0000005 Fault offset: 0x0004dbaa Faulting process id: 0x1ab4 Faulting application start time: 0x01cd118f381ebe6b Faulting application path: C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\fsx.exe Faulting module path: C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\FSUIPC4.dll 2.- If I do a Lua KillAll I get an instant CTD in ntdll.dll: Exception code: 0xc0000029 Fault offset: 0x000907b6 Faulting process id: 0xc84 Faulting application start time: 0x01cd118ba3ba321e Faulting application path: C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\fsx.exe Faulting module path: C:\Windows\SysWOW64\ntdll.dll what tools can I use to figure out where the problem is please?