mIRC Home    About    Download    Register    News    Help

Print Thread
#252875 15/05/15 12:14 AM
J
JB_uk
JB_uk
J
Hi all, the following script is concerning the activation of auto timed messages in a channel by the bot. I'm trying to do it so that it can run in multiple channels and the timer name will be different for each channel as shown by the $chan part in the timer name and name of the variables. This script in its current form doesn't seem to spew out any of the text in the file that it is reading from.

It is activated by typing the command followed by a number so then the messages are displayed every so many minutes
i.e. if the user typed !autocom 2 The messages would display every 2 minutes...

Code:
on *:TEXT:!autocom *:#: {
  if ($2 == off) { return }
  var %TimeAuto $2 
  var %FinalTimeAuto $+ $chan = %TimeAuto * 60
  if ($nick == $remove($chan,$chr(35))) {
    msg # /me AutoCom: ON
    .timerNow $+ $chan 72 (%FinalTimeAuto $+ $chan) Linksall #
    return
  }
  else { msg # $nick -> You do not have permission to perform this action. }
}

alias Linksall { 
  var %chan $1
  var %lines $lines(linksall $+ $remove($chan,$chr(35)).txt)
  if (!%counter) || (%counter > %lines) set %counter 1
  var %msg $read(linksall $+ $remove($chan,$chr(35)).txt,%counter)
  msg %chan %msg
  inc %counter
}

Any ideas lads?

Joined: May 2015
Posts: 245
S
Fjord artisan
Offline
Fjord artisan
S
Joined: May 2015
Posts: 245
You dont need unique %var`s for your script, "var %FinalTimeAuto = %TimeAuto * 60" is enough.
In your alias, you dont have $chan - you have only %chan (but using just $1 is shorter, instead of "var %chan = $1").

Joined: Jan 2004
Posts: 1,330
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,330
var %chan = $1 is better practice than assuming $1 will always be the channel; and it's more readable.

Joined: May 2015
Posts: 245
S
Fjord artisan
Offline
Fjord artisan
S
Joined: May 2015
Posts: 245
Var %chan, which wont be a chan name?)

Joined: Jan 2004
Posts: 1,330
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,330
Why wouldn't it be? He's passing # to the alias as $1.

Joined: Feb 2015
Posts: 241
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Feb 2015
Posts: 241
Code:
on *:TEXT:!autocom *:#: {
  if ($2 == off) { unset %counter | msg $chan Timed Messages For $chan Is Now Off }
  set $+(%,FinalTimeAuto,$chan) $calc($2 * 60)
  if ($nick == $remove($chan,$chr(35))) {
    describe $chan AutoCom: ON
    $+(.timerNow,$chan) 72 $($+(%,FinalTimeAuto,$chan),2) Linksall $chan
    return
  }
  else { msg # $nick -> You do not have permission to perform this action. }
}

alias Linksall { 
  var %chan = $remove($1,$chr(35))
  var %lines = $lines(linksall $+ %chan $+ .txt)
  if (!%counter) || (%counter > %lines) { set %counter 1 }
  var %msg = $read(linksall $+ %chan $+ .txt,%counter)
  msg $1 %msg
  inc %counter
}

Hi smile I modified some parts and it worked fine when i tested it.
Try it!!
Enjoy!!!


Link Copied to Clipboard