I'll start by saying that it's probably not what you're looking for. However, you could re-use many of the aliases I've written for it to detect links in your twitch chat. I'd suggest opening it in another tab and then using ctrl+f to find the aliases I'm about to reference.
For example:
Code
This event would trigger when any URL was posted. However, it would also trigger for text like 'o.o'
To remove false matches, you would do the following:
Code
Inside $extractURL() I use an alias called $parseDomain(), which uses Mozilla's public suffix list to determine if the suffix used (such as .co.uk or .net) was valid or not. This means only valid domains are returned by $extractURL().
From there, you have the URLs posted inside %urls. You'd just need to loop through them and determine if the domain is whitelisted or not. For that, I have an alias called $trusted(). If $trusted(example.com) == $true, then the site is whitelisted.
It may be overkill for what you want, but if you're interested everything you'd need is in that script.
Using 'read' as an alias name is an ABSOLUTELY HORRIBLE IDEA because mIRC already has an identifier $read().
The same is true of /save. Just be glad you didn't call one of them /dec and then try to use it in another script inside a loop to decrease a variable (I've seen that before).
Checking if $1 is $null inside alias 'save' is redundant, because if $2 is not $null then $1 cannot be $null. Since the only valid format you have requires two parameters, you only need to check if $2 exists to know that they both exist.
Code
could be
Code
because 'save' and '.' are both literal text. There's no reason to $+() them together.
There seems to be a problem when I edit with some variables (mainly %del_cost and %below) being url decoded. If there are any problems there's a raw version here: http://pastebin.com/raw.php?i=Pd5624y2
The /dec command is already a built in function for mIRC. You should rename it, because it conflicts with any script that uses /dec to decrease a variable.
I realize this is 4-5 years old, but if anyone stumbles upon this snippet and happens to read the comments just be aware that /dec may need to be edited to /decline or something similar if you have issues.
In case you were wondering I just Googled the script after I fixed an endless loop issue for a friend caused by the conflict I described above.
It comes down to personal preference. If you are the only person who's going to be working on the code, then do whatever makes it easiest for you to read and navigate.
these types of slap "scripts" are generally for mIRC Scripts.
What do you mean? We're in the mIRC snippet section, isn't it obvious that they're a script for mIRC?
Quote
had slaps such as these integrated for fun. Not a big deal really.
Again, I'm not quite sure what you're talking about. It seems you think I questioned the usefulness of the script or judged it in some way? I offered another method to integrate the script that wouldn't have 60 different slaps nested in menus (as it could be difficult to find the one you were looking for). If they weren't looking for something specific on the menu, then making the output random from a single menu item would equally suit the desire to slap somebody on the internet.
What if you just made a single slap menu item and then had the output be random? If you want to slap with something specific you could always just type it out, as I'm sure finding the right item on the list is equally (if not more) difficult than simply typing the message. You could even shorten what you type by making a slap alias in your aliases file. Something like "/slap /describe $active slaps $2 around a bit with a $$3-" would do the trick.
If you happen to like the idea of a random slap, I'd look up $read() and consider storing the possible slaps within a plain text file in your mirc folder.
@SunnyD I think $nick() supports nick prefixes too but as an undocumented feature. I might be wrong but investigate for yourself.
if (!$2) || (!$3) || (!$4)
could be shortened to "if (!$4)" because if the fourth token exists then the second and third must exist.
just be aware that !$4 means the fourth token could be $null, 0, or $false. if the command needs a specific type of input you might want to use comparisons such as isnum (for days).
"$chan" and "#" are interchangeable as well, just a tip.
Ok, so I tracked down a bug that happened literally on my first test message of the highlight window. I was using mibbit to test and it seemed to be failing to change colors and be clickable for some of the lines.
Eventually I realized it was because mibbit adds another space after tabbing a name. Consecutive spaces and trailing spaces are causing $fline to fail on the hotlink because the line in the hash has had the extra spaces stripped out during /hl_addLine.
I managed to find a workaround by replacing the extra $chr(32) with $chr(160) and then replacing them back for $hl_findLine so that the line would change colors and was clickable, but again ran into mIRC stripping all of the spaces for /findtext :(
I can't find any way to manipulate a window to scroll to the correct line to avoid /findtext (somebody suggested $com but it took 7 seconds to scroll 1500 lines) and I also can't figure out any way to keep /findtext from stripping the extra spaces. Using ctrl+f with multiple consecutive spaces does work, so I think I'll try to use sendKeys for that (I barely understand COM yet :( )
It wasn't your fault, just "mIRC being an asshole" (direct quote).
Beautiful script though, I learned a lot just figuring out how it works :P
They're saying the script contains an excessive number of lines that have been commented out. A lot of comments can be a good thing if they're explaining how the script works, but it seems as if the majority here are just asterisks to make the white space pretty.
That's cool. You could also halt the display of highlight messages and echo them back without the highlight, rather than ignore the message completely. Just an idea.