Buzzkillington Posted October 3, 2021 Posted October 3, 2021 I'm looking at a mod that isn't reliably setting switch positions if 2 calls to performClickableAction happen in quick succession. It appears only the first gets executed. If I put a delay between them (~100ms) then both operate successfully. I've put print statements right at the call to performClickableAction and for both calls the command seems properly formed (ie the mod did send both). There is no apparent difference between the calls with or without the delay (working or not working). Is this a know behavior of that function call? I wasnt able to find where in DCS that function is defined despite searching both the steam and saved games folders. I also looked at the return code and it seems to return 1 when I set and 0 when I clear the switch so thats no help. Any other ideas besides putting a sleep command?
Dweeeeb Posted October 28, 2021 Posted October 28, 2021 Hey... sorry this is a bit late..... I had something similar happen to me..... in the end I found it was because the local update time step was too slow (or too fast, cant remember).... look in the device lua you are using.... for these lines...... local update_time_step = 0.2 make_default_activity(update_time_step) I had 2 different performClickableAction commands in 2 seperate device luas ...... they had different local update_time_step times and one was reliant on the other to work... but only worked sporadically because the update times didnt always sync..... ..... in the end I had to define a parameter that could be called in both device luas .. at the same time regardless of syncing...... that worked... If this makes sense (??!!) to you, then you know what needs to be changed...
Buzzkillington Posted October 29, 2021 Author Posted October 29, 2021 Thanks for the reply. it sounds like your performClickableAction case came from 2 different modules and it was a race condition? Mine is from a while loop, essentially pseudo code below, so each is from the same calling function and each is guaranteed to be sequential. Does you case still apply? for(i=0; i<numActions,i++) performClickableAction(i)
Recommended Posts