Hawkee, why is it that code posted in PM being displayed vertically now instead of horizontally as before? This makes it illegible, especially when you copy and paste it directly into mIRC remote, it generates blank hard spaces. It's troublesome too to have to reconstruct them in order.
Is this an intentional change or bug when you've updated and revamped the website to begin with?
Well, for a three-line randomization, this snippet doesn't require a text file to begin with. A
$gettok( ,$r(1,3) , 32 )
should get the job done right. :P
Or:
var %var = $r(1,3)
if (%var == 1) { do this }
elseif (%var == 2) { do that }
else { do another }
But then again, it's considered quit a bit of effort to jot down or copy / paste everything on the body of a text file to be randomized utilizing
$read()
SupahNL, I don't suppose the author of this snippet is "alive" these days...probably gone for good. He was last seen active 7 years ago.
Anyway, here is the modification I made according to your request:
alias setallowed {
var %file = file.txt
if (!$read(%file,nw,$nick)) {
write %file $nick
}
else echo 4 -at The nickname already exists!
}
on @*:join:#:{
if ($read(file.txt,nw,$nick)) {
msg $nick Welcome to # $+ !
halt
}
inc $+(%,wk,$network,#,$site)
if ($($+(%,wk,$network,#,$site),2) > 3) {
ban -k # $nick 2
unset $+(%,wk,$network,#,$site)
}
elseif ($($+(%,wk,$network,#,$site),2) == 3) {
kick # $nick You're not permitted on this channel. $&
This is your last warning!
}
elseif ($($+(%,wk,$network,#,$site),2) == 2) {
kick # $nick You're not permitted on this channel.
}
else {
kick # $nick You're not permitted on this channel.
}
}
It's the same command as the original snippet here, enter /setallowed . Now, make sure you change "file.txt" in the code to the one of your choice. Place all the allowed nicknames in the chosen text file one after another vertically.
Indeed you can shorten your regex using the pipe to separate each match:
if ($regex(%v,/<(length)>([^>]+)<\/length>/)) {
set %v. $+ $left($regml(1),2) $hf($regml(2))
}
if ($regex(%v,/<info name='(artist|album|title|bitrate|type|sample rate)'>([^>]+)<\/info>/i)) {
set %v. $+ $left($regml(1),2) $hf($regml(2))
}
Or there's another way that you can take advantage of the /ialmark command and $ial().mark identifier to work side by side with the hash table:
on !*:join:#: check $nick
on *:exit: hsave nc nc.hsh
on *:start:{
if (!$hget(nc)) hmake nc 1000
if ($isfile(nc.hsh)) hload nc nc.hsh
}
on *:nick:{
var %nc = $addtok($ial($newnick).mark,$newnick,32)
.ialmark $newnick %nc | hadd -m nc $wildsite %nc
}
alias check {
if ($hget(nc,$address($1,2))) {
echo -s * $1's nick(s) : $replace($v1,$chr(32),$+($chr(44),$chr(32)))
}
}
mIRC's IAL will always return the rightful nicknames, whether it's new or old.
The on start event does nothing if one doesn't restart his or her mIRC but copy and paste the snippet into their remote directly. Without the -m switch utilized, they're surely to get an error of "hash table not found" if that happens.
I still don't see the point of using a timer to save a hash table periodically. Again, mIRC adds or updates the item and data when triggered by the nick event when change takes place and then overwrites the old info. If one gets disconnected, quit or parted, the hash table is still there, not lost. The only time hash table is gone with the wind is when mIRC itself is closed completely.
Once again, the noticeable difference between $site and $wildsite is that, $wildsite adds !@ while $site doesn't. I'm not sure what $wildsite has to with being able to see the network easily or not. In your example, you use the $network identifier in conjunction with the $wildsite, the network name itself has to present anyway. According to the help file:
$site: Returns the portion of $address after the @ for the user associated with an event in the form user@host.> $wildsite: Returns the address of the user who triggered an event in the form !@host.If you have a modern PC running with latest operating systems today, be that as XP, vista or windows 7, aka the NT system, they all come with ample amounts of RAM...compared to Windows 95/98/Me, which cannot digest too much RAM, say, more than 512 MB. That will have a negative effect on the running of a hash table indeed.
The point is, a modern system that runs mIRC does not have to worry about limitation or "slow to a crawl" or "grind to a halt" concern anymore. What a hash table runs is based on your computer, not mIRC. Of course, slow internet connection is another story.
You don't really need the on start event to create a hash table to begin with. Get rid of it in favor of the -m switch being used.
The timer suggestion is a waste of resource. A hash table won't get lost so long as you don't close mIRC, let alone the trigger upon a nick change in this snippet. The essential one you'll need is the exit event.
There's no difference between $site and $wildsite. They are releatively the same; one is shorter and the other longer.
Hash table virtually has no size limit according to the RAM of your computer, which is what mIRC's hash table function adapts to ultimately. The more memory you have, the better for a hash table to work fast and effectively.
You should make it to have the ability to input the password, rather than have it hard coded in the snippet by itself:
alias id {
noop $$input(Put Your Password Here:,p,Nickname Identify)
ns identify $!
}
this way it's easier and convenient for people who are interested in using your snippet.
If this is for personal use only, you can put the /ns identify cmd directly inside mIRC's perform box without using an alias. To read more, enter: /help /perform