User Control Panel
Advertisements

HELP US, HELP YOU!

teach for mayabot

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


Joined: 02 Mar 2004
Posts: 14

Reputation: 26.8Reputation: 26.8Reputation: 26.8

PostPosted: Thu Mar 04, 2004 7:41 pm    Post subject: Reply with quote

i have seen a good teach command but not for mayabot. i am learning perl atm so one day ill be able to do my own complicated command. any way i was wandering if any one has a command to teach mayabot replies from within a convo.
e.g !teach hi][hello

thanx
Back to top
Calum
Not Yet a God
Not Yet a God


Joined: 21 Feb 2004
Posts: 373
Location: england
Reputation: 34.7Reputation: 34.7Reputation: 34.7

PostPosted: Thu Mar 04, 2004 7:56 pm    Post subject: Reply with quote

that command wouldent be too hard you would have to get it to open replies and i=one of the texts and print what *lazy* said
Back to top
Andy
Newbie
Newbie


Joined: 02 Mar 2004
Posts: 14

Reputation: 26.8Reputation: 26.8Reputation: 26.8

PostPosted: Thu Mar 04, 2004 8:01 pm    Post subject: Reply with quote

if you could get me started im sure i could finish it off. thanx
Back to top
Cer
Upgraded Agent
Upgraded Agent


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

PostPosted: Thu Mar 04, 2004 8:35 pm    Post subject: Reply with quote

Code:
if ($msg =~ /^\!teach (.*)/i) {<br />   $msg = $1;<br />   my ($left,$right) = split(/\]\[/, $msg, 2);<br /><br />   # Make sure $left is alphanumeric ONLY.<br />   # illegal characters sometimes can screw up the bot. :P<br />   $left =~ s/[^A-Za-z0-9]//ig;<br /><br />   # Add it to reply file.<br />   open (REPLY, ">>./replies.txt");<br />   print REPLY "\n$left][$right";<br />   close (REPLY);<br /><br />   return "Thanks for teaching me that!";<br />}


Hopefully that'll get ya started.

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


Joined: 02 Mar 2004
Posts: 14

Reputation: 26.8Reputation: 26.8Reputation: 26.8

PostPosted: Thu Mar 04, 2004 9:31 pm    Post subject: Reply with quote

thanx for *lazy* help
Back to top
Andy
Newbie
Newbie


Joined: 02 Mar 2004
Posts: 14

Reputation: 26.8Reputation: 26.8Reputation: 26.8

PostPosted: Fri Mar 05, 2004 3:50 pm    Post subject: Reply with quote

im having a little problem on getting it to open the right .txt file. where i want it to save is in another folder called Replies then 3 Low.txt

Quote:
open (REPLY, "D:\MyBot\Replies\3 Low.txt");


i have that and have tried loads of different things but it wont open that file
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Fri Mar 05, 2004 4:16 pm    Post subject: Reply with quote

Code:
<br />open (REPLY, "D:\MyBot\Replies\3 Low.txt") or die "could not open file because: $!";<br />


that will show you why it couldn't open that file. The >,>> and < are important too. < = read, > = write, >> = append (means that it adds to the end of the file when you print to it.)

_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
Andy
Newbie
Newbie


Joined: 02 Mar 2004
Posts: 14

Reputation: 26.8Reputation: 26.8Reputation: 26.8

PostPosted: Sat Mar 06, 2004 9:49 am    Post subject: Reply with quote

Quote:
CODE 

open (REPLY, "D:\MyBot\Replies\3 Low.txt") or die "could not open file because: $!";




that will show you why it couldn't open that file. The >,>> and < are important too. < = read, > = write, >> = append (means that it adds to the end of the file when you print to it.)


i tryed
Quote:
open (REPLY, >>"D:\MyBot\Replies\3 Low.txt")

and
Quote:
open (REPLY, ">>D:\MyBot\Replies\3 Low.txt")

and i cant get it to work Sad
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