-1

I am writing an mIRC script for a bot account to read a random line of text from a text file when a user keys in !read. As of now, when any user types !read, absolutely nothing happens. I have other commands set to work on TEXT commands, but this one seems to be the most puzzling, as I'm referencing a document rather than putting everything into the script itself.

on *:TEXT:!text:#: {
  $read(C:\Program Files (x86)\mIRC\8Ball.txt,n)
}

My file is titled 8Ball.txt. What could be going wrong here?

Eli
  • 23
  • 5
  • First, your trigger is `!text`... So nothing really happens when users type `!read`. Second, you just read the line, but do nothing with it, try adding `//echo -a` in front of your read. – Denny Sep 14 '16 at 18:34
  • I've replaced !text with !read...that was embarassingly simple. Adding the echo didn't seem to make a difference though. on *:TEXT:!read:#: { //echo -a $read("8Ball.txt",n) } – Eli Sep 14 '16 at 19:11
  • I receive an error: * /echo: insufficient parameters (line 2, Read) When the line is | /echo -a $read(C:\Program Files (x86)\mIRC\8Ball.txt,n) – Eli Sep 14 '16 at 19:26
  • Got it. echo -a $read(C:\Users\Christopher\Desktop\8Ball.txt,n) Changing the directory ended up doing it...it wasn't liking the location for some reason...I either blame me putting a / in front of echo, or I blame the space in Program Files (x86) Denny you're fantastic. – Eli Sep 14 '16 at 19:36
  • Cool, maybe mIRC did not have permission to read the file so it failed – Denny Sep 14 '16 at 19:38

2 Answers2

0

Got it.

echo -a $read(C:\Users\Christopher\Desktop\8Ball.txt,n)

Changing the directory ended up doing it...it wasn't liking the location for some reason...I either blame me putting a / in front of echo, or I blame the space in Program Files (x86)

Eli
  • 23
  • 5
0

Your best move is to use the relative mIRC dir identifier $mircdir combing it with $qt which adds enclosing quotes.

$qt($+($mircdir,8Ball.txt))

Output:

"C:\Program Files (x86)\mIRC\8Ball.txt"

This way, you won't need to wonder why the script break when you changed the mIRC directory a year after.

Orel Eraki
  • 11,940
  • 3
  • 28
  • 36