Suggestions/help on small script. - 12/02/06 01:02 AM
I'm currently attempting to create a script that will keep track of how many users a certain nick invites into a channel. I haven't tested the following code, but pretty confident it will work as planned. I currently have:
I'm just wondering if there's anyting any of you see missing, or if you have any suggestions on how I could make this code a bit more effecient. I'm pretty certain that using hash tables would be a bit better, but I'm not experienced on using them, and feel comfortable using something I know. Any advice/help would be much appreciated. The data will be kept for approx. a month, and then cleared. I've attempted to add all the error checking I could think of, but know it's far from flawless. Again, thanks in advanced for all the advice/help offered.
Code:
on *:TEXT:!invited *:#:{ if ($$2 == $nick) { notice $nick What are you trying to do cheat?! You can't "invite" yourself. | halt } elseif ($$2 != $null) { inc %td 1 | set %joined. $+ $nick Invited by: $2 on $date | inc %invited. $+ $remove($2,<,>) 1 | write events.txt $nick (New Chatter) $nick indicates $$2 invites him to join $chan $+ . } else { notice $nick Please provide the nick of the user who invited you into the channel. } } on *:JOIN:#:{ if (%joined. $+ $nick != $null) write events.txt $nick (Join) $nick Joined $chan on $fulldate else { notice $nick I can't find you in my database. If you were invited to join this channel by someone | notice $nick type !invited <User who invited you> to help them win this amazing competition! } } on *:PART:#:{ if (%joined. $+ $nick != $null) write events.txt $nick (Part) $nick Parted $chan on $fulldate } on *:QUIT:{ if ($chan == #TheChannel) && (%joined. $+ $nick != $null) { write events.txt $nick (Quit) $nick QUIT on $fulldate } } on @*:TEXT:!cstats *:#:{ if ($$2 == $chr(42)) { dcc send $nick events.txt | halt } elseif (%joined. $+ $2 != $null) { set %cs 1 set %cs $lines(events.txt) while (%cs <= %cs) { notice $nick $read(events.txt, w, $2, %cs) inc %c } unset %c unset %cs notice $nick End of matches. } else { notice $nick No matches found. } } on @*:TEXT:!total *:#:{ if ($$2 == $chr(42)) { notice $nick I have %td nicks in my database. | halt } elseif (%invited. $+ $2 != $null) { notice $nick $2 has invited a total of %invited. $+ $2 people into the channel! } else { notice $nick No records for $2 found. } } on *:TEXT:!mytotal:#:{ if (%invited. $+ $nick != $null) { notice $nick There are currently %invited. $+ $nick users that claim you invited them. } else { notice $nick I have no records of anyone claiming you invited them to this channel. } }
I'm just wondering if there's anyting any of you see missing, or if you have any suggestions on how I could make this code a bit more effecient. I'm pretty certain that using hash tables would be a bit better, but I'm not experienced on using them, and feel comfortable using something I know. Any advice/help would be much appreciated. The data will be kept for approx. a month, and then cleared. I've attempted to add all the error checking I could think of, but know it's far from flawless. Again, thanks in advanced for all the advice/help offered.