burritto Posted March 2, 2021 Share Posted March 2, 2021 Good evening to the DCS collective brain trust. I'm trying to write a script that would delay players hopping between coalitions during the course of a mission. I have a script that works for the entire mission, building tables of data that then get's cleared when the next mission loads, but the next iteration is using some form of timer function to set a delay instead (say 30 mins in spectators or off the server before you could change). I've tried both using timer to build tables (my preferred option at the moment) and the schedule function, but they both fall over when I call any timer functions. My syntax at the moment is: local timenow timenow = timer.getTime() I would then use the timenow variable to fill values in tables where needed. My expectation was that timenow = timer.getTime() would return a numerical value that I could then store against the UCID and then later compare against a new value returned by a new call of the timer.getTime() function. But I just get the following error in the DCS log 'attempt to index global 'timer' (a nil value)' and the function falls over. The timer function call is part of a callback that is hooked onPlayerConnect and OnPlayerChangeSlot . I'm sure there is a very obvious reason why this doesn't work this way, but I can't see it for staring at it. I'm running my multiplayer instance from the New Server option on the multiplayer screen for now rather than a dedicated server, if that would make a difference. Thanks all. Link to comment Share on other sites More sharing options...
CakeSorbus Posted March 2, 2021 Share Posted March 2, 2021 You execute your script in the server environment, right? As far as I understand the documentation on Hoggit, functions related to the timer singleton are only included in the mission scripting environment. Link to comment Share on other sites More sharing options...
burritto Posted March 3, 2021 Author Share Posted March 3, 2021 That would certainly explain it, thank you. It's prompted me to look at the control API doc in the DCS install and a few more options to try. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts