TimeHandler change Time?

Help
2006-04-28
2013-04-09
  • Hi, I need to change the Time of all Timehandlers... I have already tried to overwrite it like this:
    $var=$this->_timehandler[$a];
    $var->interval="10000";

    Where $a is incremented by while-loop... but it doesnt work...

     
    • Mirco Bauer
      Mirco Bauer
      2006-04-29

      The correct and clean approach would be to store all timehandler ids in an array and later use that array to change them, like:

      class MyBot
      {
        var $irc;
        var $timehandlerIds;
        ...

        function registerMyTimeHandlers()
        {
          $timerhandlerIds[] = $this->irc->registerTimehandler(....);
          $timerhandlerIds[] = $this->irc->registerTimehandler(....);
        }

        function changeAllTimehandler()
        {
           foreach ($this->timehandlerIds as $id) {
             $handler =& $this->irc->_timehandler[$id];
             $handler->interval = 10000;
           }
        }
      }

      I do something similar in the phpbitch IRC bot for the action handlers, which you can see here:
      http://svn.qnetp.net/trunk/modules/botcmds.php?rev=337&root=%2Fsvn%2Fphpbitch&view=markup