Booya
collapse collapse

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Search


* Board Stats

  • stats Total Members: 1074
  • stats Total Posts: 18300
  • stats Total Topics: 2487
  • stats Total Categories: 7
  • stats Total Boards: 31
  • stats Most Online: 500

Author Topic: Colorize Text  (Read 8819 times)

0 Members and 1 Guest are viewing this topic.

Offline screwy

  • BeBot Rookie
  • *
  • Posts: 19
  • Karma: +0/-0
Colorize Text
« 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.

Code: [Select]
<?
/*
 * 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);
}
}
?>

Offline fowlskins

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: Colorize Text
« Reply #1 on: March 05, 2010, 09:17:41 pm »
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 ?

Offline Kyr

  • BeBot Apprentice
  • ***
  • Posts: 177
  • Karma: +0/-0
Re: Colorize Text
« Reply #2 on: March 06, 2010, 01:43:00 am »
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: [Select]
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]

Offline fowlskins

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: Colorize Text
« Reply #3 on: March 07, 2010, 08:34:17 pm »
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

Offline Khalem

  • BeBot Founder
  • Administrator
  • ********
  • Posts: 1169
  • Karma: +0/-0
    • http://www.ancarim.com
Re: Colorize Text
« Reply #4 on: March 07, 2010, 10:59:42 pm »
The actual error recieved would be useful to determine what the issue is.
BeBot Founder and Fixer Kingpin

Offline fowlskins

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: Colorize Text
« Reply #5 on: March 08, 2010, 05:25:45 pm »
yeah that probaly would help wouldnt it  :D

ill reinstall it and see what the error message actualy is

Offline fowlskins

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: Colorize Text
« Reply #6 on: March 08, 2010, 08:06:19 pm »
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

Offline Kyr

  • BeBot Apprentice
  • ***
  • Posts: 177
  • Karma: +0/-0
Re: Colorize Text
« Reply #7 on: March 09, 2010, 12:13:35 am »
Change line 38 to:
Code: [Select]
$COLORIZED .= "<font color=\"".$COLOR."\">".substr($name, $i, 1)."</font>";
and change line 25 to:
Code: [Select]
return $this -> get_colorize($name, substr($msg, 9));

Offline fowlskins

  • BeBot User
  • **
  • Posts: 33
  • Karma: +0/-0
Re: Colorize Text
« Reply #8 on: March 09, 2010, 07:07:20 pm »
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

Offline Kaitoujeanne

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Colorize Text
« Reply #9 on: April 18, 2010, 10:31:40 pm »
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.

Offline Kyr

  • BeBot Apprentice
  • ***
  • Posts: 177
  • Karma: +0/-0
Re: Colorize Text
« Reply #10 on: April 19, 2010, 12:56:06 am »
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

Offline Kaitoujeanne

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Colorize Text
« Reply #11 on: April 19, 2010, 02:45:10 am »
Code: [Select]
<?
/*
 * 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.
« Last Edit: April 19, 2010, 02:50:43 am by Kaitoujeanne »

Offline Kaitoujeanne

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Colorize Text
« Reply #12 on: April 22, 2010, 01:35:00 am »
Got problem fixed by Khal !

Offline Kyr

  • BeBot Apprentice
  • ***
  • Posts: 177
  • Karma: +0/-0
Re: Colorize Text
« Reply #13 on: April 22, 2010, 02:03:13 am »
Could you post the solution so that others with the same problem can solve it quicker?

Offline Kaitoujeanne

  • BeBot Rookie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Colorize Text
« Reply #14 on: April 22, 2010, 06:33:59 am »
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.
« Last Edit: April 22, 2010, 06:35:58 am by Kaitoujeanne »

 

* Recent Posts

0.7.0 updates by bitnykk
[May 17, 2020, 04:22:04 pm]


Stats module by bitnykk
[April 16, 2020, 04:45:43 pm]


OnlineOrg by Hell
[February 28, 2020, 11:21:55 pm]


AO Bots - discord server by Kjellis1234
[January 23, 2020, 04:17:04 pm]


Offline AA training timer module by Kjellis1234
[August 29, 2019, 11:12:14 pm]

* Who's Online

  • Dot Guests: 127
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Forum Staff

admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2020, SimplePortal