mIRC Homepage
Posted By: vinifera on join question - 27/12/12 05:16 AM
hi, i'm using v6.21
and have a problem

my script has 2 on join events in this order

Code:
on !@*:JOIN:#:{
  if ($level($fulladdress) == 1000) { .mode # +o $nick }
  if ($level($fulladdress) == 10) { .mode # +v $nick }
}

on $me:JOIN:#:{
  if ($chan == #1) { .timerchmode1 1 5 .mode # +rcu }
  if ($chan == #2) { .timerchmode2 1 5 .mode # +rcu }
}

problem is that 2nd on join that supposed set chan modes
doesn't trigger

why?
Posted By: sparta Re: on join question - 27/12/12 05:25 AM
You can not use two like that, place one of them in a new file and it should work. Or put them together.
Code:
on !@*:JOIN:#:{
  if ($level($fulladdress) == 1000) { .mode # +o $nick }
  if ($level($fulladdress) == 10) { .mode # +v $nick }
  if ($nick == $me) {
  if ($chan == #1) { .timerchmode1 1 5 .mode # +rcu }
  if ($chan == #2) { .timerchmode2 1 5 .mode # +rcu }
 }
}
Posted By: vinifera Re: on join question - 27/12/12 05:34 AM
doesn't work (your code) frown
Posted By: sparta Re: on join question - 27/12/12 05:46 AM
Did you change the #1 and #2 to your channel? does the timers start?
Posted By: vinifera Re: on join question - 27/12/12 05:52 AM
yes channels are properly named
timer isn't active (doesn't show) in the list
Posted By: 5618 Re: on join question - 27/12/12 06:03 AM
Remove the ! prefix from the on join event.
Posted By: vinifera Re: on join question - 27/12/12 06:13 AM
no change
Posted By: sparta Re: on join question - 27/12/12 06:24 AM
I was to tired to notice it, but @ tell mirc to only trigger if you are oped, remove that and it will trigger. You cant be oped since it's a on join event and you join, you can add a alternative check. if ($me isop #channel) { }
Posted By: vinifera Re: on join question - 27/12/12 06:32 AM
ah nice
that did the job

thanks
Posted By: Tomao Re: on join question - 27/12/12 06:35 PM
Originally Posted By: sparta
You cant be oped since it's a on join event
You, the client that runs the code, CAN be opped with the join event to indicate that you have @ status. You don't need to place ! and @ together. A single @ affixed to the join event will get the job done to keep the join event from being triggered by $me.
Posted By: 5618 Re: on join question - 27/12/12 06:43 PM
To clarify: that is only because you will never be an operator when you yourself join a channel, only after a (very) short delay.
Posted By: Riamus2 Re: on join question - 27/12/12 10:27 PM
As 5618 mentioned, because part of the on JOIN event includes doing something if you are the nick, you would not want the @ prefix as that would never do the part where you are the nick joining the channel. If you weren't doing something when you join, then the @ would make sense, but this does something to other nicks as well as $me.
Posted By: Tomao Re: on join question - 27/12/12 11:28 PM
Oh yes, I was applying the @ in question to "I wasn't doing something" when a nick joins. Thanks for the further clarification, Riamus2 and 5618.
Posted By: vinifera Re: on join question - 08/01/13 02:27 AM
so let me ask you this

to separate my opping of users on ulist
from this I added
Code:
&& ($me isop #) {

because setting chan modes go without check if I'm op

so its
Code:
on *:JOIN:#:{
  if ($me isop #) {
    if ($level($fulladdress) == 1000) { .mode # +o $nick }
    if ($level($fulladdress) == 10) { .mode # +v $nick }
  }
  if ($nick == $me) && ($me isop #) {
    ;setting the chan modes
  }
}


but didn't work then
then I tried as
Code:
on *:JOIN:#:{
  if ($me isop #) {
    if ($level($fulladdress) == 1000) { .mode # +o $nick }
    if ($level($fulladdress) == 10) { .mode # +v $nick }
    if ($nick == $me) {
    ;setting the chan modes
  }
 }
}


and again nothing worked

so why? :P
Posted By: Riamus2 Re: on join question - 08/01/13 11:12 AM
When you join a channel, you are not an op. So $nick will never be you in an on JOIN at the same time that you are an op and that part will never trigger. It is possible to use a timer, but that's unreliable because you won't know how quickly you'll be an op. If you need something to happen when you join and the become an op, just put the code in an on OP event where $opnick = you.
Posted By: vinifera Re: on join question - 08/01/13 01:36 PM
okay, I tried this then

Code:
on *:OP:#:{
  if ($opnick == $me) {
    if (uc !isincs $chan(#).mode) {
      if ($chan == #chan1) { .mode # +uc }
      if ($chan == #chan2) { .mode # +uc }
    }
  }
}


BUT via debug, I see that even if channel has +uc mode init
and even if I used !isincs (with !), the debug shows
that on deop, and then op script calls chan mode to be set again -_-
Posted By: 5618 Re: on join question - 08/01/13 02:43 PM
Note that if you use "(uc !isincs $chan(#).mode)" then it has to be in there in that exact order.
So +nrtuc will match but +nrutc will not match.
Posted By: vinifera Re: on join question - 08/01/13 03:18 PM
corrected the issue (thanks)
but the calling of mode change (with modes set) still happens :P
Posted By: Tomao Re: on join question - 08/01/13 07:19 PM
Give this a shot:
Code:
on *:op:#:{
  var %c = #chan1 #chan2 #chan3
  var %m = $gettok($chan(#).mode,1,32)
  if ($opnick == $me) && (u !isincs %m) || (c !isincs %m) {
    var %a = 1
    while ($gettok(%c,%a,32)) {
      mode $v1 +uc
      inc %a
    }
  }
}
Posted By: vinifera Re: on join question - 12/01/13 04:37 AM
has the same bug
even if mode is set it sends to server for mode +uc
Posted By: 5618 Re: on join question - 12/01/13 06:30 AM
This would seem more appropriate to me:
Code:
on *:OP:#chan1,#chan2,#chan3:{
  if ($opnick == $me) {
    var %m = $gettok($chan(#).mode,1,32)
    if ((u !isincs %m) || (c !isincs %m)) mode $chan +uc
  }
}

This will of course set +uc even if u is already set, but c not (and vice versa).
© mIRC Discussion Forums