mIRC Home    About    Download    Register    News    Help

Print Thread
#160060 22/09/06 03:36 AM
Joined: Apr 2006
Posts: 43
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Apr 2006
Posts: 43
Basicly what im trying to do is this.
Every second I want my bot (RenForce) to read this.

Code:
  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.
#160061 22/09/06 03:49 AM
Joined: Sep 2003
Posts: 261
S
Fjord artisan
Offline
Fjord artisan
S
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))

#160062 22/09/06 02:33 PM
Joined: Apr 2006
Posts: 43
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Apr 2006
Posts: 43
I would get
Code:
 -
* /echo: insufficient parameters (line 2, script.ini)
- 


This is the script..

Code:
 on *:text:*:#: {
  echo -ag $read(ssaow_ $+ $date(m-d-yyyy) $+ .txt,$lines(ssaow_ $+ $date(m-d-yyyy) $+ .txt)) 
} 

#160063 22/09/06 03:46 PM
Joined: Sep 2003
Posts: 261
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2003
Posts: 261
Hrm, works on my end frown.

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)
#160064 22/09/06 10:55 PM
Joined: Apr 2006
Posts: 43
D
Ameglian cow
OP Offline
Ameglian cow
D
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>

#160065 22/09/06 11:05 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
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
#160066 22/09/06 11:45 PM
Joined: Sep 2003
Posts: 261
S
Fjord artisan
Offline
Fjord artisan
S
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.
Code:
  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)
#160067 23/09/06 09:37 PM
Joined: Apr 2006
Posts: 43
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Apr 2006
Posts: 43
Thanks it worked... How would I do it so if a word were to be placed?

#160068 24/09/06 01:11 AM
Joined: Sep 2003
Posts: 261
S
Fjord artisan
Offline
Fjord artisan
S
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)
#160069 24/09/06 01:16 AM
Joined: Apr 2006
Posts: 43
D
Ameglian cow
OP Offline
Ameglian cow
D
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.

#160070 24/09/06 01:37 AM
Joined: Sep 2003
Posts: 261
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2003
Posts: 261
hrm.
Code:
;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)

Link Copied to Clipboard