mIRC Home    About    Download    Register    News    Help

Print Thread
writing 2 lines to a file. #97310 10/09/04 09:01 PM
Joined: Oct 2003
Posts: 143
D
DeathfireD Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Oct 2003
Posts: 143
Ok I been thinking about this for more then a week. I just started coding again so Iím lost as to do this. Right now Iím trying to have it so when someone talks in a chat the script will look in the file Brain.txt for the word or Sentence to see if it exists. If it doesnít it will write the word down in the Brain.txt file.

After it is written down it will wait for a set time lets say 1mins for a response to what that person said. So say someone join my chat they say ďhiĒ then script will write hi in the Brain.txt and wait 1min for someone to say something back like ďyo whatís upĒ then after someone response to the first comment the script will write that down to the Brain.txt file next to the first comment.

Like this: Brain.txt
Hi yo whatís up

This is just the first part.
2nd if someone says something that already exists in the Brain.txt file it will say the word thatís next to it. So say someone join the chat and goes ďhiĒ the script looks in the Brain.txt file for whatever word or sentence is next to it and messages the channel that word or sentence.

IF you havenít noticed Iím trying to make a basic AI bot. If anyone can help please do so. I would be very thankfull.


if (Windows isin %txt.1) { /kick # $nick Windows is a badword tisk tisk tisk. }
Re: writing 2 lines to a file. #97311 10/09/04 09:14 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
on *:text:*:*:{
     if (!$read(brain.txt,nw,$1-*)) { 
           write brain.txt $1- $chr(9) 
           set %ltopic $1-
     }
     else { 
          if (%ltopic != $null) && ($gettok($read(brain.txt,nw,%ltopic $+ *),2,9) == $null) { 
               write $+(-l,$readn) brain.txt $read(brain.txt,n,$readn) $1- 
               unset %ltopic
          }
          elseif ($gettok($read(brain.txt,nw,$1-*),2,9)) { msg $chan $gettok($read(brain.txt,nw,$1-*),2,9) }
     }
}


New username: hixxy
Re: writing 2 lines to a file. #97312 10/09/04 09:24 PM
Joined: Oct 2003
Posts: 143
D
DeathfireD Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Oct 2003
Posts: 143
Tidy thanks but for some reason it dosent write down the 2nd word or sentence in the same line till 2 mins pass lol. it all works just the timer seems weird. Ill fool with it but thanks alot this will help me out so much.


if (Windows isin %txt.1) { /kick # $nick Windows is a badword tisk tisk tisk. }