Jump to content

Lua Noob help with Timer functions


burritto

Recommended Posts

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

  • Recently Browsing   0 members

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