FordLawnmower commented on a Page, Spell Checker  -  Feb 06, 2010

I noticed a couple of things that you should change with this Battlemonkey.
When you sockread to a variable without setting it first it becomes global which is not necessary. So the sockread line

sockread %sresults

Should be changed to

var %sresults | sockread %sresults

This way %sresults can only be seen inside the script and it will unset it's self at the end.

Which leads me to this

on *:sockclose:spell: {
  unset %s*
}

The first problem here is unsetting every variable that starts with S.
Suppose someone had a stats script with lots of variables like %statsjoins %statsparts %statslines. Or even more complicated like %stats#chanNICKLines.
This script could wipe out years of someones stats collection and there would be no way to get them back. You need to be way more specific with your variable naming conventions if you are going to use wildcards to unset them.

Luckily, The script will only reach the unset line if there is some sort of error. When you close a socket using sockclose, it does NOT trigger the On Sockclose event. This event is only closed if the Host closes the socket.
If you look in the variable section of your scripts editor, you will see that %schan,%sword and %sresults all remain set.
One way to fix this is to make an alias called SpellCleanUp that unsets all variables and closes the socket. Then just put SpellCleanup where you have Sockclose Spell.

Other than that your script looks fine Battlemonkey. I don't see anything wrong with using variables as long as they are very descriptive and they get unset at the end.

Obviously adding suggestions as napa182 has done will make the script 100% better but yours works fine :)

 Respond  
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.