mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2017
Posts: 2
G
ger0 Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
G
Joined: Aug 2017
Posts: 2
HI,
So i have this code inside remote.ini, but only few of the commands work. Like !ping and !winner only works. But !addcom and below it wont work. It doesnt help if i remove those first 2 commands (ping and winner) same thing happens. I have tried restarting mirc, and re-installing it also. It worked earlier today, but i dont know what i did so this happened.


Code:
on *:TEXT:!ping:#: {
  msg $chan Hi I am the broadcaster.
}

on *:TEXT:!winner:#: {

  set %nick1 $nick($chan,$r(1,$nick($chan,0,r)),r)

  if (%nick1 == $me) { set %nick1 $nick($chan,$rand(1,$nick($chan,0))) }

  msg $chan Randomly selecting a winner........
  timerlawl 1 5 msg $chan The winner is %nick1 $+ ! Congratulations %nick1 :)
}


on *:text:!addcom *:#: {
  if ($nick isop #) {
    var %r = $read(# $+ commands.txt,ns,$2)
    if (%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) is already exist into the database! | return }
    write # $+ commands.txt $2-
    msg $chan /me + Command $2 has been added to the database!
  }
}
on *:text:!delcom *:#: {
  if ($nick isop #) {
    var %r = $read(# $+ commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -dl $+ $readn # $+ commands.txt
    msg $chan /me - Command $2- has been deleted from the database!
  }
}
on *:text:!editcom & *:#: {
  if ($nick isop #) {
    var %r = $read(# $+ commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -l $+ $readn # $+ commands.txt $2-
    msg $chan /me -> Command $2 has been updated!
  }
}
ON *:TEXT:*:#: {
  var %owner $right(#,-1)
  tokenize 32 $strip($1-,burci)
  if ($read(# $+ commands.txt, nts, $1)) {
    var %com = $v1
    var %com = $replace(%com,@user@,$iif($2,$2,?),@nick@,$nick,@target@,$target)
    if (-ul=mod == $gettok(%com,1,32)) && (!$mod($nick)) { msg $chan Sorry $nick $+ , you cannot use this command. | return }
    if (-ul=reg == $gettok(%com,1,32)) && (!$mod($nick)) && (!$regular($nick)) { msg $chan Sorry $nick $+ , you cannot use this command. | return }
    if (-ul=own == $gettok(%com,1,32)) && ($nick != %owner) { msg $chan Sorry $nick $+ , you cannot use this command. | return }
    msg $chan $iif(-ul=mod == $gettok(%com,1,32) || -ul=reg == $gettok(%com,1,32) || -ul=own == $gettok(%com,1,32),$gettok(%com,2-,32),$gettok(%com,1-,32))
  }
}
on $@*:text:*:#:{
  if ($regex($1-,/.+\.(com|co|uk|net|org|gov|tv|edu|fm)/iS)) && ($nick !isop $chan) {
    if (!$istok(%permit,$nick,32)) {
      .timerban 1 1 /msg $chan /timeout $nick 1
      msg $chan Please, $Nick Ask a mod for permission to post links!
    }
  }


  noop $regex($1-,/^!(reg del|reg add|permit)\s(\S+)/iS) { 
    if ($regml(1) == reg add) && ($nick isop $chan) {
      if ($istok(%permit,$regml(2),32)) {
        msg $chan $regml(2) is already on the regular list
      }
      else {
        set %permit $addtok(%permit,$regml(2),32)
        msg $chan $regml(2) You are now always permitted to post links
      }
    }
    if ($regml(1) == permit) && ($nick isop $chan) {
      set %permit $addtok(%permit,$regml(2),32)
      .timerunset 1 30 set %permit $remtok(%permit,$regml(2),1,32)
      msg $chan $regml(2) You have 30 seconds to post a link in here
    }
    if ($regml(1) == reg del) && ($nick isop $chan) {
      if ($istok(%permit,$regml(2),32)) {
        set %permit $remtok(%permit,$regml(2),1,32)
        msg $chan $regml(2) removed from regular list
      }
      else {
        msg $chan $regml(2) is not on regular list
      }
    }
  }
}


Thanks for help smile

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
It's often helpful to add some debug lines to something that's not working to find out why it's not working.

Code:
on *:text:!addcom *:#: {
  echo -s $nopath($script) line $scriptline nick $nick (1-) $1-
  if ($nick isop #) {
    echo -s $nopath($script) line $scriptline
    var %r = $read(# $+ commands.txt,ns,$2)
    echo -s $nopath($script) line $scriptline %r
    if (%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) is already exist into the database! | return }
    write # $+ commands.txt $2-
    msg $chan /me + Command $2 has been added to the database!
  }
}


This can tell you whether it's just not seeing the !addcom, or whether it's not going inside the if() because $nick isn't an op, etc.

Reminder that ON TEXT doesn't respond to yourself, so you need a 2nd person or a 2nd mirc to test that $event.

Joined: Aug 2017
Posts: 2
G
ger0 Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
G
Joined: Aug 2017
Posts: 2
yea isop was the problem
Code:
if ($nick !isop #)
i had to add ! before it

thanks for help smile

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I'm not sure you actually want to fix it that way. By using !isop that means that only non-ops can waltz into your channel and add commands. But I'm not sure why a twitch server doesn't recognize ops as ops. Try something like pasting this command into the editbox of that channel:

//var %i $nick($chan,0,a,r) | while (%i) { echo -a %i $nick($chan,%i,a,r) | dec %i }

This should list every nick that is not a 'regular' nick, having status of voice-or-higher. If this lists the people you want access to the script, you can use: if ($nick($chan,$nick,a,r) )


Link Copied to Clipboard