BeBot - An Anarchy Online and Age Of Conan chat automaton
Development => Generic custom modules => Topic started by: screwy on July 23, 2009, 06:33:32 pm
-
Hey,
This is a basic module that will echo text into the org chat colorized. "Useful" for things like "Gratz", "Happy Birthday" etc.
Screwy.
<?
/*
* 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);
}
}
?>
-
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 ?
-
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.
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]
-
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
-
The actual error recieved would be useful to determine what the issue is.
-
yeah that probaly would help wouldnt it :D
ill reinstall it and see what the error message actualy is
-
Fatal error: Call to undefined function mb_substr() in C:\bebot\custom\modules\c
olorize.php on line 38
ok thats the error message i get
-
Change line 38 to:
$COLORIZED .= "<font color=\"".$COLOR."\">".substr($name, $i, 1)."</font>";
and change line 25 to:
return $this -> get_colorize($name, substr($msg, 9));
-
thankyou kyr thats got it working ;D
does it always randomly color each letter of the word ??
in my head it would randomly do a whole sentance one color
but thats just me being picky its not a big deal
cheers for your help
-
I copied the code into new a php document and called it colorize.php and added into the \custom\modules and restarted the bot and it shows it loaded and it does show up in the !help and !commands list but when I type !colorize test into the game-chat it doesn't color it or do anything, it just says exactly what I type.
Am i missing something? I did change lines 25 + 38 so it doesn't crash the bot since it did at first but now it doesn't want to do anything.
-
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
-
<?
/*
* 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);
}
}
?>
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.
-
Got problem fixed by Khal !
-
Could you post the solution so that others with the same problem can solve it quicker?
-
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.