1. Just to be sure.

    In timer.Repeat
    delay = time to execute
    times = how many times
    function = what is going to run

    Right?
     
  2. Wulf

    Wulf Community Admin

    Spot on. :)
     
  3. Problem with that code in Python.
    delay is ok, times also... no about Functions() and what it does the issue comes...

    tried timer.Repeat( 5, 0, self.PrintThis ) and it worked the first time, but didnt repeat... istead is gave me:

    [Oxide] 7:43 PM [Error] RadtownEvent: ArgumentTypeException while calling OnServ
    erInitialized: Invoke() takes exactly 4 arguments (3 given)
     
  4. Code:
    timer.Repeat( 5, 0, self.PrintThis, self.Object )
    but not sure that it's good for Python
     
  5. With self, self.PrintThis it worked for the first time and the error was:


    [Oxide] 8:43 PM [Error] Failed to run a timer. (MissingMemberException: RadtownE
    vent instance has no __call__ method)
     
  6. Code:
    import System
    from System import Actionclass Test:
        def __init__(self):
            self.Title = "Test Plugin"
            self.Author = "Nogrod"
            self.Version = V(1, 0, 0)
            self.HasConfig = True
        def OnServerInitialized(self):
            def my_callback_func():
                print "Timer: " + self.Title
            timer.Once(1.0, Action(my_callback_func), self.Plugin )
            timer.Once(1.0, Action(self.other_callback), self.Plugin )
            timer.Repeat(1.0, 5, Action(my_callback_func), self.Plugin )
            timer.Repeat(1.0, 5, Action(self.other_callback), self.Plugin )
        def other_callback(self):
            print "Other Timer: " + self.Title
     
  7. Oohh, that "Action()" is from python or from our library?
     
  8. It's from .NET