Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on *:start: {
- set %_mschan #elite-chat | set %_msb !mostsearched | set %_msdir $+($mircdir,mostsearched\) | set %_msitems $+(",%_msdir,msitems.txt,")
- if !$exists(%_msdir) { mkdir %_msdir } | if !$exists(%_msitems) { write -c %_msitems }
- .timermscopy 0 86400 _mscopy
- .timermspurge 0 21600 _mspurge
- }
- on *:unload: {
- var %_msanswer = $?="Would you like to delete your database and all backups? $crlf From %_msdir? $crlf Enter y or n. (yes or no)"
- if %_msanswer == y || %_msanswer == yes { var %i $findfile(%_msdir,*.*,0,.remove $1-) | echo -a %_msb All Databases deleted. | .remove %_msdir }
- if %_msanswer == n || %_msanswer == no || !%_msanswer { noop }
- unset %_ms*
- }
- alias whilefix { dll WhileFix.dll WhileFix . }
- alias ' { return $replace($1-,$chr(32),$chr(46)) }
- alias _mstotal { return $lines(%_msitems) }
- alias mst { msg %_mschan %_msb There are $+(,$bytes($_mstotal,b),) total searches Indexed. }
- alias _msimport { var %i $hget(ms,0).item | while %i { whilefix | write %_msitems $hget(ms,%i).data $hget(ms,%i).item | dec %i } }
- alias _mscopy { var %mscfn $+($remove(%_msitems,.txt,"),-BACKUP-,$asctime(mmddyy),-,$asctime(hhnntt),.txt) | copy -o %_msitems %mscfn | echo -a %_msb Backup made of the database. Name: $nopath(%mscfn) -Location: $+(,$nofile(%_msitems),) }
- alias _mspurge {
- var %x $_mstotal, %c 0 | while %x {
- whilefix
- if $gettok($read(%_msitems,%x),1,32) <= 3 { write $+(-dl,%x) %_msitems }
- dec %x | inc %c
- }
- if %c > 0 { msg %_mschan %_msb Database Purged of all entried with less than 5 searches. }
- }
- alias _mslist {
- var %count = 1
- if ($window(@Sort1,state)) { window -c @Sort1 } | if ($window(@Sort2,state)) { window -c @Sort2 }
- window -h @Sort1 | window -h @Sort2
- while (%count <= $_mstotal) { whilefix | aline @Sort1 $gettok($read(%_msitems,%count),2-,32) $gettok($read(%_msitems,%count),1,32) | inc %count }
- filter -wwucte 2 32 @Sort1 @Sort2 *
- var %x = 1, %v = 10 | while (%x <= %v) { whilefix | msg %_mschan $+(,%x,.,) $gettok($line(@Sort2,%x),1,32) :: Searched: $gettok($line(@Sort2,%x),2,32) times. | inc %x }
- window -c @Sort1 | window -c @Sort2
- }
- alias mss {
- msg %_mschan %_msb :: Listing [Top 10] Most Searched Terms of the $+(,$bytes($_mstotal,b),) Indexed.
- _mslist
- msg %_mschan %_msb :: [EOF]
- }
- on *:text:*:%_mschan:{
- if !%msfld. [ $+ [ $nick ] ] {
- set -u5 %msfld. [ $+ [ $nick ] ] 1
- if $2- { var %msr = $'($2-) }
- if (($1 == !s || $1 == !search)) && $2- {
- if $read(%_msitems, w, $+(*,%msr,*)) {
- var %msln $readn
- var %msval $calc($gettok($ifmatch,1,32) + 1), %msval2 $gettok($ifmatch,2-,32)
- write $+(-dl,%msln) %_msitems
- write %_msitems %msval %msval2
- halt
- }
- else write %_msitems 1 %msr
- }
- if $1 == !mostsearched && !$2- {
- if $_mstotal > 0 { mss | halt }
- else msg %_mschan %_msb :: No Searches Indexed yet...
- }
- if $1 == !mostsearched && $2- {
- ; Code for help
- if $2 != merge && $2 == help {
- msg # :: Sending %_msb :: Help Command Reference to $+(,$nick,) via pm.
- msg $nick %_msb :: Help Command Reference
- msg $nick :: If a user only types !mostsearched, then list top 10 most searched terms.
- msg $nick :: If a user types !mostsearched release.name.here (periods required), it will show the number of searches that release has.
- msg $nick :: If an op (@) or halfop (%) types !mostsearched merge release.name1.here release.name2.here - it will merge the 2 values of the specified releases, then delete release.name1.here. You are merging the first into the second, then deleting the first.
- msg $nick %_msb :: EOF
- halt
- }
- if $2 && $2 != merge && $2 != help {
- if $read(%_msitems, w, $+(*,$2-,*)) {
- var %_msrdn $readn
- msg # %_msb :: Number of searches for $+(,$2-,) is $iif($gettok($read(%_msitems,%_msrdn),1,32) > 0,$ifmatch,0) $+ .
- halt
- }
- else msg # %_msb :: Error: $+(,$2-,) doesn't exist. | halt
- }
- }
- if ($1 == !mostsearched) && ($2 == merge) && ($3) && ($4) {
- if $nick isop # || $nick ishop # || $nick isvoice # {
- if $chr(32) !iswm $3 && $chr(32) !iswm $4 {
- if $read(%_msitems, w, $+(*,$'($3),*)) {
- var %ms3ln $readn
- if $read(%_msitems, w, $+(*,$'($4),*)) {
- var %ms4ln $readn
- var %mc $calc($gettok($read(%_msitems,%ms3ln),1,32) + $gettok($read(%_msitems,%ms4ln),1,32))
- write $+(-dl,%ms3ln) %_msitems
- write %_msitems %mc $'($4)
- msg # %_msb :: Merge Successful! $+(,$3,) has been merged with $+(,$'($4),) and the new value is $+(,%mc,.) The first release specified, $+(,$3,) $+ , has been deleted.
- halt
- }
- else msg # %_msb :: Error: Second Release specified, $+(,$4,) doesn't exist. Check your spelling.
- }
- else msg # %_msb :: Error: First Release specified, $+(,$3,) doesn't exist. Check your spelling.
- }
- else msg # %_msb :: Error: Release names indexed do not have spaces in the titles, use periods.
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement