|
| Author |
Message |
Andy Newbie

Joined: 02 Mar 2004 Posts: 14
   
|
Posted: Thu Mar 04, 2004 7:41 pm Post subject: |
|
|
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

Joined: 21 Feb 2004 Posts: 373 Location: england
   
|
Posted: Thu Mar 04, 2004 7:56 pm Post subject: |
|
|
| 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

Joined: 02 Mar 2004 Posts: 14
   
|
Posted: Thu Mar 04, 2004 8:01 pm Post subject: |
|
|
| if you could get me started im sure i could finish it off. thanx |
|
| Back to top |
|
 |
Cer Upgraded Agent

Joined: 03 Feb 2004 Posts: 3776 Location: Michigan
  votes: 4
|
Posted: Thu Mar 04, 2004 8:35 pm Post subject: |
|
|
| 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

Joined: 02 Mar 2004 Posts: 14
   
|
Posted: Thu Mar 04, 2004 9:31 pm Post subject: |
|
|
| thanx for *lazy* help |
|
| Back to top |
|
 |
Andy Newbie

Joined: 02 Mar 2004 Posts: 14
   
|
Posted: Fri Mar 05, 2004 3:50 pm Post subject: |
|
|
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

Joined: 03 May 2006 Posts: 2292 Location: Colorado
     
|
Posted: Fri Mar 05, 2004 4:16 pm Post subject: |
|
|
| 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

Joined: 02 Mar 2004 Posts: 14
   
|
Posted: Sat Mar 06, 2004 9:49 am Post subject: |
|
|
| 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  |
|
| Back to top |
|
 |
|