mIRC Home    About    Download    Register    News    Help

Topic Options
#254153 - 24/07/15 10:03 PM Help with binding commands to channels.
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
So I am trying to learn this. How would I bind channels on something like this script to only activate on that one channel and disable if you wish to. I am trying to make it so that this script will turn on links in only the channel that activated the script and I am also trying to figure out how to make points system be able to be turned off by an on or off command. Here are the two scripts. Nillen helped me with the points system. I also can't get !addreg to work with the link script either. Last but least, how would I create an on and off command for this script.

Code:

on *:text:*:#:{
  if ($nick == $remove(#,$chr(35))) { return }
  if ($nick == nightbot) { return }
  if ($nick == wizebot) { return }
  if ($nick == moobot) { return }
  if !$readini(activity.ini,n,$chan,$nick) {
    msg $chan /me Welcome to the stream $nick $+ ! :)
    /writeini activity.ini $chan $nick $ctime
  }

}





Regards,
Powerade661

Points system

Code:

on !*:JOIN:#:{
  $+(.timerpoints.,#,.,$nick) 0 300 add.pts # $+(#,.,$nick)
  add.pts # $+(#,.,$nick)  
}

on !*:PART:#:$+(.timerpoints.,#,.,$nick) off

alias add.pts { 
  if ($mid($1,2-) ison $1) writeini -n Points.ini $2 Points $calc($readini(Points.ini,$2,Points) + 1)
}

on *:text:!Points:#: msg # $nick has $iif($readini(Points.ini,$+(#,.,$nick),Points),$v1,0) points.

on $*:text:/!Points (add|remove)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <add|remove> <user> [number] | return }
    writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    msg $chan $3 now has $readini(Points.ini,$+(#,.,$3),Points) total points. 
  }
  else msg $chan This command is only available to moderators.
}




Links system

Code:
on *:text:!links *:#: {
  if ($nick isop #) {
    if ($2 == on) {
      if (%links) {
        msg # Link protection is already enabled
        return
      }
      else {
        msg # Link protection enabled
        set %links On
        return
      }
    }
    if ($2 == off) {
      if (%links) {
        msg # Link protection disabled
        unset %links on
        return
      }
      else {
        msg # Link protection is already disabled
        return
      }
    }
    else { msg # ' $+ $2 $+ ' is not a valid function. use '!links on' to enable link protection and '!links off' to disable it again. }
  }
}

on *:text:!permit*:#: {
  if ($nick isop #) {
    if (%links) {
      set -u30 %permit $addtok(%permit,$2,32)
      msg $chan You have 30 seconds to post a link, $2
    }
  }
}
on *:text:!addreg *:#: {
  if ($nick isop #) {
    var %m = $read($chan $+ regulars.txt,ns,$2)
    if (!%m) { .write $chan $+ regulars.txt $2 | msg $chan $2 was successfully to the regulars list. | return }
    else { .msg $chan $2 is already in the regulars list. }
  }
}

on +201:text:*:#: {
  if ($nick isop #) { return }
  if ($istok(%permit,$nick,32)) { return }
  if (%links) {
    if (*www.* iswm $1- || *http://* iswm $1- || *.com* iswm $1- || *.tv* iswm $1- || *.nl* iswm $1- || *.sh* iswm $1- || *.net* iswm $1- || *.me* iswm $1-) {
      .timer3 off | /ruser 201 $nick
      msg # /timeout $nick 86400
      msg # That was your 3rd link. Try again tomorrow, $nick [Link] [24h]
      return
    }
  }
}
on +200:text:*:#: {
  if ($nick isop #) { return }
  if ($istok(%permit,$nick,32)) { return }
  if (%links) {
    if (*www.* iswm $1- || *http://* iswm $1- || *.com* iswm $1- || *.tv* iswm $1- || *.nl* iswm $1- || *.sh* iswm $1- || *.net* iswm $1- || *.me* iswm $1-) {
      .timer2 off | .auser 201 $nick | /timer3 1 3600 .ruser 200 $nick
      msg # /timeout $nick
      msg # No links without permission, $nick $+ ! [Link] [Timeout]
      return
    }
  }
}
on *:text:*:#: {
  if ($nick isop #) { return }
  if ($nick == nightbot) { return }
  if ($nick == moobot) { return }
  if ($nick == wizebot) { return }
  if ($read($chan $+ regulars.txt,nw,$nick)) { return }
  if ($istok(%permit,$nick,32)) { return }
  if (%links) {
    if (*www.* iswm $1- || *http://* iswm $1- || *.com* iswm $1- || *.tv* iswm $1- || *.nl* iswm $1- || *.sh* iswm $1- || *.net* iswm $1- || *.me* iswm $1-) {
      msg $chan /timeout $nick 10
      msg $chan Please ask permission before posting a link, $nick [Link] [Warning]
      .auser 200 $nick | /timer2 1 3600 .ruser $nick
      return
    }
  }
} 	




Edited by powerade661 (24/07/15 10:15 PM)

Top
#254163 - 25/07/15 11:37 AM Re: Help with binding commands to channels. [Re: powerade661]
Sakana Offline
Fjord artisan

Registered: 19/09/14
Posts: 259
You don't need to change much, just add a dynamic component to the %links variable

http://en.wikichip.org/wiki/mirc/variables#Dynamic_Variable_Names

Top
#254171 - 25/07/15 06:56 PM Re: Help with binding commands to channels. [Re: Sakana]
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
Can't seem to figure it out, here is what I have so far...

Code:
on *:text:!links *:#: {
  if ($nick isop #) {
    if ($2 == on) {
      if (%links) {
        msg # Link protection is already enabled
        return
      }
      else {
        msg # Link protection enabled
        set %links $+ $chan On
        return
      }
    }
    if ($2 == off) {
      if (%links) {
        msg # Link protection disabled
        unset %links $+ $chan Off
        return
      }
      else {
        msg # Link protection is already disabled
        return
      }
    }
    else { msg # ' $+ $2 $+ ' is not a valid function. use '!links on' to enable link protection and '!links off' to disable it again. }
  }
}

on *:text:!permit*:#: {
  if ($nick isop #) {
    if (%links) {
      set -u30 %permit $addtok(%permit,$2,32)
      msg $chan You have 30 seconds to post a link, $2
    }
  }
}
on *:text:!addreg *:#: {
  if ($nick isop #) {
    var %m = $read($chan $+ regulars.txt,ns,$2)
    if (!%m) { .write $chan $+ regulars.txt $2 | msg $chan $2 was successfully to the regulars list. | return }
    else { .msg $chan $2 is already in the regulars list. }
  }
}

on +201:text:*:#: {
  if ($nick isop #) { return }
  if ($istok(%permit,$nick,32)) { return }
  if (%links) {
    if (*www.* iswm $1- || *http://* iswm $1- || *.com* iswm $1- || *.tv* iswm $1- || *.nl* iswm $1- || *.sh* iswm $1- || *.net* iswm $1- || *.me* iswm $1-) {
      .timer3 off | /ruser 201 $nick
      msg # /timeout $nick 86400
      msg # That was your 3rd link. Try again tomorrow, $nick [Link] [24h]
      return
    }
  }
}
on +200:text:*:#: {
  if ($nick isop #) { return }
  if ($istok(%permit,$nick,32)) { return }
  if (%links) {
    if (*www.* iswm $1- || *http://* iswm $1- || *.com* iswm $1- || *.tv* iswm $1- || *.nl* iswm $1- || *.sh* iswm $1- || *.net* iswm $1- || *.me* iswm $1-) {
      .timer2 off | .auser 201 $nick | /timer3 1 3600 .ruser 200 $nick
      msg # /timeout $nick
      msg # No links without permission, $nick $+ ! [Link] [Timeout]
      return
    }
  }
}
on *:text:*:#: {
  if (%links) {
    if ($nick isop #) { return }
    if ($nick == nightbot) { return }
    if ($nick == moobot) { return }
    if ($nick == wizebot) { return }
    if ($read($chan $+ regulars.txt,nw,$nick)) { return }
    if ($istok(%permit,$nick,32)) { return }
    if (*www.* iswm $1- || *http://* iswm $1- || *.com* iswm $1- || *.tv* iswm $1- || *.nl* iswm $1- || *.sh* iswm $1- || *.net* iswm $1- || *.me* iswm $1-) {
      msg $chan /timeout $nick 10
      msg $chan Please ask permission before posting a link, $nick [Link] [Warning]
      .auser 200 $nick | /timer2 1 3600 .ruser $nick
      return
    }
  }
} 





Edited by powerade661 (25/07/15 06:57 PM)

Top
#254172 - 25/07/15 08:05 PM Re: Help with binding commands to channels. [Re: powerade661]
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
I also have a question for Westor about his follower script. In the !followed command is it possible to make it search through all the followers of that channel and then report back when they followed? This is what I am referring to.

Code:

 if ($1 == !followed) {
    if ($nick !isop $chan) { .msg $chan ( $+ $nick $+ ): Error, You are NOT an channel operator! | return }
    if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Not enough parameters, try again and enter the nickname correctly! | return }
    var %stc = %stream_chan_ [ $+ [ $chan ] ]
    var %h = ls_followers_ [ $+ [ %stc ] $+ ] _ [ $+ [ $chan ] ]
    if (!$hget(%h)) { .msg $chan ( $+ $nick $+ ): There is NOT any nickname yet on my database! | return }
    if (!$hfind(%h,$2)) { .msg $chan ( $+ $nick $+ ): Error, Cannot find, The $qt( $+ $2 $+ ) nickname is NOT on my database! | return }
    var %fl = $hget(%h,$2)
    var %timeago = $_timeago($calc($ctime - %fl)).all
    .msg $chan ( $+ $nick $+ ): The $qt( $+ $2 $+ ) nickname followed the Twitch Channel on  $+ $date(%fl,ddd ddoo mmm yyyy HH:nn:ss) $+  $iif(%timeago,( $+ $v1 $+ ))
  }



Top
#254178 - 27/07/15 01:48 AM Re: Help with binding commands to channels. [Re: powerade661]
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
Any ideas?

Top
#254249 - 30/07/15 05:43 AM Re: Help with binding commands to channels. [Re: powerade661]
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
Does anyone know how to add on or off commands for only the channel it was activated in? Please help.


Edited by powerade661 (30/07/15 05:44 AM)

Top
#254284 - 31/07/15 10:46 PM Re: Help with binding commands to channels. [Re: powerade661]
Sakana Offline
Fjord artisan

Registered: 19/09/14
Posts: 259
This is an on/off thing for a capslock protection script. You can basically use the same principle that's used here

Code:
on *:TEXT:!caps *:#:{
  if ($nick !isop #) { return }
  if ($2 == on) { 
    set %capsprot. [ $+ [ $chan ] ] 1 
    msg # Caps protection enabled
  }
  else if ($2 == off) { 
    set %capsprot. [ $+ [ $chan ] ] 0 
    msg # Caps protection disabled
  }
}

on *:text:*:#:{
  if ($nick isop #) { halt }
  if ( $len($1-) >= 10 ) && ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 70 ) && ( %capsprot. [ $+ [ $chan ] ] == 1 ) {
    var %capsblock = $rand(1,3)
    if (%capsblock == 1) { msg $chan $nick -> stop typing in caps! [caps] [warning] }
    if (%capsblock == 2) { msg $chan $nick -> Ey! stop yelling! [caps] [warning] }
    if (%capsblock == 3) { msg $chan $nick -> stop typing in BIG LETTERS! [caps] [warning] }
    write capsban.txt $nick
    msg $chan .timeout $nick 120
  }
}

Top
#254287 - 01/08/15 10:43 AM Re: Help with binding commands to channels. [Re: Sakana]
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
What am I doing wrong? I tried to follow the site you gave me as well as the script to add the on and off commands, but now it doesn't seem to work at all.

Code:

on *:TEXT:!welcomemessage *:#:{
  if ($nick !isop #) { return }
  if ($2 == on) { 
    set %welcome. [ $+ [ $chan ] ] 1 
    msg # Welcome messages enabled
  }

  if ($nick == $remove(#,$chr(35))) { return }
  if ($nick == nightbot) { return }
  if ($nick == wizebot) { return }
  if ($nick == moobot) { return }
  if !$readini(activity.ini,n,$chan,$nick) {
    if ( %welcome. [ $+ [ $chan ] ] == 1 ) {
      msg $chan /me Welcome to the stream $nick $+ ! :)
      /writeini activity.ini $chan $nick $ctime
    }

  }  
  else if ($2 == off) { 
    set %welcome. [ $+ [ $chan ] ] 0 
    msg # Welcome messages disabled
  }
}





Edited by powerade661 (01/08/15 10:46 AM)

Top
#254297 - 02/08/15 02:49 AM Re: Help with binding commands to channels. [Re: powerade661]
Joveice Offline
Ameglian cow

Registered: 23/07/15
Posts: 42
Loc: Right behind you
Have you done this? http://forums.mirc.com/ubbthreads.php/topics/254093/
This makes isop work
Originally Posted By: powerade661
What am I doing wrong? I tried to follow the site you gave me as well as the script to add the on and off commands, but now it doesn't seem to work at all.

Code:

on *:TEXT:!welcomemessage *:#:{
  if ($nick !isop #) { return }
  if ($2 == on) { 
    set %welcome. [ $+ [ $chan ] ] 1 
    msg # Welcome messages enabled
  }

  if ($nick == $remove(#,$chr(35))) { return }
  if ($nick == nightbot) { return }
  if ($nick == wizebot) { return }
  if ($nick == moobot) { return }
  if !$readini(activity.ini,n,$chan,$nick) {
    if ( %welcome. [ $+ [ $chan ] ] == 1 ) {
      msg $chan /me Welcome to the stream $nick $+ ! :)
      /writeini activity.ini $chan $nick $ctime
    }

  }  
  else if ($2 == off) { 
    set %welcome. [ $+ [ $chan ] ] 0 
    msg # Welcome messages disabled
  }
}





Edited by Joveice (02/08/15 02:49 AM)

Top
#254298 - 02/08/15 07:22 AM Re: Help with binding commands to channels. [Re: Joveice]
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
The commands work fine, it is just that when the variable is set. I don't think it is detecting that it is on because it does nothing. When I do !welcomemessage on it gives the message but it doesn't welcome people. But when I look in the variables, they are set correctly. Yes I have done that.


Edited by powerade661 (02/08/15 07:24 AM)

Top
#254299 - 02/08/15 09:36 AM Re: Help with binding commands to channels. [Re: powerade661]
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
I figured it out thanks for everyone's help. smile

Top
#254301 - 02/08/15 11:02 AM Re: Help with binding commands to channels. [Re: powerade661]
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
A quick question. Is it possible to timeout someone for typing long paragraphs? If so, how would I go about doing this?

Thanks again,
Powerade661


Edited by powerade661 (02/08/15 11:02 AM)

Top
#254304 - 02/08/15 12:57 PM Re: Help with binding commands to channels. [Re: powerade661]
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
I figured out how to do paragraph protection but I can't get my regulars to work at all. Any help with this would be much appreciated, thanks.

Code:

on *:TEXT:!paragraph on:#: {
  if ($nick isop #) { 
    set %paragraph. [ $+ [ $chan ] ] 1 
    msg $chan Paragraph protection enabled.
  }
}
on *:TEXT:!paragraph off:#: {
  if ($nick isop #) {
    if ( %paragraph. [ $+ [ $chan ] ] == 1 ) {
      set %paragraph. [ $+ [ $chan ] ] 0
      msg $chan Paragraph protection disabled.
    }
  }
}
on *:TEXT:*:#: {
  if ($nick isop #) { return }
  if !$readini(regulars.ini,n,$chan,$$2) { return }
  if ( %paragraph. [ $+ [ $chan ] ] == 1 ) {
    if $len($1-) > 300) {
      msg $chan /timeout $nick
      msg $chan $nick has been timed out for 10 minutes for writing long messages. Please consider following the rules next time $nick $+ !
    }
  }
}
on *:TEXT:!addreg *:#: { 
  var %nick == $$2
  if ($nick isop #) {
    /writeini regulars.ini $chan $$2 $ctime  
    msg $chan $$2 has been added to the regulars list

  }
}




Top