Jump to content

"do script file" does NOT execute


CougarFFW04

Recommended Posts

Hi everyone,

 

I am just doing basic testing of scripting at a waypoint.

So at Wpt 1 I have added a simple :

do script --> trigger.action.outText("SCRIPT : F16 passing Wpt1" , 10)

and

do script file --> testDoScript.lua (with just one line : trigger.action.outText("FILE : F16 passing Wpt1" , 10))

 

When I run the mission

- I see the "SCRIPT : F16 passing Wpt1" message

- but I do NOT see the "FILE : F16 passing Wpt1" message

 

What am I doing wrong ?

Must the lua instructions in the file enbeded in a lua function or whatever ?

 

Thanks


Edited by CougarFFW04
Link to comment
Share on other sites

7 minutes ago, dark_wood said:

place your Lua line between do and end statements:

 

do

    trigger.action.outText("SCRIPT : F16 passing Wpt1" , 10)

end

Pretty sure I tried this as well but didn't work.

Will try again and report


Edited by CougarFFW04
Link to comment
Share on other sites

Maybe is an issue with the waypoint approach.

Try to call the script file as usual (not on waypoint): ONCE > Time more 10 > Do Script File

If this is working, then you must use something else to achieve your goal - place small zones around waypoint, and use unit in zone, for example.

Link to comment
Share on other sites

6 minutes ago, dark_wood said:

Maybe is an issue with the waypoint approach.

Try to call the script file as usual (not on waypoint): ONCE > Time more 10 > Do Script File

If this is working, then you must use something else to achieve your goal - place small zones around waypoint, and use unit in zone, for example.

I will try but would be surprise that it could be the issue because the script is executed properly

Link to comment
Share on other sites

23 minutes ago, =475FG= Dawger said:

I tested this. It does not appear that Script File in Advanced Waypoint Actions works. What I would suggest is that you set a flag at waypoint passage and have the flag = true fire off the script via a mission trigger.

That's a workaround

BUT should'nt this work...

Link to comment
Share on other sites

Something else that always trips up DCS scripting newbies is that DCS doesn't automatically reload LUA files that are loaded via the Run Script or Do Script File commands. This means you can find yourself making a ton of changes to a file... and then seeing absolutely no change in the mission. The brute force way of addressing this is by going back to the Run Script or Do Script File commands and reselecting the LUA file via the file browser... but that's really horrible, and really error prone. 

 

The better solution is to use the Do Script command and just insert the following line of LUA:

 

dofile("C:/<...path to the folder...>/MyLuaFile.lua")

 

This ensures that the LUA file is always reloaded and refreshed every time you run the mission. Hope that helps.

 

 

Loading.PNG

 


Edited by Pizzicato
  • Like 1
  • Thanks 1

i7-7700K @ 4.9Ghz | 16Gb DDR4 @ 3200Mhz | MSI Z270 Gaming M7 | MSI GeForce GTX 1080ti Gaming X | Win 10 Home | Thrustmaster Warthog | MFG Crosswind pedals | Oculus Rift S

Link to comment
Share on other sites

On 10/12/2021 at 5:24 PM, Pizzicato said:

Something else that always trips up DCS scripting newbies is that DCS doesn't automatically reload LUA files that are loaded via the Run Script or Do Script File commands. This means you can find yourself making a ton of changes to a file... and then seeing absolutely no change in the mission. The brute force way of addressing this is by going back to the Run Script or Do Script File commands and reselecting the LUA file via the file browser... but that's really horrible, and really error prone. 

 

The better solution is to use the Do Script command and just insert the following line of LUA:

 

dofile("C:/<...path to the folder...>/MyLuaFile.lua")

 

This ensures that the LUA file is always reloaded and refreshed every time you run the mission. Hope that helps.

 

 

Loading.PNG

 

 

This works for mission testing.  Just remember when you make your mission available to others, that you need to load the actual lua into the mission.

-Wraith

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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