All pastes #244036 Raw Edit

Something

public text v1 · immutable
#244036 ·published 2006-11-09 05:47 UTC
rendered paste body
alias nthing dialog -md nthing nthing
dialog nthing {
  title "Notice Thing v0.1"
  size -1 -1 251 78
  option dbu
  list 1, 77 10 170 50, size vsbar
  text "", 2, 80 1 76 8
  button "New Conversation", 3, 29 62 48 12
  list 4, 1 11 76 50, size vsbar
  button "Clear Nick", 5, 1 62 27 12
  edit "", 6, 77 61 136 10, autohs
  button "Send", 7, 217 61 26 12
  link "AltScripts", 8, 2 2 24 8
  text "|", 9, 26 2 2 8
  link "Close", 10, 31 2 22 8
}

on *:DIALOG:nthing:*:*:{
  ;; Init and Close Events
  if ($devent == init) || ($devent == close) {
    hfree -w notices*
    $iif($devent == init, hadd -m notices current Null)
  }
  ;; Single Click Events
  if ($devent == sclick) {
    ;; New Conversation Button
    if ($did == 3) {
      hadd -m notices $hget(notices,0).item $$?="Nickname?"
      hadd -m notices current $!
      hmake notices. [ $+ [ $hget(notices,current) ] ] 100
      did -ra $dname 2 Conversation with $hget(notices,current)
      did -a $dname 4 $!
      dialog -v $dname
    }    
    ;; Clear Nick Button
    elseif ($did == 5) {
      hfree notices. [ $+ [ $did($dname,4).seltext ] ]
      did -d $dname 4 $did($dname,4).sel
    }    
    ;; Send Button
    elseif ($did == 7) {
      notice $hget(notices,current) $did($dname,6).text
      hadd -m notices. [ $+ [ $hget(notices,current) ] ] $calc($hget(notices. [ $+ [ $hget(notices,current) ] ],0).item + 1) $+([,$asctime(hh:nn),]) $hget(notices,current) $did($dname,6).text
      did -a $dname 1 $+([,$asctime(hh:nn),]) $hget(notices,current) $did($dname,6).text
    }    
    ;; AltScripts Link
    elseif ($did == 8) {
      url -n http://www.altscripts.net
    }
    ;; Close Link
    elseif ($did == 10) {
      dialog -x $dname
    }    
  }
  ;; Double Click Events
  elseif ($devent == dclick) {
    ;; Nick Selection
    if ($did == 4) {
      hadd -m notices current $did($dname,$did).seltext
      did -ra $dname 2 Conversation with $hget(notices,current)
      did -r $dname 1
      var %i = 0
      while (%i < $hget(notices. [ $+ [ $did($dname,$did).seltext ] ],0).item) {
        inc %i      
        did -a $dname 1 $hget(notices. [ $+ [ $did($dname,$did).seltext ] ],%i)
      }
    }
  }
}
on *:NOTICE:*:?:{
  if ($dialog(nthing)) {
    if ($nick == $hget(notices,current)) {
      did -a nthing 1 $+([,$asctime(hh:nn),]) $nick $strip($1-)
    }
    if (!$hfind(notices,$nick).data) {
      hadd -m notices $hget(notices,0).data $nick
      did -a nthing 4 $nick
    }
    hadd -m notices. [ $+ [ $nick ] ] $calc($hget(notices. [ $+ [ $nick ] ],0).item + 1) $+([,$asctime(hh:nn),]) $nick $strip($1-)
    echo -a 04 New Notice From $nick
    haltdef
  }
}