Jump to content

Recommended Posts

Posted

Hi,

I have a question about how much delay one should add between "Do Script" and "Do Script FIle".  IN general I have been using the Time More () condition to do this.  I for those files that I think are large, I have used 4 seconds.  For the smaller ones, I have use 2 second intervals.  These files are nowhere near as large as MOOSE and such, and I really don't know what "large" is.

So, what is a reasonable interval to load script files?

TIA

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 12700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, HP Reverb G2, TM Warthog HOTAS with Virpil warBRD base, MFG Rudder Pedals, Virpil TCS Rotor Base with AH-64Dcollective, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Posted

This may be a silly question - why are you putting in the delay? Are there dependencies between the files you are loading, and if so, wouldn‘t it be easier to simply put the DOFILE actions into the same block? 

I‘m not sure, but is dofile executing asynchronously? If not (which is what I believe), I don’t see a reason for a time delay (I’m aware that the recommendation exists, but I have never understood it myself - did you run into any problems that could point to a load timing issue?) 

now, if you use multiple triggers to load multiple libraries, then yes, you may have to insure load order. I would not use time more, but set a flag when dofile is done (by adding a set flag action after dofile) and trigger the next loadfile on that flag.

Posted

You could always measure how long it takes a script to execute by printing timer.getTime(), run the script, and then print another timer.getTime(). 

The need to stagger any scripts is more of a question of the context that they are run in. For a script running on a server I think it is perfectly fine for it to execute everything at the same time near mission start. If it takes several seconds to do everything it needs to do then clients aren't really going to experience any server hangs due to the script being done well before someone even finishes connecting. Having a long pause due to a bunch of scripts executing in single player however is less than ideal. 

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

Posted (edited)

Thanks.  

 

This is for our squad, so multi-player in that respect.  I load all scripts near the start, spread out by about 2 seconds each.  All are loaded within the first 20 seconds.

 

Sounds like this is reasonable.

Edited by AKA_Clutter

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 12700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, HP Reverb G2, TM Warthog HOTAS with Virpil warBRD base, MFG Rudder Pedals, Virpil TCS Rotor Base with AH-64Dcollective, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Posted
3 hours ago, cfrag said:

This may be a silly question - why are you putting in the delay? Are there dependencies between the files you are loading, and if so, wouldn‘t it be easier to simply put the DOFILE actions into the same block? 

I‘m not sure, but is dofile executing asynchronously? If not (which is what I believe), I don’t see a reason for a time delay (I’m aware that the recommendation exists, but I have never understood it myself - did you run into any problems that could point to a load timing issue?) 

now, if you use multiple triggers to load multiple libraries, then yes, you may have to insure load order. I would not use time more, but set a flag when dofile is done (by adding a set flag action after dofile) and trigger the next loadfile on that flag.

1) I put in the delay because I thought I saw somewhere that they needed time to load. None are really dependent on each other or the order.

2) I'm not sure what you mean by "executing asynchronously", and less what impact/importance it may have.  I am a newbie when it comes to programing and doing lua scripts.

3) Wouldn't the Do FIle and Set flag execute at the same time?  Is that sufficient time that it would overwrite each other.  Again, this may be due to my neophyte understanding of how scripts are loaded and work.

Thanks for the response.

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 12700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, HP Reverb G2, TM Warthog HOTAS with Virpil warBRD base, MFG Rudder Pedals, Virpil TCS Rotor Base with AH-64Dcollective, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Posted (edited)
10 hours ago, AKA_Clutter said:

I put in the delay because I thought I saw somewhere that they needed time to load. None are really dependent on each other or the order.

In that case I would not worry about loading times at all. If it's an MP mission, I'd bunch all loads up at mission start, so when people have signed up to the server it's good to go.

10 hours ago, AKA_Clutter said:

I'm not sure what you mean by "executing asynchronously", and less what impact/importance it may have.

My apologies for being obscure. What I meant to say is that I'm wondering if multiple 'Loadfile' actions happen concurrently (at the same time in parallel, which could throw a spanner into things if one file depended on another being loaded already) or sequentially (one at a time, with everyone patiently waiting for each step to complete before the next one starts) as they are listed in the Actions block.

10 hours ago, AKA_Clutter said:

Wouldn't the Do FIle and Set flag execute at the same time?

That is the million dollar question. I don't know. I *believe* that in DCS all actions in the same block (including script loading) happen sequentially, and everything has to wait until the script loading is done. I also believe that only one trigger action block is ever being executed at the same time, and that there are no concurrent actions possible for scripting. So nothing could happen at the same time [Aside: what could happen is that if you have two separate triggers that have the same condition 'time more 2', and time is greater than two, that the order in which they are executed is indeterminate. They still won't run at the same time  - I believe].

BUT: I don't have any more knowledge than you in this matter, I'm just guessing.

Since I'm guessing that things happen sequentially, and I want all library loads happen at the very start of the mission, I'm doing this:

  1. Use an AT START trigger
  2. Bunch up all DOFILES in a single Action block, so I know in which order they happen. My libs occasionally do have dependencies, so I try to ensure that they are loaded in a certain order and this works well
  3. At the end I put out a "Message to all" to tell me that loading is done. This of course hinges on my guess about DCS working sequentially through actions (file loads) to be correct, and I have not yet had adverse experience, so it (so far) works for me. 

Here's how I load my scripts

image.png

Does my babbling now make a little bit more sense 🙂

Edited by cfrag
Posted

@cfrag,

Thanks for the detail explanation and taking the time to do it.  I really appreciate it.

It does make sense that it would do thinks sequentially.

 

 

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 12700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, HP Reverb G2, TM Warthog HOTAS with Virpil warBRD base, MFG Rudder Pedals, Virpil TCS Rotor Base with AH-64Dcollective, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

  • Recently Browsing   0 members

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