Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias f2 { parseSV.CSV }
- alias parseSV.CSV {
- ;var %file = $sfile(*.csv)
- var %file = $dropbox(Trainer Shiny Values.csv).qt
- if (%file) {
- if ($isFile(shinyvalues.txt)) remove -b $qt(shinyvalues.txt)
- if ($isFile(sv_contacts.txt)) remove -b $qt(sv_contacts.txt)
- msg #debug filtering
- filter -fk %file sortsv.csv
- }
- }
- alias sortsv.csv {
- var %file = shinyvalues.txt, %re = /,,/, %sub = $+($chr(44),$false,$chr(44))
- tokenize 44 $regsubex($1-, %re, %sub)
- if ($2 isnum 0-4095) {
- if ($read(%file,ns,$2)) write $+(-l,$readn) %file $2 $addtok($v1,$1,44)
- else write %file $2 $1
- write sv_contacts.txt $1 $(|) $+($2,$(|),$3)
- }
- }
- on *:TEXT:!sv *:*: {
- if ($numtok($1-,32) < 1) return
- var %window = $iif($chan,$v1,$nick), %svFile = shinyvalues.txt, %contactFile = sv_contacts.txt, %tmpFile = sv.tmp, %query = 1
- while ($gettok($2-,%query,44)) {
- var %sv = $gettok($v1,1-,32)
- if (%sv isnum) {
- if ($read(%svfile,ns,%sv)) {
- var %sv_info = $v1, %matchCount = 1
- if ($numtok($2-,44) > 1) write %tmpFile msg %window Matches for %sv
- while ($gettok(%sv_info,%matchCount,44)) {
- write %tmpFile msg %window $v1 $!(|) Contact via $gettok($read(%contactFile, ns, $v1 $(|)),2-,124)
- inc %matchCount
- }
- }
- }
- else {
- if ($read(%contactFile, ns, $2- $(|))) {
- write %tmpFile msg %window $gettok($v1,1,124) $!(|) Contact via $gettok($v1,2-,124)
- }
- }
- inc %query
- }
- if ($isFile(%tmpFile)) {
- play -c %window %tmpFile
- remove %tmpFile
- }
- else {
- msg %window No matches found
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment