Pikey Posted January 17, 2020 Posted January 17, 2020 Hi, myObject = StaticObject.getByName('farp') if myObject:isExists() then end Will error in DCS 2.5.5.41962 because getByName() returns nil for Farps and Oil Rigs (so far, could be more like a static ship with helipad). I've no idea what version this was last OK in. It might be something from a long time back but it came to light for me recently. REPRO steps Load the mission attached, (no moose/mist or anything, it's just pure DCS api) the code is on a menu trigger. When the mission is loaded open the F10 menu, "Other" and press F1 to run it. Open the dcs.log, look for "BUG REPORT" You can see the script returned ok for a tech combine object, then a barrel cargo and then tries a farp and causes the error. IMPACT Actually this is rather severe, despite looking innocuous. getByName() is pretty fundamental and extremely well used method to find any static you want to do something with, in a script, like remove it, find its coordinates, but a farp is absolutely key as an airbase type. The issue comes from existing code already using getByName() in key scripts and being unable to filter between whatever object name you asked for by name. It's broken a lot of things for me, i'm not sure about others, it's quite deep when used by things like MOOSE for larger scripting modules. I tend to get lists of statics and run through them and check if they exist, get their coords and so on and if I try to access farps this way it will halt any scripting. CODE (if you want it seperately) local function checkIsExist(Name) local static = StaticObject.getByName(Name) if static:isExist() == false then env.info("BUG REPORT: "..Name.." does not exist (but getByName() works)") else env.info("BUG REPORT: "..Name.." returns true for both getByName() and isExist()") end end env.info("BUG REPORT: trying a techcombine") checkIsExist('techCombine')--returns true env.info("BUG REPORT: trying a cargo barrel") checkIsExist('Barrels')--returns true env.info("BUG REPORT: trying a farp") checkIsExist('farp')--errors env.info("BUG REPORT: trying an oilrig") checkIsExist('oilrig')--errorsSorry if this is known/reported and I am late.getByNameBug-ReadLogUseF10.miz ___________________________________________________________________________ SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *
ED Team BIGNEWY Posted January 17, 2020 ED Team Posted January 17, 2020 Hi Pikey we do have this already reported and I have added your information to the report. thanks Forum rules - DCS Crashing? Try this first - Cleanup and Repair - Discord BIGNEWY#8703 - Youtube - Patch Status Windows 11, NVIDIA MSI RTX 3090, Intel® i9-10900K 3.70GHz, 5.30GHz Turbo, Corsair Hydro Series H150i Pro, 64GB DDR @3200, ASUS ROG Strix Z490-F Gaming, PIMAX Crystal
Recommended Posts