User Control Panel
Advertisements

HELP US, HELP YOU!

hey everyone.. i need some help with mayabot

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help
View unanswered posts
Author Message
mul
Newbie
Newbie


Joined: 08 Jul 2006
Posts: 3


PostPosted: Sat Jul 08, 2006 2:21 pm    Post subject: hey everyone.. i need some help with mayabot Reply with quote

Hey i dont know if this is the right forum but i need some help..

this is the example of what i want the bot to do:

if the person says "how are you mayabot?
and the bot answers"im fine thanks, and you?
the person:blablablah(whatever he says)
and the bot automaticly answers "ok blablabla"(specially on that answer that the person said right after the bots question.

sry for my "bad" english.
Thanks.
Mull
Back to top
Cer
Upgraded Agent
Upgraded Agent


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

PostPosted: Sat Jul 08, 2006 3:12 pm    Post subject: Reply with quote

You would wanna store global variables (probably in a hashref) to remember the bot's last message to the user.

Code:
# save the bots last reply
$lastreplies->{$user} = $reply;

...

if ($lastreplies->{$user} eq 'im fine thanks, and you?') {
   $reply = "ok $msg";
}


Or you can use RiveScript and just do this:

Code:
+ how are you*
- im fine thanks, and you?

+ *
% im fine thanks *
- ok <star>

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


Joined: 08 Jul 2006
Posts: 3


PostPosted: Sat Jul 08, 2006 3:34 pm    Post subject: Reply with quote

thaks!
where do i add the first code?
in the pl bot file?
Back to top
Cer
Upgraded Agent
Upgraded Agent


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

PostPosted: Sat Jul 08, 2006 5:04 pm    Post subject: Reply with quote

Well first you'd need to declare the hashref, that would be in the main pl file:

Code:
our $lastreplies = {};


The "our" makes it global to all your subroutines and files you include later.

At the part where your bot's about to send a reply back to the human, put a copy of it into the hashref under the user's username:

Code:
$lastreplies->{$user} = $reply;


Then, where your bot actually gets the replies, you can check the value of $lastreplies->{$user} and so your bot can carry on a conversation based on its previous response.

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


Joined: 08 Jul 2006
Posts: 3


PostPosted: Sun Jul 09, 2006 4:03 pm    Post subject: Reply with quote

hmm i tried to add it to my bot, but it didnt work:(
if anyone could add it for me and post it here, or send it on email(pm for mail adress) that would be very nice.
Back to top
Cer
Upgraded Agent
Upgraded Agent


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

PostPosted: Sun Jul 09, 2006 4:39 pm    Post subject: Reply with quote

I can't give you a simple cut-and-paste example because I don't know how Mayabot works. The variables like $user and $reply may be named differently. If you learn Perl though and not just rely on cut-and-paste solutions, it would be very easy to figure out.
_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help 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