Development > Generic custom modules

Colorize Text

<< < (3/3)

Kyr:
My guess is that you changed it wrong, can you give a screen shot of the output and/or a listing of your code?

~Kyr

Kaitoujeanne:

--- Code: ---<?
/*
 * Colorize
 * Copyright (C) 2009 Screwy (RK1)
 */

$colorize= new colorize($bot);

class colorize Extends BaseActiveModule
{
   function __construct (&$bot)
   {
      parent::__construct(&$bot, get_class($this));

      $this -> register_command('all', 'colorize', 'GUEST');
      $this -> help['description'] = 'Randomly colorizes some text, written by Screwy (Rk1)';
      $this -> help['command']['colorize']="Colorizes the text and prints it out.";
      $this -> help['notes'] = "This module has no settings.";

   }
   
   function command_handler($name, $msg, $origin)
   {
      $this->error->reset(); //Reset the error message so we don't trigger the handler by old error messages.
      return $this -> get_colorize($name, substr($msg, 9));
   }

  function get_colorize($who, $name)
  {
   
      for ($i=0; $i <= strlen($name); $i++){

      $RI=dechex(rand(0,255));
      $GI=dechex(rand(0,255));
      $BI=dechex(rand(0,255));
      $COLOR="#".$RI.$GI.$BI;

    $COLORIZED .= "<font color=\"".$COLOR."\">".substr($name, $i, 1)."</font>";
   
    }
    $this -> bot -> send_gc("($who) " .$COLORIZED);
}
}
?>

--- End code ---

This is a Copy and Paste of the Module. When i type !colorize Test in the gamechat it gives no error or no messages, it just comes back as regular text.

Kaitoujeanne:
Got problem fixed by Khal !

Kyr:
Could you post the solution so that others with the same problem can solve it quicker?

Kaitoujeanne:
This line towards bottom

    $this -> bot -> send_gc("($who) " .$COLORIZED);

I had to change it to send_pgroup since we use it as a Raid bot where you join the channel, not as a Guildchat bot so it wasn't coming through correctly. So only a solution if you're using it as a private chat instead of Guildchat.

Navigation

[0] Message Index

[*] Previous page

Go to full version