mIRC Home    About    Download    Register    News    Help

Print Thread
#259460 02/12/16 12:01 AM
Joined: Nov 2013
Posts: 49
L
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Nov 2013
Posts: 49
This used to work, about 3 years ago. I'm not sure what's broken, and I can't seem to find anything wrong with it (I didn't write it, just modified it to my needs).

If any clever eyes don't mind taking a look, I'd appreciate it. I get the message "/goto: duplicate 'YES1' found (line 279, remote.ini)" and if I change all the redicts to individual names I just end up getting the error "/if: invalid format (line 279, remote.ini)".

Code:
on @*:text:*:#:linkpost $1- 
on @*:action:*:#:linkpost $1- 
on @*:notice:*:#:linkpost $1- 
alias -l linkpost { 
  if ((!%p) && (!$hfind(permit,$nick))) { inc -u4 %p 
    var %purge /^!(links\so(n|ff)|(permit))\b/iS 
    var %domain com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk|de|dk|se|co|be|es|pro|xxx|cat|fi|is|jp|cn|kr|lu|mx|no|ru|us|me
    var %link /(?<=^|\s)((?>\S{3,8}:\/\/|w{3}\56)\S+)|\56( $+ %domain $+ )\b/iS 
    ;; IF THE LINKER IS "VOICED" OR "REGULAR" (VR) && $1- (THE LINK) HAS %link (THE ABOVE VARIABLE) IN IT.
    if ($nick(#,$nick,vr) && $regex($1-,%link) && %Link. [ $+ [ $chan ] ] == off) { 
      $msgbot($chan,$nick you do not have permission to post a link, ask a mod to !permit you )
      msg # /timeout $nick 1
    } 
    elseif (($regex($1-,%purge)) && ($regml(1) = permit) && ($nick isop #) && ($$2 ison #) && ($$2 !isop) && %Link. [ $+ [ $chan ] ] == off) { 
      goto $iif($3 && $3 isnum,YES1,NO1) | :YES1 | hadd -mz permit $2 $3
      $msgbot($chan,You now have $3 seconds to post a link $2!)
      halt | :NO1 | hadd -mz permit $2 10
      $msgbot($chan,You now have 10 seconds to post a link $2!)
    } 
    elseif (($regml(1) = links on) && ($nick isop #)) { 
      goto $iif(%Link. [ $+ [ $chan ] ] == off,YES1,NO1) | :YES1 | set %Link. $+ $chan on
      .msg # Links are now enabled in: $right($chan,-1) $+ .
      halt | :NO1 | .msg # Links are already enabled.
    } 
    elseif (($regml(1) = links off) && ($nick isop #)) { 
      goto $iif(%Link. [ $+ [ $chan ] ] == on,YES2,NO2) | :YES2 | set %Link. $+ $chan off
      .msg # Links are now disabled in: $right($chan,-1) $+ . 
      halt | :NO2 | .msg # Links are already disabled.
      ! 
    } 
  } 
}

For anyone that would rather see it with syntax highlighting

!links on works
!links off works
!links works
!permit does not work

Thanks!

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Hello,

1) You can't have duplicate goto label, eventually you were lucky before that the code was never processed in a way which made this error apparent

2) The if statement error is happening regardless of the goto issue:
let's break the elseif down:
elseif
(($regex($1-,%purge)) &&
($regml(1) = permit) &&
($nick isop #) &&
($$2 ison #) &&
($$2 !isop) &&
%Link. [ $+ [ $chan ] ] == off) {

                                          ^ this ')' is not closing anything, add a '(' before '%Link.'


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2013
Posts: 49
L
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Nov 2013
Posts: 49
I changed the goto labels to individual numbers.

I don't understand the breakdown you just did, when I go into notepad++ and check the brackets, they all close on another and there's no extras.

The one you say doesn't close anything, closes the opening ( infront of --> (($regex($1-,%purge)). And there's no extras.

Edit:

Image of it with highlight syntax highlight syntax
First regex syntax
First regex syntax
Isn't it closed?

Last edited by lindenkron; 02/12/16 04:07 AM.
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
You're right, I wrongly assumed that because of the error, the actual error is that you're not passing a channel name to the isop operator

Quote:
if (nick isop chan) {


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2013
Posts: 49
L
Ameglian cow
OP Offline
Ameglian cow
L
Joined: Nov 2013
Posts: 49
Originally Posted By: Wims
You're right, I wrongly assumed that because of the error, the actual error is that you're not passing a channel name to the isop operator

Quote:
if (nick isop chan) {


Appears ($$2 !isop) was missing a # indeed. ($$2 !isop #) it now works properly. Thanks!


Link Copied to Clipboard