|
|
Joined: Apr 2006
Posts: 43
Ameglian cow
|
OP
Ameglian cow
Joined: Apr 2006
Posts: 43 |
Basicly what im trying to do is this. Every second I want my bot (RenForce) to read this. C:\Westwood\DaveCAOW\RenegadeFDS\Server\ssaow_ $+ $date(m-d-yyyy) $+ .txt It should read the last line on it and relay it back to #RFserv1. I couldnt get it to read the last line. Perhaps some help?
Last edited by Dave4989; 22/09/06 03:39 AM.
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
$lines(textfile) returns all lines in a text file have it read $lines().
//echo -ag $read(yourtextfile.txt, $lines(yourtextfile.txt))
|
|
|
|
Joined: Apr 2006
Posts: 43
Ameglian cow
|
OP
Ameglian cow
Joined: Apr 2006
Posts: 43 |
I would get -
* /echo: insufficient parameters (line 2, script.ini)
- This is the script.. on *:text:*:#: {
echo -ag $read(ssaow_ $+ $date(m-d-yyyy) $+ .txt,$lines(ssaow_ $+ $date(m-d-yyyy) $+ .txt))
}
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
Hrm, works on my end . I created a txt file located in mIRC's directory called: ssaow_9-22-2006.txt In it these 2 lines: this is a test this is another test when ran, in my window get's echoed "this is another test"
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
Joined: Apr 2006
Posts: 43
Ameglian cow
|
OP
Ameglian cow
Joined: Apr 2006
Posts: 43 |
This is the problem... The file isnt suppose to be located in the mIRC directory. Its in
C:\Westwood\DaveCAOW\RenegadeFDS\Server\ <file>
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
A word of warning... if your text file has a number on the first line, it isn't treated as a line of text, but as the number of lines in the file by $read. If that's the case, you need to use a switch in $read for it to work properly... "n" or "t", I believe. I don't have mIRC in front of me to check, but it's listed in the help file -- /help $read
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
Possible reason it wouldn't work for you is it's not finding the file. My example was to show you a way of figuring it out (if the file was just sitting in the mirc directory). You need to add the file path.
var %file = $+(", C:\Westwood\DaveCAOW\RenegadeFDS\Server\ssaow_ $+ $date(m-d-yyyy) $+ .txt,")
echo -ag $read(%file,$lines(%file))
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
Joined: Apr 2006
Posts: 43
Ameglian cow
|
OP
Ameglian cow
Joined: Apr 2006
Posts: 43 |
Thanks it worked... How would I do it so if a word were to be placed?
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
Word placed? You mean if someone like asked to see it? A keyword that if seen would read it back to the channel or something?
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
Joined: Apr 2006
Posts: 43
Ameglian cow
|
OP
Ameglian cow
Joined: Apr 2006
Posts: 43 |
Sorry for the poorly asked question.
I was trying to do it so if any text is added the to file. My bot would read it and msg. Basicly if "hihi" was just placed in the file. My bot would reply "hihi". And so on.
|
|
|
|
Joined: Sep 2003
Posts: 261
Fjord artisan
|
Fjord artisan
Joined: Sep 2003
Posts: 261 |
hrm.
;assume $1- == mirc is a cool chat program
on *:text:*:#: {
var %filename = $+(", C:\Westwood\DaveCAOW\RenegadeFDS\Server\ssaow_ $+ $date(m-d-yyyy) $+ .txt,")
;write to %filename mirc is a cool chat program
write %filename $1-
;read %filename at the beginning of the lines for "mirc"
var %readfile = $read(%filename,s,$1)
;if %readfile found it
if (%readfile) { msg $chan i found %readfile }
;if it didn't find it
if (!%readfile) { msg $chan nope }
}
We don't just write the scripts, we put them to the test! (ScriptBusters)
|
|
|
|
|
|