0

Currently it reads the text.txt at random and it displays on a channel

on *:TEXT:!command:#channel:{
  /msg $chan $read(text.txt)

I don't understand how to make it auto execute at x minute intervals, whitout using the !command

I've beginner at this, I want to make it like a /timer but can add read random lines from the text everytime

RevanProdigalKnight
  • 1,316
  • 1
  • 14
  • 23
Alex_TNT
  • 5
  • 1
  • 3

2 Answers2

1

It's been a while since I last worked with mIRC, so I had to look up the documentation on /timer, but you should be able to do something like this:

on *:TEXT:!command:#channel:{
  /timer 0 60 /msg $chan $!read(<textfile>)
}

This will execute /msg $chan $!read(<textfile>) an infinite number of times at 60 second intervals once !command has been entered into a channel.

If you need to cancel the timer for some reason, you would need to name the timer, which can be done by appending a name to the command, such as /timerMESSAGE or /timer1, and then including a command to turn the timer off, such as:

on *:TEXT:!timeroff:#channel:{
  /timer<name> off
}

replacing <name> with the name of your timer.

EDIT: Thanks to Patrickdev for pointing out the difference of $!read() versus $read() for timer commands.

Community
  • 1
  • 1
RevanProdigalKnight
  • 1,316
  • 1
  • 14
  • 23
  • I was somewere close to what you said, but I get this error /msg: insufficient parameters (line 2, remote.ini) – Alex_TNT Jul 21 '14 at 12:47
  • seems like you need for someone else to execute the script, beside you to make it run – Alex_TNT Jul 21 '14 at 13:09
  • @Alex_TNT Yeah, mIRC doesn't capture your own input for scripts. Is `$read()` your own function? – RevanProdigalKnight Jul 21 '14 at 13:11
  • No it's not my own function. I've changed the path to my drive one `$read(D:\Program Files (x86)\mIRC\defaults\scripts\text.txt)` seems to work, but it's repeating the same line – Alex_TNT Jul 21 '14 at 13:18
  • @Alex_TNT Looking at the documentation of `$read`, it looks like you need to specify the `n` switch after the name of the file in order to get it to not try and read it as mIRC Scripting Language code, so your call should be `$read(D:\Program Files (x86)\mIRC\defaults\scripts\text.txt,n)` – RevanProdigalKnight Jul 21 '14 at 13:20
  • 1
    Change `$read` to `$!read` to change when the `$read()` is evaluated. By adding the exclamation mark, it won't read the contents when !command is issued, but when the timer is run (every 60 seconds). – Patrickdev Jul 21 '14 at 13:30
  • 1
    Additionally, if you don't want !command to be typed at all, you'll want to look into events like `on START`, which triggers once every time the client starts. – Patrickdev Jul 21 '14 at 13:31
  • @Patrickdev I've edited my answer to include your comments on `$!read` (with proper crediting to you). Thanks for that, I didn't know about that functionality of mIRC. – RevanProdigalKnight Jul 21 '14 at 13:37
  • @Patrickdev events on start may cause trouble on disconnecting from network if you dont use an on disconnect event – Sirius_Black Jul 26 '14 at 20:04
0

i suggest you to use this if you disconnect from a network for whatever reason

ping timeout,broken pipe,connection reseted by peer,netsplit it wont stop

the most efficient way is using an on join event

on me:*:join:#channel:{
.timerrepeat 0 60 msg $chan $read(text.txt)
}

on me:*:part:#channel:{
.timerrepeat off
}
on *:disconnect:{
.timerrepeat off
}

this script will only triggers when you join on #channel

replace #channel with channel you want

Sirius_Black
  • 471
  • 3
  • 11