|
| Author |
Message |
ceceboyken Newbie

Joined: 29 Jun 2005 Posts: 18
 
|
Posted: Sat Jul 16, 2005 4:28 pm Post subject: 2 commands optimized for White Warrior, tested and working |
|
|
i edited these commands for white warrior and wanted to share them with you I DIDN'T CREATE THEM
This one is to change your bots name, put in admin commands directory:
| Code: |
#Made for White Warrior
#Coded by Martin
#Edited by ceceboyken
if($msg =~ /^!botname (.*)/)
{
$wrd = "$1";
$self->set_name("$wrd");
$self->sendmsg("Nick set to $wrd");
}
elsif ($msg =~ /!botname/i) {
$self->sendmsg("(i) Use !botname <name>");
}
|
And this one is to convert text to speech
| Code: |
#Made for White Warrior
#Coded by mattaustin
#Edited by ceceboyken
use LWP::UserAgent;
if ($msg =~ /!speech (.*)$/i) {
$ua = LWP::UserAgent->new;
$text = "$1";
my $req = HTTP::Request->new(POST =>
'http://hegel.research.att.com/tts/cgi-bin/nph-talk');
$req->content("txt=$text&voice=crystal");
my $res = $ua->request($req);
$res->{_content} =~ m/speech\/(.*?wav)/;
$self->sendmsg(":o The spoken
word or phrase:\nhttp://hegel.research.att.com/tts/speech/$1");
}
elsif ($msg =~ /!speech/i) {
$self->sendmsg("(i) Use !speech <word or phrase>");
}
|
Last edited by ceceboyken on Sun Jul 17, 2005 10:13 am; edited 2 times in total |
|
| Back to top |
|
 |
Cheater Senior Member

Joined: 10 Jun 2005 Posts: 236
  
|
Posted: Sat Jul 16, 2005 5:31 pm Post subject: |
|
|
In the first code, you might want to try this
| Code: | if($msg =~ /^!botname (.*)/)
{
$wrd = "$1";
$self->set_name("$wrd");
$self->sendmsg("(i)Name set to $wrd");
}
elsif ($msg =~ /!botname/i) {
$self->sendmsg("(i) Use !botname <name>");
}
|
That way you are sending a reply when the name is set.
And in the second code, you might want to either ask the people hosting the site if they mind you using it in your bot, or even better make a copy of your own on your own site to ensure it is always up and running. But I like the codes. Nice job.
P.S. When I tried to get to the site, I got an error. So I tried going to the main page and got the apache test page. I haven't tested it in a bot, but I'm just letting you know.
P.P.S. You might want to add a line of credit like this at the top
| Code: |
#Edited by: CeceBoyKen
|
|
|
| Back to top |
|
 |
ceceboyken Newbie

Joined: 29 Jun 2005 Posts: 18
 
|
Posted: Sat Jul 16, 2005 6:17 pm Post subject: |
|
|
| Quote: | | P.S. When I tried to get to the site, I got an error. So I tried going to the main page and got the apache test page. I haven't tested it in a bot, but I'm just letting you know. | i got that problem too in the beginning, but it works in the bot
btw, try this:
http://hegel.research.att.com/tts/cgi-bin/nph-talk
| Quote: |
And in the second code, you might want to either ask the people hosting the site if they mind you using it in your bot, or even better make a copy of your own on your own site to ensure it is always up and running.
| the REAL creator of this script has to do that i think, i cannot make a copy of it because it's scripted
| Quote: |
P.P.S. You might want to add a line of credit like this at the top |
yeah ill do that EDIT: done ! | Quote: | | But I like the codes. Nice job. | Thanks  |
|
| Back to top |
|
 |
Cheater Senior Member

Joined: 10 Jun 2005 Posts: 236
  
|
Posted: Sun Jul 17, 2005 1:57 am Post subject: |
|
|
Your link worked...thanks. And one last edit you might want to make. You might want to add a few more comments. With this info:
Original Creator
How to use the script (what command you send to the bot)
A description
But once again, nice job. |
|
| Back to top |
|
 |
ceceboyken Newbie

Joined: 29 Jun 2005 Posts: 18
 
|
Posted: Sun Jul 17, 2005 10:14 am Post subject: |
|
|
fixed  |
|
| Back to top |
|
 |
Cheater Senior Member

Joined: 10 Jun 2005 Posts: 236
  
|
Posted: Sun Jul 17, 2005 12:38 pm Post subject: |
|
|
Ok. You just gave me a gret idea for my bot  |
|
| Back to top |
|
 |
ceceboyken Newbie

Joined: 29 Jun 2005 Posts: 18
 
|
Posted: Sun Jul 17, 2005 4:05 pm Post subject: |
|
|
| Cheater wrote: | Ok. You just gave me a gret idea for my bot  |
tell me  |
|
| Back to top |
|
 |
Addict Not Yet a God

Joined: 21 Jan 2004 Posts: 473
   
|
Posted: Sun Jul 17, 2005 8:27 pm Post subject: Re: 2 commands optimized for White Warrior, tested and worki |
|
|
| ceceboyken wrote: | i edited these commands for white warrior and wanted to share them with you I DIDN'T CREATE THEM
This one is to change your bots name, put in admin commands directory:
| Code: |
#Made for White Warrior
#Coded by Martin
#Edited by ceceboyken
if($msg =~ /^!botname (.*)/)
{
$wrd = "$1";
$self->set_name("$wrd");
$self->sendmsg("Nick set to $wrd");
}
elsif ($msg =~ /!botname/i) {
$self->sendmsg("(i) Use !botname <name>");
}
|
And this one is to convert text to speech
| Code: |
#Made for White Warrior
#Coded by mattaustin
#Edited by ceceboyken
use LWP::UserAgent;
if ($msg =~ /!speech (.*)$/i) {
$ua = LWP::UserAgent->new;
$text = "$1";
my $req = HTTP::Request->new(POST =>
'http://hegel.research.att.com/tts/cgi-bin/nph-talk');
$req->content("txt=$text&voice=crystal");
my $res = $ua->request($req);
$res->{_content} =~ m/speech\/(.*?wav)/;
$self->sendmsg(":o The spoken
word or phrase:\nhttp://hegel.research.att.com/tts/speech/$1");
}
elsif ($msg =~ /!speech/i) {
$self->sendmsg("(i) Use !speech <word or phrase>");
}
|
|
When you have a variable, you dont need to use quotes. Like this:
| Code: |
if($msg =~ /^!botname (.*)$/i) {
my $wrd = $1;
if($wrd > 0){
$self->set_name($wrd);
$self->sendmsg("Nick set to ".$wrd);
}else{
$self->sendmsg("(i) Use !botname <name>");
} |
Also, most people use the new MSN modules.. so this command is out of date. |
|
| Back to top |
|
 |
darkmonkey The Merovingian

Joined: 18 Apr 2004 Posts: 2557 Location: London, England
     votes: 7
|
Posted: Sun Jul 17, 2005 8:57 pm Post subject: |
|
|
Not for the released WhiteWarrior . (Yes, that was a subtle hint that a new one is on it's way). _________________ ~ Josh
[ Need bot hosting on a dedicated server? PM me. ] |
|
| Back to top |
|
 |
|