Coders-IRC


IRC for Coders

Simple Seen Snippet


image

ON *:TEXT:*:#: {
  hadd seen $nick text $chan $ctime $1-
  if ($1 = !seen) {
    if ($count($2, ?, *)) {

      var %max = 5 | ; maximum number of results

      var %i = 1, %n = $hfind(seen, $2, 0, w)
      msg $chan $nick $+ : %n result $+ $iif(%n != 1, s) for $2. $iif(%n > %max, Showing first %max) 
      while (%i <= %max) && ($hfind(seen, $2, %i, w)) {
        msg $chan $nick $+ : $seenparse($v1)
        inc %i
      }
    }
    elseif ($2 ison $chan) { msg $chan $2 is right here. }
    else { msg $chan $nick $+ : $seenparse($2) }
  }
}

Expand


Read More

Instant /help


image

/*
{
  Instant /help by jaytea

  Displays information from the help file to the active
  window. Ideal for a quick syntax reference or copying
  and pasting excerpts from the help file to users in
  a format that closely resembles the original.

  Use /hf <search term> to look up '<search term>' and
  display the matching section in the active window. By
  default, /help has been overwritten to allow you to
  use /help <search term> which might have become habit.

  <search term> can contain wildcards; if more than one
  result is found, you will be prompted to clarify which
  one you want to view. For example:

  /help /*

  Prompts you to select a command to view information on.

  /help /draw*

  Choose a /draw command to view information on.

  For questions, suggestions or comments related to this 
  snippet, please drop by #mSL on irc.swiftirc.net and
  let me know.

  Thanks to my man FiberOPtics for $_htmlconv(). 
}
*/

alias help hf $1- | if ($isid) returnex $chr(32) | ; Comment out or delete this line to get your old /help back.

alias hf {
  if (!$isfile($scriptdirhf\mirc.hhk)) {
    echo -eagc info Unable to find mirc.hhk. Try /hf_init to (re)initialize
    return
  }
  if (!$hf_find($1-)) {
    echo -eagc info No matches found.
  }
}

on *:load:{
  hf_init
}

alias hf_init {
  if ($1 == 2) {
    if ($isfile($scriptdirhf\mirc.hhk)) {
      .timer $+ $ctimer off
      echo -agc info2 Preparing data files ...
      noop $findfile($scriptdirhf, *.htm, 0, hf_parse $1-)
      hf_hhk
      echo -agc info2 Initialization successfully completed. 
    }
    return
  }

  var %chm = $findfile(., mirc.chm, 1).shortfn

  if (!%chm) %chm = $findfile($nofile($mircini), mirc.chm, 1).shortfn

  if (!%chm) {
    echo -eagc info * Error: mirc.chm not found. Cannot proceed.
    return
  }

  mkdir $qt($scriptdirhf)
  if ($isfile($scriptdirhf\mirc.hhk)) .remove $qt($scriptdirhf\mirc.hhk)
  run hh -decompile $shortfn($scriptdirhf) mirc.chm
  echo -agc info2 Unpacking mirc.chm. Please wait ...
  .timerhf -m 0 500 hf_init 2
}

; $hf_find(search term)

alias hf_find {
  if (" isin $1) || ($1 == $null) return 0
  if ($fopen(hff)) .fclose hff
  if (!$isfile($scriptdirhf\mirc.hhk)) {
    echo -eagc info * /hf_find: no such file $scriptdirhf\mirc.hhk
    goto end
  }
  .fopen hff $qt($scriptdirhf\mirc.hhk)

  var %search = $1"*"*, %result
  .fseek -w hff %search
  while (!$feof) {
    tokenize 34 $fread(hff)
    %result = %result $+ , $+ $iif($!?* iswm $1, $!! $+ $mid($1, 2), $1)
    if ($len(%result) > 4000) break
    .fseek -w hff %search
  }
  %result = $mid(%result, 2)

  if (, isin %result) {
    %result = $input(Multiple results found. Please select one:, m, Help!, , [ %result ] )
  }
  else %result = $eval(%result, 2)

  if (!%result) return 0

  .fseek hff 0
  .fseek -w hff %result $+ "*
  tokenize 34 $fread(hff)
  .fclose hff
  return $hf_load($2, $3)  

  :end
  .fclose hff 
}

; $hf_load(file, label)

alias hf_load {
  if ($fopen(hfl)) .fclose hfl
  if (!$isfile($scriptdirhf\ $+ $1)) {
    echo -eagc info * /hf_load: no such file $scriptdirhf\ $+ $1
    return 0
  }

  var %first

  if ($2) {  
    noop $read($scriptdirhf\ $+ $1, wn, $qt($2))
    if (!$readn) return 0
    %first = $readn + 1
  }
  else %first = 1

  noop $read($scriptdirhf\ $+ $1, wn, "*", %first)
  loadbuf $+(%first, -, $iif($readn, $calc($v1 - 1), $lines($scriptdirhf\ $+ $1))) -ap $qt($scriptdirhf\ $+ $1)
  return 1
}

; /hf_hhk

alias hf_hhk {
  if ($fopen(hfh)) .fclose hfh
  if (!$isfile($scriptdirhf\mirc.hhk)) {
    echo -eagc info * /hf_hhk: no such file $scriptdirhf\mirc.hhk
    goto end
  }
  .fopen hfh $qt($scriptdirhf\mirc.hhk)

  noop $fread(hfh, $file($scriptdirhf\mirc.hhk).size, &hfh)
  .fseek hfh 0

  var %i = 1, %name
  while ($bfind(&hfh, %i, name="Name")) {
    %name = $gettok($bvar(&hfh, $v1, 100).text, 4, 34)
    %i = $bfind(&hfh, $v1, name="Local")
    tokenize 35 $gettok($bvar(&hfh, %i, 100).text, 4, 34)
    .fwrite -n hfh $replace($+(%name, ", $1, ", $2), &, &, <, <, >, >,  , $chr(32))
  }

  btrunc $qt($scriptdirhf\mirc.hhk) $fopen(hfh).pos

  :end
  .fclose hfh
}

; /hf_parse <file>

alias hf_parse {
  if ($fopen(hfp)) .fclose hfp
  if (!$isfile($1-)) {
    echo -eagc info * /hf_parse: no such file $1-
    goto end
  }
  .fopen hfp $qt($1-)

  bunset &hfp
  noop $fread(hfp, $file($1-).size, &hfp)

  var %i = 1
  while ($bfind(&hfp, %i, <a name=)) {
    %i = 1 + $v1
    bset &hfp $v1 < ! ! ! > < p >
    if ($bfind(&hfp, $v1, ></a>)) {
      bset &hfp $v1 < b r 32 >
      %i = $v1
    }
    else {
      echo -eagc info * /hf_parse: error #1 with $1-
      goto end
    }
  }

  var %list = f_Bolddefault,48 50,f_Heading1,50 31,f_Highlight,49 50,f_Subheading,48 52
  var %i = 1

  while ($bfind(&hfp, %i, <span class=")) {
    var %label = $gettok($bvar(&hfp, $v1, 100).text, 2, 34)
    %i = $v1

    if (?? ?? iswm $replace(%label, [ %list ] )) {
      %i = $bfind(&hfp, %i, >) - 5
      bset &hfp %i " > 2 3 $v2
      %i = $bfind(&hfp, %i, </span>)
      bset &hfp %i 15 $iif($bvar(&hfp, %i, 11).text == </span></p>, < p > 160 32 32, < ! > < ! >)
    }

    else {
      echo -eagc info * /hf_parse: error #2 with $1-
      goto end
    }
  }

  .fseek hfp 0
  .fwrite -b hfp &hfp
  .fclose hfp
  if (!$_htmlconv($1-)) echo -eagc info * /hf_parse: error #3 with $1-
  return

  :end
  .fclose hfp
}

; $_htmlconv
; Author:    FiberOPtics - mirc.fiberoptics@gmail.com
;

alias _htmlconv {
  if (!$isfile($1)) || ($os isin 9598) return 0
  var %in = $shortfn($1), %out = $shortfn($2), %mss = mss $+ $ticks
  if ($2 == $null) %out = %in
  .comopen %mss MSScriptControl.ScriptControl
  if ($comerr) return 0
  var %t, %n = $crlf
  %t = $com(%mss,language,4,bstr*,vbscript)
  %t = $&
    set html = createobject("htmlfile") %n $&
    set fso = createobject("scripting.filesystemobject") %n $&
    set inf = fso.opentextfile( $+(",%in,") ) %n $&
    src = inf.readall %n $&
    inf.close %n $&
    html.write "<html><body>" & src & "</body></html>" %n $&
    set outf = fso.createtextfile( $+(",%out,") ,true) %n $&
    outf.write html.body.innertext %n $&
    outf.close
  %t = $com(%mss,executestatement,1,bstr*,%t)
  .comclose %mss
  return %t
  :error
  if ($com(%mss)) .comclose %mss
  return 0
}

Expand


Read More

Colored Nickname


image

All settings in the alias "ww_setting". You can reconfigure this script to your liking - change the welcome text, size, indentation, background and color of window frames, font and color gamut of changing letters, as well as the speed of the glitter effect and the off timer.


#####################################################################
#   WelcomeWindow v1.0
#   Description: Pop-up welcome window with animated glitter effect.
#   Author: Epic
#   Email: epicnet@mail.ru
#   Site: http://epicnet.ru
#####################################################################

on *:START: .timerWWSTART -m 1 1000 ww
alias ww { ww_setting | ww_window | ww_window_decor | ww_text_color }
=====================================================
alias -l ww_setting {
  .hadd -m ww text Hello, $+($me,!) :)))
  .hadd -m ww win-name @Welcome
  .hadd -m ww win-size-x 20
  .hadd -m ww win-size-y -10
  .hadd -m ww margin-w 50
  .hadd -m ww margin-h 30
  .hadd -m ww color-bg $rgb(14,12,18)
  .hadd -m ww color-line $rgb(91,76,116)
  .hadd -m ww color-text $rgb(147,122,187)
  .hadd -m ww font ComicSansMS
  .hadd -m ww fsize 28
  .hadd -m ww start-color 91
  .hadd -m ww end-color 97
  .hadd -m ww time-speed-color 150
  .hadd -m ww time-closing 5000
}
=====================================================
alias -l ww_window {
  set %ww_w $calc($width($hget(ww,text),$hget(ww,font),$hget(ww,fsize),0,1) + ($hget(ww,margin-w) *2))
  set %ww_h $calc($height($hget(ww,text),$hget(ww,font),$hget(ww,fsize)) + ($hget(ww,margin-h) *2))
  set %ww_mw $int($calc($window(-3).dw /2 + $hget(ww,win-size-x)))
  set %ww_x $calc($window(-2).dx + %ww_mw)
  set %ww_mh $int($calc($window(-3).dh /2 + $hget(ww,win-size-y)))
  set %ww_y $calc($window(-2).dy + %ww_mh)
  .window -pdBhiok0w0 +dL $hget(ww,win-name) %ww_x %ww_y %ww_w %ww_h | .window -a $hget(ww,win-name)
  .timerWW -m 1 $hget(ww,time-closing) .window -c $hget(ww,win-name)
}
=====================================================
alias -l ww_window_decor {
  .drawfill -r $hget(ww,win-name) $hget(ww,color-bg) %ww_w %ww_h 0 0
  .drawline -r $hget(ww,win-name) $hget(ww,color-line) 1 0 0 %ww_w 0
  .drawline -r $hget(ww,win-name) $hget(ww,color-line) 1 0 $calc(%ww_h -1) %ww_w $calc(%ww_h -1)
  .drawline -r $hget(ww,win-name) $hget(ww,color-line) 1 0 0 0 %ww_h
  .drawline -r $hget(ww,win-name) $hget(ww,color-line) 1 $calc(%ww_w -1) 0 $calc(%ww_w -1) $calc(%ww_h -1)
}
=====================================================
alias -l ww_text_color {
  if (!%ww_cc) { set %ww_cc $hget(ww,start-color) }
  if (%ww_cc <= $hget(ww,start-color)) set %ww_nc 1
  if (%ww_cc >= $hget(ww,end-color)) set %ww_nc 2
  if (%ww_nc == 1) inc %ww_cc | if (%ww_nc == 2) dec %ww_cc
  if ($hget(ww,ctext)) .hdel -sw ww ctext
  var %ww_ct $replace($hget(ww,text),$chr(32),$chr(160))
  var %ww_cl $len(%ww_ct) | var %ww_e %ww_cc | var %ww_w 1
  var %ww_q 1 | while (%ww_q <= %ww_cl) {
    .hadd -m ww ctext $+($hget(ww,ctext),$chr(3),%ww_e,$mid(%ww_ct,%ww_q,1))
    inc %ww_q | if (%ww_w == 1) inc %ww_e | if (%ww_w == 2) dec %ww_e
    if (%ww_e <= $hget(ww,start-color)) var %ww_w 1 | if (%ww_e >= $hget(ww,end-color)) var %ww_w 2
  }
  if ($window($hget(ww,win-name))) {
    ww_window_decor
    .drawtext -pr $hget(ww,win-name) $hget(ww,color-text) $hget(ww,font) $hget(ww,fsize) $hget(ww,margin-w) $hget(ww,margin-h) $hget(ww,ctext)
    .timerWWTC -m 1 $hget(ww,time-speed-color) ww_text_color
  }
}
=====================================================

Expand


Read More