User Control Panel
Advertisements

HELP US, HELP YOU!

Letter Changer

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Ideas
View unanswered posts
Author Message
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Mon Jun 27, 2005 10:40 pm    Post subject: Letter Changer Reply with quote

I remember seeing a site that had you enter a message. Then, you told it to replace the letter * with the letter $ (* and $ are any letter) It then would change your message.
Examples:
Message:
Hello World
Letter to replace:
l
Replace letter with:
x
New Message:
Hexxo Worxd

I thought that this could be turned into an encode/decode command. If you could make either of them, that would be great. It would be even greater if they were for juggernaut.
Back to top
JTW
God Like
God Like


Joined: 07 Mar 2004
Posts: 579
Location: Maidstone
Reputation: 67.1
votes: 4

PostPosted: Tue Jun 28, 2005 1:50 am    Post subject: Reply with quote

Hey
I tried to make this and i found it as easier than i expected.


Quote:
my ($remove,$huh) = split (/ /, $msg,2); # Split $msg into $remove and $huh
my ($replace,$message) = split (/ /, $huh,2); # split $huh into $replace and $message.

$message =~ s/$remove/$replace/ig; # changes $remove with $replace in $message

return "$message";


I am sure there is an easier way to split the messages down than show in the first 2 lines but I could not think of it.
Back to top
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Tue Jun 28, 2005 1:57 am    Post subject: Reply with quote

That looks easy enough, and I understand it. The only part I don't understand is the $huh variable. Could you also give an example on what the user would input to make the following work using the command you gave.

Example:
Command Name: !letterchange
Message: Hello
Letter to remove: l
Replace it with: x
User would input: ?????


And could you take a peek at this code and let me know if it should work. I can't test them right now. I just made some small changes in yours to try and make it even simpler on me.

Code:
my ($message,$remove,$replace) = split (/:/, $msg,3);
$message =~ s/$remove/$replace/ig;
return "$message";


Last edited by Cheater on Tue Jun 28, 2005 12:25 pm; edited 2 times in total
Back to top
JTW
God Like
God Like


Joined: 07 Mar 2004
Posts: 579
Location: Maidstone
Reputation: 67.1
votes: 4

PostPosted: Tue Jun 28, 2005 2:09 am    Post subject: Reply with quote

the huh variable is there beacuse i dont know how to split $msg into 3 parts so i get $remove and $huh. I then split $huh to give me $replace and $message ( i know there must be a better way to do it but i dont know how)

it would be used like this
!replace <letter to remove> <letter to replace> <text>
(assuming you called the command !replace)
Back to top
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Tue Jun 28, 2005 2:14 am    Post subject: Reply with quote

I guess I edited my post as you were replying. I tried changing the code to make it easier. After I posted it, I read your post. I think it was what you were trying to do (split the $msg into 3). I know the split will work.

Code:
my ($message,$remove,$replace) = split (/:/, $msg,3);
$message =~ s/$remove/$replace/ig;
return "$message";


I tested the code above and it worked. Then, I tried taking it a step forward to make it into a basic encryption command. Here is the new code:

Code:
#      .   .             <CKS Juggernaut>
#     .:...::     Command Name // !encode
#    .::   ::.     Description // Encode a message
# ..:;;. ' .;;:..        Usage // !encode [message]
#    .  '''  .     Permissions // Public
#     :;,:,;:         Listener // All Listeners
#     :     :        Copyright // 2004 Chaos AI Technology

sub encode {
   my ($self,$client,$msg,$listener) = @_;
$message =~ s/a/c/ig;
$message =~ s/b/d/ig;
$message =~ s/c/e/ig;
$message =~ s/d/f/ig;
$message =~ s/e/g/ig;
$message =~ s/f/h/ig;
$message =~ s/g/i/ig;
$message =~ s/h/j/ig;
$message =~ s/i/k/ig;
$message =~ s/j/l/ig;
$message =~ s/k/m/ig;
$message =~ s/l/n/ig;
$message =~ s/m/o/ig;
$message =~ s/n/p/ig;
$message =~ s/o/q/ig;
$message =~ s/p/r/ig;
$message =~ s/q/s/ig;
$message =~ s/r/t/ig;
$message =~ s/s/u/ig;
$message =~ s/t/v/ig;
$message =~ s/u/w/ig;
$message =~ s/v/x/ig;
$message =~ s/w/y/ig;
$message =~ s/x/z/ig;
$message =~ s/y/a/ig;
$message =~ s/z/b/ig;
$message =~ s/0/2/ig;
$message =~ s/1/3/ig;
$message =~ s/2/4/ig;
$message =~ s/3/5/ig;
$message =~ s/4/6/ig;
$message =~ s/5/7/ig;
$message =~ s/6/8/ig;
$message =~ s/7/9/ig;
$message =~ s/8/0/ig;
$message =~ s/9/1/ig;
return "$message";
   
}

{
   Category => 'Fun & Games',
   Description => 'Encode a message',
   Usage => '!encode [message]',
   Listener => 'All',
};


But when I try using it, I get this error in the dos window:

Quote:
CKS // PANIC: Bad command form: no reply


What's wrong with the code? (The reason I'm putting it here is because we were already on that topic.)
Back to top
darkmonkey
The Merovingian
The Merovingian


Joined: 18 Apr 2004
Posts: 2557
Location: London, England
Reputation: 39.3Reputation: 39.3Reputation: 39.3Reputation: 39.3
votes: 7

PostPosted: Tue Jun 28, 2005 12:59 pm    Post subject: Reply with quote

um..

$message = "This is a message";
return rot13($message);

That rotates the characters 13 points, and will work for both encoding and decoding.

_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Tue Jun 28, 2005 1:09 pm    Post subject: Reply with quote

So I would use this?:

Code:
#      .   .             <CKS Juggernaut>
#     .:...::     Command Name // !encode
#    .::   ::.     Description // Encode a message
# ..:;;. ' .;;:..        Usage // !encode [message]
#    .  '''  .     Permissions // Public
#     :;,:,;:         Listener // All Listeners
#     :     :        Copyright // 2004 Chaos AI Technology

sub encode {
   my ($self,$client,$msg,$listener) = @_;
$message = "$msg";
return rot13($message);
   
}

{
   Category => 'Fun & Games',
   Description => 'Encode a message',
   Usage => '!encode [message]',
   Listener => 'All',
};


because that gives me the error:

Quote:
Undefined subroutine &main::rot13 called at ./commands/fun_and_games/encode.pl l
ine 12.
Press any key to continue . . .
Back to top
darkmonkey
The Merovingian
The Merovingian


Joined: 18 Apr 2004
Posts: 2557
Location: London, England
Reputation: 39.3Reputation: 39.3Reputation: 39.3Reputation: 39.3
votes: 7

PostPosted: Tue Jun 28, 2005 4:14 pm    Post subject: Reply with quote

I think you have to use the rot13 module, which I *think* is Crypt::Rot13. You can also just do rot13($msg), if you want.

To use a module, put:

use Crypt::Rot13; above your script.

check that it is Crypt::Rot13 first though, as I haven't checked..

_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
dan0211
Not Yet a God
Not Yet a God


Joined: 23 Dec 2003
Posts: 395

Reputation: 37.8Reputation: 37.8Reputation: 37.8Reputation: 37.8

PostPosted: Tue Jun 28, 2005 7:47 pm    Post subject: Reply with quote

Instead of
Code:
$message = "$msg";
return rot13($message);

Why didnt you just do:
Code:
return rot13($msg);
Back to top
Cheater
Senior Member
Senior Member


Joined: 10 Jun 2005
Posts: 236

Reputation: 15.8Reputation: 15.8

PostPosted: Tue Jun 28, 2005 8:23 pm    Post subject: Reply with quote

dan0211 wrote:
Instead of
Code:
$message = "$msg";
return rot13($message);

Why didnt you just do:
Code:
return rot13($msg);

I think that is the code that I changed it to a little later. And about the Crypt::Rot13 it is what you would use. I will test it when I get on my other computer (the one with the bot).
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Ideas All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group