Archive > AO 0.6.x Custom/Unofficial modules

Cron module

(1/5) > >>

Jiheld:
Hi,
I used the Cron module to send a msg in the guildchat every 20 mins.
But the text is in Yellow.
Is there a way to make this another color?


--- Quote ---<?php
/*
* cron.php - Module template.
* Cron module - <module description>
* <Copyright notice for your module>
*
* BeBot - An Anarchy Online & Age of Conan Chat Automaton
* Copyright (C) 2004 Jonas Jax
* Copyright (C) 2005-2007 Thomas Juberg Stensås, ShadowRealm Creations and the BeBot development team.
*
* Developed by:
* - Alreadythere (RK2)
* - Blondengy (RK1)
* - Blueeagl3 (RK1)
* - Glarawyn (RK1)
* - Khalem (RK1)
* - Naturalistic (RK1)
* - Temar (RK1)
*
* See Credits file for all aknowledgements.
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; version 2 of the License only.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
*  USA
*
* File last changed at $LastChangedDate: 2008-11-30 23:09:06 +0100 (Sun, 30 Nov 2008) $
* Revision: $Id: _ExampleModule.php 1833 2008-11-30 22:09:06Z alreadythere $
*/

/*
Add a "_" at the beginning of the file (_ClassName.php) if you do not want it to be loaded.
*/

$thisClass = new cron($bot);

/*
The Class itself...
*/
class cron extends BaseActiveModule
{

   function __construct (&$bot)
   {
      //Initialize the base module
      parent::__construct(&$bot, get_class($this));


      $this->register_event('cron', '20min');

   
   }


   /*
   Unified message handler
   $source: The originating player
   $msg: The actual message, including command prefix and all
   $type: The channel the message arrived from. This can be either "tell", "pgmsg" or "gc"
   */
   function command_handler($source, $msg, $origin)
   {
      //ALWAYS reset the error handler before parsing the commands to prevent stale errors from giving false reports
      $this->error->reset();
      
      //The default is to split the command to com, sub and args. If you want to split it some other way change the pattern for it
      //parse_com() returns an array where the pattern is the keys and the values are split out from $msg
      $com = $this->parse_com($msg, array('com', 'sub', 'args'));
      
      $command = $vars[0];

      switch($com['com'])
      {
         case 'command1':
            return($this -> somefunction($name, $com));
            break;
         case 'command2':
            return($this -> someotherfunction($name, $com));
         default:
            // Just a safety net to allow you to catch errors where a module has registered  a command, but fails to actually do anything about it
            $this -> error -> set("Broken plugin, recieved unhandled command: $command");
            return($this->error->message());
      }
   }
   
   /*
   This gets called on cron  if you previously registered the event 'cron, interval'
   $interval is the string name for the time delay between two cron jobs.
   */
   function cron($interval)
   {
$this -> bot -> send_gc( "New Raid, Join for the Epix!!! Sign up on the raid calendar on our site!!! Dont sit there!!! SIGN!!!");
   }
   
   
}
?>
--- End quote ---

playing AoC btw.

Thnx.

Jih.

Alreadythere:
Simply add a color tag around the output.

Like ##forestgreen##Output##end##, will give Output colored in forest green. Check !color for a list of all existing color tags.

Jiheld:
cool, got it.

Can you ad highlights with this also?

Alreadythere:
Sure, you can put as many tags inside as you want.

At least as long as you close the last one before starting the new one, AO got a limit for encapsulating font tags. Though around 5 definitly work.

Jiheld:
cool,

Hows the line going to look like?
got this now


--- Quote ---$this -> bot -> send_gc( "##highlight## ##purple## New Raid, Join for the Epix!!! Sign up on the raid calendar on our site!!! Dont sit there!!! SIGN!!!##end##");
--- End quote ---

But the highlight isnt working, did i mis something?

thnx alot

Jih.

Navigation

[0] Message Index

[#] Next page

Go to full version