When I use the timers. If I have in example Timer T1. If I make one void that uses Timer (T1) once with a variable and then that same void calls same timer for another action the current variable will be replaced with the new variable. I want timer run out with all called variables instead of replacing first one. Anyways for multitask/threading?
Multiple timers in the same function? (C#)
Discussion in 'Rust Development' started by Pastori, Dec 8, 2015.
-
Wulf Community Admin
You can create a dictionary with the timers in it.
-
Hmm? I have no clue how it works. I found an example:
How much different it's with timers. Never heard about that yet. I'm not programming much with C# anymore.Code:Dictionary<string, int> dictionary = new Dictionary<string, int>(); dictionary.Add("cat", 2); dictionary.Add("dog", 1); dictionary.Add("llama", 0); dictionary.Add("iguana", -1);
Actually what I read about it. I found that I can store data into dictionary, but I don't understand how the storing will be help with timers. I have no idea at all :\
Currently there is:I have no idea what I basically have to do at all. Do I have to make a dictionary with objects or what.Code:T1 = timer.Once(180, () => myFunc(funcId));
[DOUBLEPOST=1449655664,1449611276][/DOUBLEPOST]Whatever. I stored data into Dictionary and List and set one repeat timer remove after TIME elapsed, but didn't found a way for more timers with Dictionary. -
Calytic Community Admin Community Mod
something like this..
Code:Dictionary<string, Timer> myTimers = new Dictionary<string, Timer>();myTimers.Add("timer1", timer.Once(180, () => myFunc(arg1)));if(!myTimers["timer1"].Destroyed) { myTimers["timer1"].Destroy(); }
