Last updated: Version 2.1 -- 09-July-2012
This script will automatically cycle (part and rejoin) any channel you are in that becomes empty; where you are the last person and do not have ops. This can be useful in regaining control of channels when ops has been lost.
Instructions for installation:
Within mIRC, press ALT+R and click on the 'Remote' tab.
Goto 'File' > 'New' and paste in this script.
Goto 'File' > 'Save As...' and name the script r_cycle.mrc
; r_cycle.mrc * 1999-2012 * Version 2.1 * 09-Jul-2012 * Raccoon/EFnet
; This script has no dependencies. It belongs in the Remotes section.
;###############################################################################
;# This script will automatically cycle (part and rejoin) any channel you are #
;# in that becomes empty; where you are the last person and do not have ops. #
;# This can be useful in regaining control of channels when ops has been lost. #
;###############################################################################
On !*:PART:#: CYCLE_IF_EMPTY $chan $nick
On !*:KICK:#: if ($knick != $me) CYCLE_IF_EMPTY $chan $nick
On !*:QUIT: var %i = 1 | WHILE $comchan($nick,%i) { CYCLE_IF_EMPTY $v1 $nick | inc %i }
ALIAS -l CYCLE_IF_EMPTY {
var %chan = $1, %nick = $2
if $nick(%chan,0) != 2 { return } | ;You are alone.
;if $me isop %chan { return } | ;You are not opped.
if $nick(%chan,$me,@&~!) { return } | ;You are not op/owner/founder.
if r isincs $chan(%chan).mode { return } | ;Channel is unregistered.
if %nick == ChanServ { return } | ;Don't battle with ChanServ
if $($+(%,CYCLED.,$cid,%chan),2) { return } | ;Flood prevention.
;----- customize -----
;if (%chan == #DontCycle) && ($network == Freenode) { return }
;if (%chan != #OnlyCycle) || ($network != EFnet) { return }
;-----
echo 4 -ti %chan * Cycling %chan ...
flash %chan | ;Alert with flashing.
window -g2 %chan | ;Alert with highlighting.
!hop -cn %chan Cycling! | ;Part and rejoin channel.
set -eu10 $+(%,CYCLED.,$cid,%chan) $true | ;Remember we cycled for 10 sec.
}
; End of /NAMES list. You've rejoined the channel.
RAW 366:*: {
var %chan = $2
if $($+(%,CYCLED.,$cid,%chan),2) { return } | ;You recently cycled this chan.
;if $me !isop %chan { return } | ;You are now opped!
if !$nick(%chan,$me,@&~!) { return } | ;You are now op/owner/founder!
;----- customize -----
;mode %chan +ntpsi
;mode %chan +eI $mask($ial($me),3) $mask($ial($me),3)
;topic %chan This channel is mine now.
;invite MyBot %chan
}
; End of script.
; === Change Log ===
;
; v2.1 -- 09-Jul-2012
; * Added 'customize' examples for limiting the script to specific channels.
;
; v2.0 -- 06-Jul-2012
; * Greatly consolidated script and comments. "Too wordy".
; * Changed 'isop' to '$nick($chan,$me,@&~!)' for other greater-than op modes.
; * Fixed buggy syntax with flood prevention.
;
; v1.1 -- 22-Feb-2010
; * Consolidated cycle conditions to alias CYCLE_IF_EMPTY
; * Added conditions to check for presence of ChanServ or mode +r (registered chan)
; * Added $cid to %CYCLED.$chan variable for multi-server suppport.
; * To prevent flooding, a channel wont be cycled more than once in 10 seconds.
; * Changed call from 'hop' command to !hop to bypass old /hop aliases
;
; v1.0 -- 21-Feb-2010
; * First public release of script for mIRC v6.35
; * Rewritten from scratch, based on a similar script written in 1999.
;
; v0.0 -- before 09-Apr-1999
; * My first cycle script (cycle.ini) for mIRC v5.51
; * Included features such as playing back chat log, restore colors,
; * etc., features we take for granted now with the /hop command.
;
; ==================
Bizarre. I just noticed in all the time I've had this script up (and everyone who's commented positively on it), I only have 3 reviews for an average of score of 2.7 of 10. If you're one of the dozens of people who use, like, praised or have joined my channel asking for features to customize it, might I suggest a rating of "10 (Best)"? ^_^ Thanks.
I would never post a script open to the public that didn't educate the user about how it works, line by line, to teach them how to script and to protect them from rogue code. It is my intention to make this a common practice to the point where users demand it or find someone else's script, or better yet, write their own from the knowledge gleaned by cleverly crafted and commented example.
Simple as that - i didn't try to insult anyone here, I just seem to find it funny, that small and not really useful things like this are as overworked as this one. i'd understand C++ library being as commented and versionised as this, but mSL... could be that I'm the douche, but I just don't see the point.
Sorry.
P.S. Thanks for explaining about the "hardly", I'm not originally speaking/writing English, so yes - keeping it in mind.
lol, another script that is hardly overworked / inflated.
although 'hardly' is most commonly used to mean 'barely', 'scarcely', etc. i have to assume you meant to use it in its archaic and almost contradictory form ('forcefully' or 'aggressively') which is the only way your comment could even come close to making sense.
your comment is, of course, rubbish.. but there is one thing that concerns me about it. i'm not concerned that raccoon is likely to take your comment seriously (after all, i believe he's been programming since before i was born), nor am i concerned that anyone else is likely to take it seriously. after all, what can you say about a guy who insults someone for putting time and effort into a quality product? what worries me is the idea that YOU might take your comment seriously. hopefully it's something you'll grow out of.
celjan37: Insert the 3rd and 4th and Nth lines below into the appropriate location.
ALIAS -l SHOULD_WE_CYCLE_YET {
var %chan = $1, %nick = $2
; Channels which should not be cycled.
if (%chan == #superchan) && ($network == EFnet) return
if (%chan == #uberchan) && ($network == DALnet) return
if (%chan == #leetchan) && ($network == Rizon) return
; Check to make sure you're not opped.
if ($me isop %chan) return
cooldude13233: Insert the 3rd and 4th lines below into the appropriate location.
ALIAS -l SHOULD_WE_CYCLE_YET {
var %chan = $1, %nick = $2
; Make sure it's the correct channel.
if (%chan != #awesomechan) || ($network != EFnet) return
; Check to make sure you're not opped.
if ($me isop %chan) return
FordLawnmower, Gummo:
I sort of took your advice about .pnick, but figured a better method than parsing .pnick.
if $nick($chan,$me,%@&!~) { i has ban hammer! }
This is an undocumented feature of $nick() but its been in mIRC since version 3.x at least, and isn't going anywhere. Just never considered using it like this. (I mainly use $nick() for enumerating through the entire nicklist)
I'm on 3 networks that use +q for owner Jethro_. isowner does not work on any of them.
IMO, This operator doesn't work consistently across enough networks to be used in posts here. It's much smarter to just use .pnick and the symbols listed here -->> //echo -a $prefix <<-- ,as isprotect doesn't work on a high enough percentage of networks either.
I'm not just blowing smoke ;/ I did an audit of over a hundred irc networks about a year ago to determine what method would be best to use on my posts.
Additionally, you can check if your network supports +q nick mode by entering on any mirc window to find out when connected:
//echo $nickmode
if there is a q; and if so, you can use the isowner operator. There is also a > $mode(1).ownerand> $mode(1).deownerto return the first user who gets a +q and -q via on owner or rawmode event.
Thanks Gummo. I had heard "isowner doesn't work" from a few people, but hadn't considered user error. I should probably find a few networks that use +q or whatever 'owner' mode and test it. Any suggested networks?
Huh. So why did the first person rate this script 4 stars, and the second person only gave me 1 star? People don't think I wrote every line and comment myself?
Updated: Version 1.1 -- 22-Feb-2010
Re-Updated: Version 1.11
Alright, I'll try working a solution. I have another modification I want to make too, to prevent cycle-wars between two users, or with ChanServ parting after deoping you.
Btw, the On Quit issue is solved by iterating through $comchan($nick,%i) to find each of the channels they were in before quitting. $nick().pnick still works at this point, as the IAL is not updated until after the event ends, unless you use the /updatenl command.
I lmao @BadGuy and #Your_Precious_Channel :DD
I think that adding something like this to the events will solve it:
if (r isincs $chan(#).mode) { return }
I don't think the isowner command is of much use on most networks. I've personally had no luck getting it to work anywhere.
I use .pnick to check for the status symbols like this:
if ($regex($nick($chan,$nick).pnick,/[%@&!~]/)) { scripts to execute here. }
I just change the symbols between the [ ] to match the status symbols I'm checking for.
You can't use .pnick in an On Quit event though, because there is no $chan identifier.
How do you recommend the script behave differently for networks that support a +r flag? Should it just not cycle channels with a +r flag?
On the contrary, I wrote the script to be non-"network specific", by making it as simplistic as possible, but I'm open to suggestions for making it behave more correctly when it encounters unusual standards.
I was also debating the use of 'isowner'; an undocumented if-condition akin to 'isop' but for mode -q on some nets. Though honestly, I don't know what networks use mode -q.
I was just making a valid point raccoon, RFC compliant or not. Most networks now allow you to register channels. While you assume adding that line to be of no use, I feel you have overlooked the fact that many people use mIRC across multiple networks.
If this script is network specific and you don't wish to adapt it so it doesn't cause problems on other networks, you should at least put that in the description.
I spent quite a bit of time on EFnet when I first started learning eggdrops and tcl scripting. I really don't recall a channel mode +r and I don't know of any networks that use it for anything other than registered channel.
The script is based on RFC compliant modes and behaviors. As such, the +r mode is non-standard and can mean different things from network-to-network. You may feel free to modify the script to suit your specific needs.
Assuming that +r means "the channel is registered", I doubt this script would be very useful on that network anyway, since people can use channel services to regain control of an opless channel.