Forum Multiplayer Timer Error

Discussion and help relating to the PlayerIO Multiplayer API.

Timer Error

Postby LaMey » October 30th, 2017, 3:46 pm

Hello Guys,

I get an error that I have to give my Timer more than 25 milliseconds:

Why I get for "sec" 0?:

Code: Select all
TimeSpan p = time_last.AddSeconds(75) - DateTime.UtcNow;
int sec;
int.TryParse(p.TotalSeconds.ToString(), out sec);
Timer(sec);
LaMey
 
Posts: 2
Joined: August 28th, 2017, 11:21 am

Re: Timer Error

Postby nacra » October 31st, 2017, 1:27 am

I can verify that Game.AddTimer requires an interval of more than 24 milliseconds. The line below throws that same error.

I guess in your example, Timer(sec) is a function that you've defined? Anyway, where you call AddTimer, you must pass an interval argument of 25 or more. It looks like you're using only whole seconds, so your minimum timer interval may well be 1000ms.

Code: Select all
PlayerIO.GameLibrary.Timer timer = this.AddTimer(delegate() { Console.WriteLine("test timer"); }, 24);
nacra
 
Posts: 1
Joined: October 27th, 2017, 11:06 pm


Return to Multiplayer



cron