Jump to content

Known Scripting Engine Issues


Grimes

Recommended Posts

where to find tutorials on creating missions by scripting

 

A few pointers to add to what HiJack posted.

 

This wiki is a good reference for scripting:

http://wiki.hoggit.us/view/Simulator_Scripting_Engine_Documentation

http://wiki.hoggit.us/view/Mission_Scripting_Tools_Documentation

 

Be aware that many mission features cannot be accessed from scripting unfortunately (like any R/W interaction with the aircraft systems).

 

This is a great tool to do some interactive tests: (but it's a bit awkward to set up, there are two modes depending on what you want to do)

https://jboecker.github.io/dcs-witchcraft/

 

There are libraries like MOOSE and MIST with a fair amount of code, reading that helps a bit to understand how scripting works in DCS.

System specs: Win7 x64 | CPU: i7-4770K | RAM: 16 GB | GPU: GTX 980 Ti 6 GB | Thrustmaster HOTAS | MFG rudder pedals | SATA3 SSD | TrackIR

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
Guys I'm having a problem I am unable to edit any .lua files. The game won't start.

I tried to edit the Su-33.lua to correct weapon stations but the game does not start.

 

Probably related to the new integrity check system?

Link to comment
Share on other sites

Just to bring it to an end ...

 

The 'world.searchObjects' does indeed work for Object.Category.SCENERY.

It was a problem in my script. i queried attributes which are no longer there in the current version.

 

So everything is fine.

:)

Link to comment
Share on other sites

  • 11 months later...

Is Unit.getPlayerName( Unit ) bugged in multi player in the latest beta of DCS in multi player?

 

Can somebody try to obtain the player name of a unit using the above API on a multi player server?

 

sven

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

  • 9 months later...
  • 4 weeks later...
Is StaticObject.getByName() working for anyone else properly if it is being run from a Mission Start type trigger event (like in a script fired from Mission Start).

 

 

https://forums.eagle.ru/showpost.php?p=4210190&postcount=5

System spec: Intel i9 13900KF @ stock,  Gigabyte GeForce RTX 4090 Gaming OC 24GB GDDR6X, Gigabyte Z690 UD DDR4, Corsair Vengeance RGB PRO SL 32GB (2 x 16GB) DDR4 3600MHz C18, Samsung 980 EVO 500 GB NVME M.2 SSD (system drive), Samsung 970 EVO 1 TB NVME M.2 SSD (games drive), Cooler Master ML360 Illusion CPU Cooler, Asus XG43UQ Monitor, Oculus Quest Pro, Thrustmaster Warthog HOTAS, MFG Crosswind Rudder Pedals

Link to comment
Share on other sites

https://forums.eagle.ru/showthread.php?t=260977

getByName() returns nil for farps and oil rigs, didnt see this here.

 

 

Reference my above post, this appears to be fixed in 2.5.6

The test included the new animal type. cargo, farp, oil rig, building types tested and getByName() works

env.info("BUG REPORT")
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 an animal")
checkIsExist('cow')--returns true
env.info("BUG REPORT: trying a farp")
checkIsExist('farp')--returns true
env.info("BUG REPORT: trying an oilrig")
checkIsExist('oilrig')--returns true

which is great news thanks ED!

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

  • 1 year later...
  • 5 months later...
  • 1 year later...
  • 2 weeks later...

Hi,

world.event.S_EVENT_UNIT_LOST is not returning the correct category for vehicles.

It should return "1" (Object.Category.UNIT), but is returning "3" (Object.Category.STATIC)

 

edit: it is not only the category.

It seems that ground units are considered now static objects for the S_EVENT_UNIT_LOST. If you tried to use any "unit" related function (like event:initiator:getGroup()) the code launch an exception. This hadn't happened before.

 

categorybug.miz

 

 


Edited by daemon1808
new info
Link to comment
Share on other sites

@daemon1808 Event.initiator returns a Unit object. There is no Unit.getCategory(), so it defaults back to its base Object.getCategory().

event.initiator:getCategory() -- returns Object.Category

If you want to get the Unit.Category, you will need to get it from the descriptor.

event.initiator:getDesc().category -- returns Unit.Category

 

Link to comment
Share on other sites

1 hour ago, Chump said:

@daemon1808 Event.initiator returns a Unit object. There is no Unit.getCategory(), so it defaults back to its base Object.getCategory().

event.initiator:getCategory() -- returns Object.Category

If you want to get the Unit.Category, you will need to get it from the descriptor.

event.initiator:getDesc().category -- returns Unit.Category

 

Hi  @Chump

You have understood it wrong. I don't want the unit.category, I need the object.category.

Object.category for a ground unit must return "1", because the ground unit killed (the event:initiator) is a UNIT object, not a STATIC object. But the event:initiator:getCategory() of the event is returning "3" instead. In fact this only happens if the initiator is a ground unit, not an aerial unit (In this case it returns "1", as expected)

Not only that, as the initiator is no longer considered a UNIT for this event, now all functions related to a UNIT launch an excepcion, like event:initiator:getGroup() (because a STATIC object haven't a parent group).

This worked right 3 or 4 months ago. Now a script that worked before, is not working anymore because of this. 😞

 


Edited by daemon1808
Link to comment
Share on other sites

5 hours ago, daemon1808 said:

world.event.S_EVENT_UNIT_LOST is not returning the correct category for vehicles.

It should return "1" (Object.Category.UNIT), but is returning "3" (Object.Category.STATIC)

This bug was reported earlier this year, and a fix is in the making. 👍

  • Thanks 2

Don't accept indie game testing requests from friends in Discord. Ever.

Link to comment
Share on other sites

  • 1 month later...
23 hours ago, Loophole said:

groupObj:getUnits() for a train group only ever returns one unitObj, even if the train consists of multiple carriages.  Yet events like hit or dead will return different unitObj for different carriages in the train.

That is an oddity that occurs from how the train is formed. Each component isn't a unit, rather they are more like entities attached to the unit. It has been a while since I last tested scripting functionality on trains and I seem to remember making a few bug reports on the odd values returned by group and unit functions. 

nullimage.png

  • Like 1

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Link to comment
Share on other sites

  • 2 months later...

 

BUG :   Object.getName(Class Self )  return "static" instead of real static name like  "Static Infantry M249-1" ?

since DCS 2.8.3.37556 Open Beta - 10.03.2023

Major pain point as all DCS object are referenced in script by the name. 

way to reproduce : lua :

-- standard DCS Scripting functions 
  do
 
 local StaticObject1 = StaticObject.getByName("static1_for_test") -- Unit Name line "static1_for_test" in DCS Mission Editor ( no group Name line )
 local StaticObject1category = StaticObject1:getCategory()
 local StaticObject1name = StaticObject1:getName()
    
 trigger.action.outText("category :"..StaticObject1category, 5)
 trigger.action.outText("Name :"..StaticObject1name, 5)
 
 env.info("category :"..StaticObject1category,false)
 env.info("Name :"..StaticObject1name,false)
 
 -- RESULTS ! : since DCS 2.8.3.37556 Open Beta - 10.03.2023
 -- return correct Name "static1_for_test" from DCS OBJECT if Static unit is anything else than ground Unit( vehicle or infantery ) 
 -- return only "static" for Name from DCS OBJECT  if static unit is a ground unit ( vehicle or infantery )
  
 end


Edited by snowsniper
updated with more tests
 

 i7-10700KF CPU  3.80GHz - 32 GO Ram - - nVidia RTX 2070 -  SSD Samsung EVO with LG  TV screen 40"  in 3840x2150 -  cockpit scale 1:1

- MS FFB2 Joystick  - COUGAR F16 throttle  - Saitek Pro Flight Rudder Pedals

 

Link to comment
Share on other sites

We've got the same issue (getName() -> "static") on our side too. This is problematic because we need to dynamically enable/disable whole groups containing statics.

@BIGNEWY, do you know if this issue is going to be worked on?

Zip - VEAF :pilotfly:

 

If you want to learn, talk and fly with french-speaking friends, the Virtual European Air Force is here for you ! Meet us on our Discord and our forum

If you're a mission creator, you may want to check the VEAF Mission Creation Tools (and its GitHub repository) a set of open-source scripts and tools that make creating a dynamic mission a breeze !

Link to comment
Share on other sites

  • 4 weeks later...
On 3/16/2023 at 9:26 PM, davidp57 said:

We've got the same issue (getName() -> "static") on our side too. This is problematic because we need to dynamically enable/disable whole groups containing statics.

Fixed in OB.

  • Like 1
  • Thanks 1

Don't accept indie game testing requests from friends in Discord. Ever.

Link to comment
Share on other sites

Thank you Flappie, for letting me know!

And thanks to the ED devs for correcting this quickly.

 

Zip - VEAF :pilotfly:

 

If you want to learn, talk and fly with french-speaking friends, the Virtual European Air Force is here for you ! Meet us on our Discord and our forum

If you're a mission creator, you may want to check the VEAF Mission Creation Tools (and its GitHub repository) a set of open-source scripts and tools that make creating a dynamic mission a breeze !

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...