mIRC Home    About    Download    Register    News    Help

Print Thread
#115271 24/03/05 02:42 PM
Joined: Mar 2005
Posts: 2
X
xiphrex Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
X
Joined: Mar 2005
Posts: 2
Hello, I am some what of a beginner to this mirc scripting and I would like some help from you kind members on the following.

I would like to voice people that join a channel automatically but the problem is that I dont want to voice people who will then be opped the the channel bot (L in this case, on quakenet), and because my script voices them immediately on join and L does the same, it comes up with L oping them and then me voicing them after. I would like the script to wait a few seconds to give time for L to op, then detect if the person has indeed been opped or voiced already, then not voice them if that is the case. If it is not I would like it to voice them.

Below is the code I wrote and it doesnt seem to work:

Code:
on @*:Join:#: { timer 1 3 if ($nick isop #) || ($nick isvoice #) { //echo no voice needed for $nick }
else { mode $chan +v $nick }
 }  


Any ideas? Thanks in advance.

#115272 24/03/05 06:03 PM
Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
Code:
on @*:Join:#: {
  timer 1 3 if ( $nick !isop # ) || ( $nick !isvoice # ) mode $chan +v $nick
}   


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
#115273 24/03/05 06:12 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
The else is not included in the timer: it only looks at what's behind it on the same line, not on next lines.

Best way to prevent this and other problems: make an extra alias that you call for that nick

on @*:Join:#:.timer 1 3 dvoice $nick $chan
alias dvoice {
if ($1 isop $$2) || ($1 isvoice $2) echo $2 no voice needed for $1
else mode $1 +v $2
}

You could also check out the Control tab in address book (Alt-B) and tick random delay op/voice and add Address *!*@* and the required channels AS LAST ITEM in the voice list (also tick Enabled). The downside is that this will still voice them if they're ops (never tested actually) and that uses already in the list are not affected by that last entry...


Another way is a named timer that starts when someone joins, and then after like 30 seconds checks all nicks in the channel and ops/voices those who need it. This has the advantage that you can voice nicks in groups of 3 after join floods or network reconnects, but requires some more scripting.

#115274 24/03/05 07:19 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Two things, first the else must be on the same line as the timer, u do this by adding a | before the else if (a=b) { match } | else { no match }
The second, you have to ensure your code is evaluated at the time the timer goes off not at the time its created. As said to you already, you can use an alias and for anything bigger that this i would advise it.
But if you were sure of what you were doing you can place it into the timer, just you must ensure that the { } | are dealt with at the correct time currently they would all be dealt with when making the timer so u have to use $({,) $(},) $(|,) which says Dont evaluate these there just bits of text right now.

on @*:Join:#: { timer 1 3 if ( $nick isop # ) || ( $nick isvoice # ) $({,) echo # no voice needed for $nick $(},) $(|,) else $({,) mode $chan +v $nick $(},) }

* note also the spaces around then $nick and the #, this well allow the parser to see them during the making of the timer and evaluate them into there contents
If you dont put the spaces in the timer would have ($nick in it and in the timer $nick has no value.

#115275 24/03/05 07:54 PM
Joined: Mar 2005
Posts: 2
X
xiphrex Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
X
Joined: Mar 2005
Posts: 2
Thank you all for helping me out, brilliant community you got here, cheers laugh

#115276 24/03/05 08:37 PM
Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
Hey Davec, one question on your post. What does the comma do in "$( )" ?


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
#115277 25/03/05 12:18 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
$(x,) is equivilant to $(x,0) just means evaluate x zero times

$( is the same as $eval(

In this case it just stops mirc seeing it as part of the script and sees it instead as raw text
i could use in replace of { | } $chr(123) $chr(124) $chr(125) but it makes the code harder to read.

As a side note here is an example of what the evaluating does
Code:
alias example {
  var %a = hello
  var %b = % $+ a
  echo %a = %a
  echo %b = %b
  echo $(%b,) = $(%b,)
  echo $(%b,0) = $(%b,0)
  echo $(%b,1) = $(%b,1)
  echo $(%b,2) = $(%b,2)
}

/example
%a = hello
%b = %a
$(%b,) = %b
$(%b,0) = %b
$(%b,1) = %a
$(%b,2) = hello

see $(%b,) and $(%b,0) dont evaluate %b to get its contents
$(%b,1) does, this is the same as just going %b
$(%b,2) does it twice first to get the contents of %b whcih is %a then again and gets the contenst of %a being Hello

#115278 25/03/05 12:56 AM
Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
Thanks for the explanation. I just got intrigued with the eval identifier without putting a number. (Overlooked the help file :tongue: )


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!

Link Copied to Clipboard