Development > Generic custom modules

Colorize Text

(1/3) > >>

screwy:
Hey,

This is a basic module that will echo text into the org chat colorized. "Useful" for things like "Gratz", "Happy Birthday" etc.

Screwy.


--- 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."\">".mb_substr($name, $i, 1)."</font>";

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

--- End code ---

fowlskins:
for some reason this module crashes my bot and logs me out of the game on using !colorize
is there any other mod similar to this about or can anyone see if its outdated code or contains errors or whatever ?

Kyr:
Been using this for awhile now and having no problems.  I use it in conjunction with the comalias command and have a whole list of shortcuts to colorized messages people can use.
 

--- Code: ---grats is an alias of colorize GRATZ!. [DELETE]
brc is an alias of scripts howtogetkeyedforBRC. [DELETE]
gratz is an alias of colorize GRATZ!. [DELETE]
wb is an alias of colorize Welcome Back!. [DELETE]
lol is an alias of colorize Laughing Out Loud. [DELETE]
woot is an alias of colorize w00t!!!!111111eleven. [DELETE]
hi is an alias of colorize HELLO. [DELETE]
yw is an alias of colorize You're Welcome!. [DELETE]
dead is an alias of colorize I SEE DEAD PEOPLE. [DELETE]
bye is an alias of colorize Good Bye. [DELETE]
ty is an alias of colorize Thank You!!!. [DELETE]
bbl is an alias of colorize Be Back Later!!!. [DELETE]
crafting is an alias of scripts Crafting/crafting. [DELETE]
kyr is an alias of colorize Kyr is a n00b!. [DELETE]
tyree is an alias of colorize Tyree is a nerd!. [DELETE]
attr is an alias of attribute. [DELETE]
nerd is an alias of colorize Nerds are HAWT!!!. [DELETE]
brains is an alias of colorize BRAIIIIINNZZZZ!!!!!!!1111111eleveneleven. [DELETE]
noob is an alias of colorize YOU r a n00b!!!!. [DELETE]
vn is an alias of colorize Very Nice!!!!. [DELETE]
wtg is an alias of colorize Way to go!. [DELETE]
hh is an alias of colorize Happy Holidays!. [DELETE]
mc is an alias of colorize Merry Christmas!. [DELETE]
hq is an alias of colorize Happy Quanza!. [DELETE]
kaige is an alias of colorize It's all Kaige's fault!!!. [DELETE]
x is an alias of colorize Invite to me the raid already you muther fukin' ho Kaige.. [DELETE]
y is an alias of colorize [Guild] [Kaige]: ACCEPT MY DAMN IVVITES. [DELETE]
z is an alias of colorize [Guild] [Kaige]: AM I MISSING ANYONE FOR THE RAID?????????????????. [DELETE]
spitty is an alias of colorize If it isn't Kaige's fault, its Spitty's fault.. [DELETE]
level is an alias of colorize It's a Levelpalooza!!!. [DELETE]
r is an alias of colorize I'm ready already, start this thing!. [DELETE]
hb is an alias of colorize Happy Birthday!!!!!!!!! w0w you are awesome....... [DELETE]
invite is an alias of colorize INVITE MEH DAMMIT!!!. [DELETE]
welcome is an alias of colorize Welcome to Unforgiven (please sign up on the website asap -- http://unforgivenknights.guildlaunch.com/). [DELETE]
nm is an alias of colorize nevermind. [DELETE]

--- End code ---

fowlskins:
thought id give it another go with others in guild using the command
as soon as !colorize is typed by anyone it crashes my bot and consiquently logs me out of game as well when it trys to reconect

Khalem:
The actual error recieved would be useful to determine what the issue is.

Navigation

[0] Message Index

[#] Next page

Go to full version