User Control Panel
Advertisements

HELP US, HELP YOU!

Maya, regex
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl
View unanswered posts
Author Message
X-Worm
Newbie
Newbie


Joined: 12 May 2005
Posts: 36

Reputation: 35.7Reputation: 35.7Reputation: 35.7Reputation: 35.7

PostPosted: Wed May 18, 2005 2:03 pm    Post subject: Reply with quote

Everytime someone types a question mark, exclamation point or a dot or something Maya screws up...

Uh, anyone got any advices?

Oh and btw the error is in "1 High.txt", where I've got this at the moment:
QUOTE("1 High.txt")
Hi|Hello|Greetings|Yo|Howdy|Lo][Hi...|Hello.|Greetings!|Yo.|Howdy-do.|Lo.
What is up][Nothing special|Nada...|Nuffin' special...
Who are you|Who the (|hell|heck|*rude*) are you|And you are|Who is this][I don't tell you.|Why do you want to know that?|I won't tell you...|You know who...|I'm the one and only, you foo'!
How are you][Fine.|Good.|Operating efficiently. Razz
Goodbye|Bye|Cya|(bye)$|(goodbye)$][Goodbye.|See you later.|Bye.|Cya!
How old are you][That's private.
ASL|A/S/L][Ehe, I dont tell you.|That's private too.

Razz][Huh? Razz
Smile][Very Happy <-- OMG I'm smiling more than you, pwned!
:'(][Huh? What's the reason for being sad?
Very Happy ][That's nice...

aaa|eee|ooo|uuu][Calm down please.|Blimey.|Huh? Very intelligent statement...
.|..|...][Dot|Dot dot|Dot dot dot.

lol|lmao|lmfao|rofl][What's so funny?|LOL @ what?|Now what's so funny?
omg|omfg][What?|Huh?|OMG @ what?
g2g|Ok.

CENSORED(you|off)][That's not very nice to say! Sad|No, do it yourself!|Back off before I FART on you!!!
You (suck|stinks)][So do you! :@|*sniff* :'(
Idiot|Jerk|Looser|Moron][Yes, you REALLY are a moron.|Indeed.|Same goes for you.
CENSORED][Don't use foul laguage!|LOL, Is that all you can say?|Back off before I FART on you!!!


Now that's just some test phrases... :huh:
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: Wed May 18, 2005 4:11 pm    Post subject: Reply with quote

I think it's todo with syntax, or something. IE:

Code:
:'(


Would be:

Code:
:\'\(

_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
X-Worm
Newbie
Newbie


Joined: 12 May 2005
Posts: 36

Reputation: 35.7Reputation: 35.7Reputation: 35.7Reputation: 35.7

PostPosted: Wed May 18, 2005 6:54 pm    Post subject: Reply with quote

Thanks, I'll try that... Very Happy

EDIT: It still crashes if you send a dot to it... Sad
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: Wed May 18, 2005 8:28 pm    Post subject: Reply with quote

Then escape the dot...

Code:
\.

_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Wed May 18, 2005 9:13 pm    Post subject: Reply with quote

A nifty code to automatically escape all symbols is:

Code:
$string =~ s/([^A-Za-z0-9 \_])/\\$1/ig;


So everything that's not a letter, number, space, or underscore will be escaped (things like = and : don't need to be escaped, but it doesn't hurt anyway).

You can put that either where Maya learns replies, so it will write correct syntax to the reply file, or put it where it tries to match replies to escape the trigger part before using the IF.

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
X-Worm
Newbie
Newbie


Joined: 12 May 2005
Posts: 36

Reputation: 35.7Reputation: 35.7Reputation: 35.7Reputation: 35.7

PostPosted: Thu May 19, 2005 5:15 am    Post subject: Reply with quote

QUOTE(Cer @ May 18 2005, 01:13 PM)
A nifty code to automatically escape all symbols is:

Code:
$string =~ s/([^A-Za-z0-9 \_])/\\$1/ig;


So everything that's not a letter, number, space, or underscore will be escaped (things like = and : don't need to be escaped, but it doesn't hurt anyway).

You can put that either where Maya learns replies, so it will write correct syntax to the reply file, or put it where it tries to match replies to escape the trigger part before using the IF.
[right][snapback]48365[/snapback][/right]


Uh, is that in on_im.pl? Surprised

Or...
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: Thu May 19, 2005 12:36 pm    Post subject: Reply with quote

Why not work it out, test it, and try again if you're wrong? People won't just give you the answers...
_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
X-Worm
Newbie
Newbie


Joined: 12 May 2005
Posts: 36

Reputation: 35.7Reputation: 35.7Reputation: 35.7Reputation: 35.7

PostPosted: Thu May 19, 2005 3:35 pm    Post subject: Reply with quote

QUOTE(darkmonkey @ May 19 2005, 04:36 AM)
Why not work it out, test it, and try again if you're wrong? People won't just give you the answers...
[right][snapback]48372[/snapback][/right]


I solved that now...

But now I got another question, if someone says: "Bot-depot" for example, and I haven't added anything that matches to "Bot-depot", is there anyway to make the bot say a random sentence instead?

Such as "???" or "I didn't get that"... ?

Have looked around a bit...
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: Thu May 19, 2005 5:04 pm    Post subject: Reply with quote

I think you look in the 999.txt or something. I haven't looked at the exact name, but it includes "999" and is in the same folder as the other responses.
_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
X-Worm
Newbie
Newbie


Joined: 12 May 2005
Posts: 36

Reputation: 35.7Reputation: 35.7Reputation: 35.7Reputation: 35.7

PostPosted: Thu May 19, 2005 6:15 pm    Post subject: Reply with quote

QUOTE(darkmonkey @ May 19 2005, 09:04 AM)
I think you look in the 999.txt or something. I haven't looked at the exact name, but it includes "999" and is in the same folder as the other responses.
[right][snapback]48375[/snapback][/right]


Uh, the responses are in the "Replies" folder which only contains "1 High.txt" "2 Medium.txt" and "3 Low.txt"...

I'm using version 4.0, btw.
Back to top
X-Worm
Newbie
Newbie


Joined: 12 May 2005
Posts: 36

Reputation: 35.7Reputation: 35.7Reputation: 35.7Reputation: 35.7

PostPosted: Mon May 23, 2005 3:36 pm    Post subject: Reply with quote

Oops, I accidently *bumped* into my topic... *runs*
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: Mon May 23, 2005 4:58 pm    Post subject: Reply with quote

No one replied because no one cares. You'll have to look in the bit where it evalutates the response, then make an "else" statement.
_________________
~ Josh
[ Need bot hosting on a dedicated server? PM me. ]
Back to top
X-Worm
Newbie
Newbie


Joined: 12 May 2005
Posts: 36

Reputation: 35.7Reputation: 35.7Reputation: 35.7Reputation: 35.7

PostPosted: Sun May 29, 2005 1:49 pm    Post subject: Reply with quote

Hum, so here's the message thingy I guess:

Quote:
sub reply {
# This is a really good reply sub, it was written by Eric.
# It took me a while to understand how it works lol...
    my $victim = shift;
    my $msg = shift;
    my $test = ""; 
    my $temp = "";
    my $reply = "";
    if( !defined $Replies )
    {
          &LoadReplies();
    }
    foreach $test (@$Replies)
        {
            $temp = $test->{Regex};
            if ( $msg =~ /$temp/i ) {
                $reply = $test->{Responce};
                my $one = $1 unless !defined($1);   #define the variable so that we can use them in
                my $two = $2 unless !defined($2);   #the responce files
                my $three = $3 unless !defined($3);
                my $four = $4 unless !defined($4);
                my $five = $5 unless !defined($5);
                my $six = $6 unless !defined($6);
                my $seven = $7 unless !defined($7);
                my $eight = $8 unless !defined($Cool;
                my $nine = $9 unless !defined($9);                       

                #print "\n$reply\n";
                while ($reply =~ /\@(.+?) / || $reply =~ /\{\@(.+?)\}/) #process named lists in { } and out
                {
                    $reply =~ s/(\@(.+?)) /JoinEM(0, $ListHash->{$2}) ." "/ige;
                    $reply =~ s/(\{\@(.+?)\})/JoinEM(0, $ListHash->{$2})/ige;
                }
                #print $reply ."\n";
                $reply =~ s/\((.*?\|.*?)\)/pick_one($1)/eg;     #process unnamed lists
               
                my @tosay = split(/\|/,$reply);             #break apart multiple responces seperated by
                $reply = $tosay [ int(rand(scalar(@tosay))) ];      #randomly pick one

                $reply =~ s/\$1/$one/g unless !defined($one);       #insert in the variables
                $reply =~ s/\$2/$two/g unless !defined($two);
                $reply =~ s/\$3/$three/g unless !defined($three);
                $reply =~ s/\$4/$four/g unless !defined($four);
                $reply =~ s/\$5/$five/g unless !defined($five);
                $reply =~ s/\$6/$six/g unless !defined($six);
                $reply =~ s/\$7/$seven/g unless !defined($seven);
                $reply =~ s/\$8/$eight/g unless !defined($eight);
                $reply =~ s/\$9/$nine/g unless !defined($nine);
   
                $reply =~ s/\%sn/$victim/gs;
                $reply =~ s/(?/$1/eeig;
                $msg = "";
                last;                   # we found a match. stop looking

And then the else thing goes here right?


Uhm, that sub seems kind of confusing... I want it to get a random reply in the same way as it does when it finds a matching reply.
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Sun May 29, 2005 7:00 pm    Post subject: Reply with quote

QUOTE(X-Worm @ May 29 2005, 09:49 AM)
Uhm, that sub seems kind of confusing... I want it to get a random reply in the same way as it does when it finds a matching reply.
[right][snapback]48441[/snapback][/right]


I don't get what you're talking about. According to that code, if the reply part of the line has pipes in it ("|"), it will pick a random reply from those.... i.e.

Code:
hello bot][Hey human!|What's up?|Hey!|Hello!|etc|etc|etc

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
X-Worm
Newbie
Newbie


Joined: 12 May 2005
Posts: 36

Reputation: 35.7Reputation: 35.7Reputation: 35.7Reputation: 35.7

PostPosted: Mon May 30, 2005 5:03 am    Post subject: Reply with quote

QUOTE(Cer @ May 29 2005, 11:00 AM)
QUOTE(X-Worm @ May 29 2005, 09:49 AM)
Uhm, that sub seems kind of confusing... I want it to get a random reply in the same way as it does when it finds a matching reply.
[right][snapback]48441[/snapback][/right]


I don't get what you're talking about. According to that code, if the reply part of the line has pipes in it ("|"), it will pick a random reply from those.... i.e.

Code:
hello bot][Hey human!|What's up?|Hey!|Hello!|etc|etc|etc

[right][snapback]48445[/snapback][/right]


Yes, but if I say "London" to it, it's being quite because nothing matched to it, and that's when I want the bot to pick a random phrase from a text file, such as "I didn't understand" for example...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 



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