1. Code:
    var dict = new Dictionary<Door, Timer> { ... };void someFunc(Door door) {
       ...
    }void f1() {
       ...
       Door[] doors = ...;
       foreach(Door d in doors)
          dict.Add(d, timer.Once(3600 * 3, () => {
             someFunc(d);
          });
       ...
    }
    I'm trying to call someFunc with parameter 'd', but this variable would be dead (null) for that time (after 3 real hours). Is there any fast and lean way for saving variable, For now I'm using Queues, but it's not good for me and performance. Thanks, in any way
     
  2. Can you explain what you're trying to achieve in game terms?
     
  3. I'm trying to write a decay plugin. I saw some of them, they are too slow for me: search for all BaseCombatEntities of a map every, for instance, six hours! For now I think it'd be enough if a plugin will look for some simple objects (e.g. doors) at Init stage and periodically decay objects around them. It'd be much faster, although not so effectively. Every door has its own timer. But when timer elapses I need the object (the door), which had that timer.

    You know, the trouble is is here some Timer-class (not the object "timer), so I could create new instances of it and compare them? But if timer elapses, how can I know
    which timer has called the function?
     
  4. I'm not quite sure what you mean. Does this help?

    Code:
            protected class DoorTimer
            {
                public Door Door { get; set; }
                public Timer Timer { get; set; }
            }        List<DoorTimer> doorTimerList = new List<DoorTimer>();        void SomeFunc(DoorTimer doorTimer)
            {
               // Can access both door and timer
            }        Door[] GetAllDoors()
            {
                // ..
            }        void Init()
            {
               Door[] doors = GetAllDoors();
               foreach(Door door in doors)
               {
                   DoorTimer doorTimer = new DoorTimer { Door = door };               doorTimer.Timer = timer.Once(3600 * 3, () => { SomeFunc(doorTimer); });               doorTimerList.Add(doorTimer);
               }
            }
     
  5. I think that will work. Thanks.