J-Script — File Browser

J-Scriptv2.2 / J-Scriptv2.2 / ini / color.mrc

color.mrc — 8.97 KB — Download this file

;color stuff
on *:input:*: {
  if ($active == @BibleSearch) {
    if ($chr(47) == $left($1,1)) { return }
    else { search $1- | halt }
  }
  if ($active == Status Window) { return }
  if (/con/con == $1) { echo 4 -a Oh, you're stupid..  never type /con/con | halt }
  if ($chr(47) == $left($1,1)) { return }
  if ($chr(58) == $left($1,1)) && ($chr(35) isin $active) && ($2 != $null) {
    set %anick $remove($$1,$chr(58))
    set %achan $nick($chan,0)
    set %alen $len(%anick)
    :loop
    if (%achan == 0) { say $1- | halt }
    if (%anick == $left($nick( $chan , %achan ),%alen)) { set %nicka $nick( $chan, %achan ) | goto say }
    else { dec %achan | goto loop }
    :say
    say 12(4 $+ %nicka $+ 12) $2- | halt
    :skip
  }
  if ($read(ini/abrevs.ini, s, $1) == $null) {
    if ($jscript(ctalk) == ON) { say %color $+ $1- | halt }
  }
  if ($read(ini/abrevs.ini, s, $1) == $null) {
    if (%rainbow.color == ON) { say $rancolor($$1-) | halt }
  }
  if (($read(ini/abrevs.ini, s, $1) != $null) && ($chr(34) != $left($1,1))) { 
    say $abrev($1-)
    halt
  }
}
alias rancolor {
  var %temp = 1, %max = $len($1-), %char, %string, %color = 1 2 4 5 7 3 12 6, %cs = $gettok(%color,$rand(1,7),32)
  while (%temp <= %max) {
    %char = $mid($1-,%temp,1) | if (%char isnum) %string = %string $+  $+ $gettok(%color,%cs,32) $+ ,99 $+ %char
    elseif (%char = $chr(32)) { inc %temp | %char = $mid($1-,%temp,1) | %string = %string  $+ $gettok(%color,%cs,32) $+ ,99 $+ %char }
    else { %string = %string $+  $+ $gettok(%color,%cs,32) $+ %char }
    inc %temp | inc %cs | if (%cs > $numtok(%color,32)) %cs = 1
  }
  if ($isid) return %string | else msg # %string
}
alias abrev {
  tokenize 32 $$1-
  var %abr.crt = 0
  var %abr.trig = $1
  var %abr.txt = $2
  if (%abr.trig == $null) { halt }
  :start
  var %abr.msg = $read(ini/abrevs.ini, s, %abr.trig)
  if (%abr.msg == $null) { 
    if ($jscript(ctalk) == ON) { var %abr.end = %color $+ $1- | goto return }
    if ($jscript(ctalk) == OFF) { var %abr.end = $1- | goto return }
  }
  var %abr.nums = $numtok(%abr.msg,32)
  :loop
  if (%abr.nums == 0) { goto almost }
  inc %abr.crt
  dec %abr.nums
  var %abr.end = %abr.end %cabr.1 $+ $upper($left($gettok(%abr.msg,%abr.crt,32),1)) $+ %cabr.2 $+ $right($gettok(%abr.msg,%abr.crt,32),$calc($len($gettok(%abr.msg,%abr.crt,32)) -1))
  goto loop
  :almost
  var %abr.end = %abr.end  $+ %cabr.txt $+ $2-
  :return
  return %abr.end
}
alias abrsetup dialog -m abrsetup abrsetup
dialog abrsetup {
  title "Abreviation Completion Setup"
  size -1 -1 380 270
  Text "This is the Setup Dialog for the Abreviation Completion script." , 4 , 10 10 380 20
  Button "OK" , 5 , 290 230 75 35 , ok
  Button "Cancel" , 6 , 20 230 75 35 , cancel
  Button "Save" , 7 , 135 230 110 30
  Radio "Scheme 1" , 8 , 15 50 80 12
  Radio "Scheme 2" , 9 , 120 50 80 12
  Radio "Scheme 3" , 10 , 230 50 90 12
  Radio "Scheme 4" , 11 , 15 75 80 12
  Radio "Scheme 5" , 12 , 120 75 80 12
  Radio "Custom" , 13 , 230 75 70 12
  Radio "OFF" , 21 , 15 95 60 12
  Box "Custom Settings" , 14 , 15 120 300 90
  Text "1st letter color codes:" , 15 , 25 135 130 20
  Edit "" , 16 , 160 135 80 20
  Text "rest of word codes:" , 17 , 25 160 120 20
  Edit "" , 18 , 160 160 80 20
  Text "message codes:" , 19 , 25 185 120 20
  Edit "" , 20 , 160 185 80 20
}
on *:dialog:abrsetup:*:*: {
  if (init == $devent && $did == 0 ) {
    did -a abrsetup 16 %cabr.1
    did -a abrsetup 18 %cabr.2
    did -a abrsetup 20 %cabr.txt
    if (%cabr.style == 1) { did -c abrsetup 8 }
    if (%cabr.style == 2) { did -c abrsetup 9 }
    if (%cabr.style == 3) { did -c abrsetup 10 }
    if (%cabr.style == 4) { did -c abrsetup 11 }
    if (%cabr.style == 5) { did -c abrsetup 12 }
    if (%cabr.style == custom) { did -c abrsetup 13 }
  }
  if (sclick == $devent && $did == 8) {
    did -r abrsetup 16
    did -r abrsetup 18
    did -r abrsetup 20
    did -a abrsetup 16 4
    did -a abrsetup 18 12
    did -a abrsetup 20 
  }
  if (sclick == $devent && $did == 9) {
    did -r abrsetup 16
    did -r abrsetup 18
    did -r abrsetup 20
    did -a abrsetup 16 14
    did -a abrsetup 18 6
    did -a abrsetup 20 
  }
  if (sclick == $devent && $did == 10) {
    did -r abrsetup 16
    did -r abrsetup 18
    did -r abrsetup 20
    did -a abrsetup 16 2
    did -a abrsetup 18 12
    did -a abrsetup 20 4
  }
  if (sclick == $devent && $did == 11) {
    did -r abrsetup 16
    did -r abrsetup 18
    did -r abrsetup 20
    did -a abrsetup 16 12
    did -a abrsetup 18 4
    did -a abrsetup 20 
  }
  if (sclick == $devent && $did == 12) {
    did -r abrsetup 16
    did -r abrsetup 18
    did -r abrsetup 20
    did -a abrsetup 16 10
    did -a abrsetup 18 7
    did -a abrsetup 20 
  }
  if (sclick == $devent && $did == 13) {
    did -r abrsetup 16
    did -r abrsetup 18
    did -r abrsetup 20
  }
  if (sclick == $devent && $did == 21) {
    did -r abrsetup 16
    did -r abrsetup 18
    did -r abrsetup 20
  }
  if (sclick == $devent && $did == 7) {
    if ($did(abrsetup,8).state == 1) {
      set %cabr.style 1 
      set %cabr.1 4
      set %cabr.2 12
      set %cabr.txt 
    }
  }
  if ($did(abrsetup,9).state == 1) { 
    set %cabr.1 14
    set %cabr.2 6
    set %cabr.txt 99
    set %cabr.style 2
  }
  if ($did(abrsetup,10).state == 1) { 
    set %cabr.1 2
    set %cabr.2 12
    set %cabr.txt 4
    set %cabr.style 3
  }
  if ($did(abrsetup,11).state == 1) { 
    set %cabr.1 12
    set %cabr.2 4
    set %cabr.txt 99
    set %cabr.style 4
  }
  if ($did(abrsetup,12).state == 1) { 
    set %cabr.1 10
    set %cabr.2 7
    set %cabr.txt 
    set %cabr.style 5
  }
  if ($did(abrsetup,21).state == 1) { 
    set %cabr.1 99
    set %cabr.2 99
    set %cabr.txt 
    set %cabr.style OFF
  }
  if ($did(abrsetup,13).state == 1) { 
    set %cabr.1 $did(abrsetup,16)
    set %cabr.2 $did(abrsetup,18)
    set %cabr.txt $did(abrsetup,20)
    set %cabr.style custom
  }
  if ($did(abrsetup,21).state == 1) { 
    set %cabr.style off
    set %cabr.1 
    set %cabr.2 
    set %cabr.txt 
  }
}
alias abrtrig dialog -m abrtrig abrtrig
dialog abrtrig {
  title "Abreviation Completion Triggers"
  size -1 -1 380 320
  Text "To edit a dialog, double click on it, in the box. Enter in your stuff, and click save." , 4 , 6 9 351 48
  Button "Close" , 5 , 276 250 54 39 , ok
  List 8 , 9 66 110 170
  Edit "" , 9 , 155 69 141 20
  Edit "" , 10 , 130 93 245 20 , autohs
  Text "The Abreviation Completion script and this dialog was created by Jerry Horn. Do not use this script in any other mIRC script without contacting me first." , 11 , 129 123 225 108
  Button "Add/Save" , 13 , 295 48 80 20
  Button "Delete" , 14 , 230 48 60 20
}
on *:dialog:abrtrig:*:*: {
  if (init == $devent && $did == 0 ) {
    dilload
  }
  if (dclick == $devent && $did == 8) {
    tokenize 32 $read(ini\abrevs.ini, nt, $did(8).sel)
    did -o $dname 9 1 $1
    did -o $dname 10 1 $2-
  }
  if (sclick == $devent && $did == 13) {
    tokenize 32 $did(9)
    if ($2 != $null) {
      perror There may not be spaces in the trigger.
      halt
    }
    tokenize 32 $did(10)
    if ($1- == $null) {
      perror You must specify a response for the trigger: $did(9)
      halt
    }
    set %addabrev.txt $strip( $did(9) )
    set %addabrev.txt %addabrev.txt $strip($did(10))
    set %dialog.linenum 1
    :okay
    tokenize 32 $read(ini\abrevs.ini, nt, %dialog.linenum)
    if ($1 == $did(9)) {
      ; remove line
      write -dl $+ %dialog.linenum ini\abrevs.ini
      goto con
    }
    elseif ($1 != $null)  {
      inc %dialog.linenum 1
      goto okay
    }
    :con

    set %dialog.current 1
    :next
    tokenize 32 $read(ini\abrevs.ini, nt, %dialog.current)
    if ( $iif($lower($1) > $lower($did(9)),$true) ) {
      ;edit existing
      write -il $+ %dialog.current ini\abrevs.ini %addabrev.txt
      goto end
    }
    elseif (%dialog.current >= $lines(ini\abrevs.ini)) {
      ;add new
      write -i ini\abrevs.ini %addabrev.txt
      goto end
    }
    else {
      inc %dialog.current 1
      goto next
    }
    :end
    dilload
  }
  if (sclick == $devent && $did == 14) {
    if ($did(9) == $null) { halt }
    set %del.num 1
    :delloop
    if (%del.num > $lines(ini\abrevs.ini)) { halt }
    set %del.txt $read(ini\abrevs.ini, %del.num)
    set %del.txt $gettok(%del.txt,1,32)
    if (%del.txt == $did(9)) { write -dl $+ %del.num ini\abrevs.ini | dilload | unset %del.* |halt }
    if (%del.txt != $did(9)) { inc %del.num | goto delloop }
  }
}
alias dilload {
  did -r abrtrig 8
  set %dial.crt 1
  :next
  unset %dial.tmp
  set %dial.tmp $read(ini\abrevs.ini, nt, %dial.crt)
  if (%dial.crt <= $lines(ini\abrevs.ini)) {
    tokenize 32 %dial.tmp
    did -o abrtrig 8 %dial.crt $lower($1)
    inc %dial.crt 1
    goto next
  }
  did -r abrtrig 9
  did -r abrtrig 10
  unset %dial.tmp
}