I'd recommend changing the if condition from $me isin $1- to $istok($1-,$me,32), otherwise, the script could trigger on false positives... example: if your nick is "Mark", somebody else's nick is "Mark12345", and someone ("John") slaps Mark12345, you'll end up dodging a slap that wasn't aimed at you and subsequently punching John in the face for no reason.
You could also use regex for better matching , but I'd have to check which characters aren't allowed in nicks first.
Hawkee, quick suggestion. Could you add a button to expand or collapse the main header? It can be a bit distracting when trying to read something on the site.
Nah, all that would really happen in these cases by using $2- is that the remaining tokens would work their way into the notices and kick message. "Aha2y Drarqua 5, Aha2y Drarqua 4, Aha2y Drarqua 3, Aha2y Drarqua 2 ,Aha2y Drarqua 1". Probably not what you'd want, and of course $2 is better, but $2- shouldn't prevent the script from working.
Meta inconspicuously points at his tags and code description. (KilllerX)
Btw, I have made some improvements over the last couple of days, so expect an update soon. Hopefully some of the major bugs will be completely fixed (if anyone was able to test this and find any) and hopefully the script will be more reliable as a result.
Hmm... something might've happened to the code while I was pasting it. I'll look at it and try to fix it when I get home. I should probably mention that this script (currently) relies almost entirely on custom CTCPs. so make sure that the person you are challenging can recieve them. I'll add error alerts for these things as well when I get home. Spoof, this script is still pretty much in the alpha phase, which is why I'm calling it v0.1 rather than v1.0
First, I think I see what you are attempting to do with the long $replace, and I'll show you a trick I learned to make your job so much easier:
Code
*
The spaces here are necessary, as is the ! in $!decode, so don't omit them. What this will do is first encode the raw input with whatever encryption the m switch provides**, then decode that once the timer executes, returning the original string with nothing evaluated.
*I've decided to use $reptok rather than $replace, and I'll explain why later on.
**there was a specific reason for this, I think it has to do with parentheses and other such characters...
Second, the 'isin' check is an inefficient method for something like this because it runs the risk of false positives:
Say, for example, your nick is 'ger', and three other people in the channel are named "liger' 'gerbil' and 'lingerer'. (or something, I don't know)... If somebody, e.g., 'mel', slaps liger, gerbil, or lingerer, the script will trigger and you will slap mel for no reason...
Let me make a minor adjustment to that.
Because your script uses $replace, it will take any instance of 'ger' (or - your nick) in the string and replace it with 'mel'... So when mel slaps gerbil, the script will react and you will slap some person named melbil for no reason. Poor melbil! He/she's not even in the channel!
The best way to avoid these problems is to use something that only matches your nick exactly. Token identifiers work well, as can regex. Here's one regex-free way to do this:
Code
This should work for our purpose, and problems will only arise if your nick happens to be 'slaps'. However, it requires that your nick be a token exactly as is, so if you want to take it a step further, you can use regex - replace the $istok(...) with:
What these will do is not only check to see if your nick is a token within the string, but also match if your nick is immediately surrounded by characters that can't be used in nicks (at least according to someone).
So the code becomes something like this - (And I'll set a var to the regex match pattern to make things shorter):
The on JOIN event triggers before any modes are set, so you will need to use a timer in order to check if the person joining is an op or similar. I'd recommend creating an alias to perform the commands, and then call that with a timer in the event.
As for the rest of the script, you might want to be careful about calling your timer "timer1" as well as using the on open event for this...
- I can't check right now, but since timers use numbered names by default, the one used in the on JOIN will probably replace an unnamed timer that happened to be set before
- I believe the on OPEN event will only trigger when the query window is opened, so if the bot already happens to have a query window with the person answering, it'll never trigger.
Also, quick idea: maybe you could set a temporary storage system so that the bot doesn't ask the same person over and over whether or not they have a facebook every time they join the/a channel..?
PuNkTuReD is correct though, to an extent, though technically speaking, anyone will be able to lock down the channel, but only voices up will be able to unlock it.
By the way, the alignment of stuff is better in this dialog compared to your channel modes one, especially in the sense that nothing is overlapping or being cut off.
what is the "..." button for anyways? Also, a small suggestion -- maybe make an option to save the hash table, since they are deleted as soon as mIRC is closed.
$modespl is the maximum amount of modes that can be set on one line at a time. So in your case, if you try to set modes on 13 people, it would at most only set the mode on the first 12.
Quick suggestion: if ($active ischan) would probably work better than if ($active !=== Status Window) -- This way it won't try to get non-existent user lists from queries, chats, etc.
if (*s*p*a*r*k*y* iswm $nick) should be enough, but it might cause problems if another user happens to have those letters in that order anywhere in their nick...
Jethro_ -- Not sure if it was intentional or not, but your script will stop kicking and increasing %score after %score reaches 16.
Meta
commented on a Snippet, Mass Mode - Jul 23, 2010
Normally I'd want a script like this to check that you have the correct requirements to do the command, but...
Quote
It doesn't check to see if you're an op because, quite frankly, if you're stupid enough to use it without being one after reading the description, you deserve the error messages.
First thing I noticed when glancing over the script was how useless most of the regexes seemed to be. Wouldn't it have been easier to just type if ($2 == whatever) (or, if ($2 === whatever) if you want them to be case sensitive, which they curently are, by the way) ? o_O
Well, the point of my suggestions is so that if you want/try to use one of the kicking commands from a query, out of curiousity, lack of mouse skills, or poor aim or something, you can enter a channel to kick from, and avoid getting errors like "NICK No such channel" in your status window. Hopefully this makes sense.
Edit - Jethro_'s comment wasn't there before.
Also, (/slowmeta) Spanky, /me and /say will work with popup scripts, because the target isn't assumed to be the status window, but the window that you trigger the popup script from. (so /describe and /msg aren't needed)
A little problem is that many of these won't work in queries, and will generate errors (eg. NICK no such channel) when they are used there. (mainly the ones that kick)
Personally, what I would suggest is replacing any instance of $chan with: $$iif(#,#,$iif(#$? ischan,$!))
This will let you/the user choose a channel to kick from if they are using the command from a query, but will not generate an error if no channel is chosen, nor if you aren't on the channel written. (A channel won't have to be used if the command is used from the a nicklist.)
Edit - For the message commands, however, I would just replace msg $chan with say
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.