mIRC Homepage
Posted By: medoit reading an entire .txt file - 27/06/12 04:02 AM
is there a command to make the bot read an entire text file from top to bottom?
Posted By: Riamus2 Re: reading an entire .txt file - 27/06/12 10:16 AM
Depends what you want to do with it. Some options include /play, $read, $fread, /loadbuf, /filter. Take a look in the help file for each of them and you should have a good idea of what you need for whatever you're doing as well as the syntax to use it.
Posted By: medoit Re: reading an entire .txt file - 27/06/12 10:58 PM
i want it to read a .txt file and relay it to the channel. /play worked great if i manually type it into the box, but when i make a command in remote tab i get "cannot play in this window" error

Code:
on *:TEXT:!howto:#trommoc: { play moccomands.txt }


Posted By: starbucks_mafia Re: reading an entire .txt file - 27/06/12 11:40 PM
Currently you're telling it to /play to whatever window is active at the time. You need to tell it to /play to the channel from which the incoming text came.

Code:
on *:TEXT:!howto:#trommoc: { play # moccomands.txt }
Posted By: Tomao Re: reading an entire .txt file - 28/06/12 04:01 AM
You might want to add a check using $play() to prevent it from being abused, such as text scrolling or flooding:
Code:
on *:TEXT:!howto:#trommoc: { 
  if (!$play(#)) {
    .play # moccomands.txt 
  }
}
This way the code can only be triggered one channel per person at a time until it's finished...so you don't have the client running the code to play the text file over and over due to abuse.
Posted By: medoit Re: reading an entire .txt file - 28/06/12 04:47 AM
now im getting this error
* /play: unable to open 'C:\Documents and Settings\Marc DeWitt\Desktop\mIRC\moccomands.txt' (line 419, remote.ini)
Posted By: Tomao Re: reading an entire .txt file - 28/06/12 04:52 AM
Does the moccomands.txt exist in mIRC directory? That error tells mIRC that it cannot find the text file to play. double check the spelling to make sure you haven't misspelled the file name.
Posted By: sparta Re: reading an entire .txt file - 28/06/12 10:55 AM
Maybe just missing quotas? $qt(path to text here) ?
Posted By: Riamus2 Re: reading an entire .txt file - 28/06/12 09:46 PM
It's not a quotes problem. The error shows that the entire path and filename is being looked at. The file just isn't there.
© mIRC Discussion Forums