mIRC Home    About    Download    Register    News    Help

Print Thread
#138506 01/01/06 08:04 PM
Joined: Feb 2005
Posts: 344
B
Fjord artisan
OP Offline
Fjord artisan
B
Joined: Feb 2005
Posts: 344
Hi,

I have this bot that respond on text.
Now I would like it to send me a piece of text from a txt file on command.
For example:
let it read the [help] part in the txt flie on command .help

I have this for respond on text in query:
Code:
 on 1600:text:*:#:{
if ($1 == %c $+ help) {
if ($2 == spelletjes) { 
if ($3 == trivia) play -ttrivia $nick txt\EigenaarHelp.txt 200
else play -tspelletjes $nick txt\EigenaarHelp.txt 200
}
else { /play -twelkom $nick txt\EigenaarHelp.txt 200 }
}
else { /msg $nick Sorry, onbekend commando }
}
 


I know for dcc it starts like this
Code:
 on 1600:text:*:CHAT:{
if ($1 == %c $+ help) {
if ($2 == spelletjes) { 
if ($3 == trivia) 
 


But how do I let the bot send a specific part of text back to me by dcc chat ?
Thanks for helping

Greetzz

#138507 01/01/06 08:15 PM
Joined: Sep 2005
Posts: 116
I
Vogon poet
Offline
Vogon poet
I
Joined: Sep 2005
Posts: 116
try this $read identifier
Code:
$read(filename, [ntswrp], [matchtext], [N])
Returns a single line of text from a file.

This identifier works in conjunction with the /write command.

//echo $read(funny.txt)

Reads a random line from the file funny.txt.

//echo $read(funny.txt, 24)

Reads line 24 from the file funny.txt.

//kick # $1 $read(kicks.txt)

Reads a random kick line from kicks.txt and uses it in the kick command.

//echo $read(info.txt, s, mirc)

Scans the file info.txt for a line beginning with the word mirc and returns the text following the match value.

//echo $read(help.txt, w,  *help*)

Scans the file help.txt for a line matching the wildcard text *help*. The r switch implies a regex match.

If you specify the s, w, or r switches, you can also specify the N value to specify the line you wish to start searching from in the file, eg.:

//echo $read(versions.txt, w, *mirc*, 100)

If the n switch is specified then the line read in will not be evaluated and will be treated as plain text.

If the p switch is specified, command | separators are treated as such instead of as plain text.

If the first line in the file is a number, it must represent the total number of lines in the file. If you specify N = 0, mIRC returns the value of the first line if it's a number.

If the t switch is specified then mIRC will treat the first line in the file as plain text, even if it is a number.


Link Copied to Clipboard