Away system (snippet hashtables)

Contenu du snippet

Ceci est un simple system d'away sans aucune prétention. Comme souvent je vois sur les chans d'aide au scripting mIRC des demandes concernant les hashtables, en voici un exemple qui reste simple et je l'espère à la portée de tous.

Source / Exemple :


alias u { return $+($chr(31),$1,$chr(31)) }
alias b { return $+($chr(2),$1,$chr(2)) }
alias c { return $+($+($chr(3),$1),$2,$chr(3)) }

menu * { 
  Away:/aw 
}
alias aw dialog -m away away
dialog away {
  title "Away system"
  size -1 -1 120 90
  option dbu
  box "", 13, 1 -1 118 89
  text "Away by tofu\\\\\\\\", 1, 40 76 117 8, disable nowrap center
  text "Raison:", 2, 3 4 18 8
  text "Nick Away:", 3, 3 15 27 8
  edit "" 4,35 4 80 8, autohs limit 900
  edit "" 5,35 15 60 8, autohs limit 900
  text "Nick Retour:", 6,3 45 45 8
  edit "" 7, 35 45 60 8, autohs limit 900
  button "Away Server Actif", 8,5 28 50 10, flat
  button "Away Multi Server", 9,65 28 50 10, flat
  button "Retour Server Actif", 10, 5 60 50 10, flat
  button "Retour Multi Server", 11,65 60 50 10, flat
  button "Fermer", 12, 5 75 37 10, cancel
  check "Logger", 14, 50 75 25 10
}

on *:DIALOG:away:*:*:{
  if ($devent == init) { if (!$hget(away)) { hmake away } | if ($hget(away,log) == 1) { did -c $dname 14 1 } }
  if ($devent == edit) {
    if ($did == 4) { hadd away awraison $did($dname,4) }
    if ($did == 5) { hadd away awnick $did($dname,5) }
    if ($did == 7) { hadd away awrenick $did($dname,7) }
  }
  if ($devent == sclick) {
    if ($did == 8) { away $+($c(3,A),$c(12,way),:) $hget(away,awraison) | ame is $+(away,$chr(40),$hget(away,awraison) ,$chr(41)) | nick $hget(away,awnick) }
    if ($did == 9) {
      set %x 1
      while (%x <= $scon(0)) {
        scon %x
        away $+($c(3,A),$c(12,way),:) $hget(away,awraison)
        ame is $+(away,$chr(40),$hget(away,awraison) ,$chr(41))
        nick $hget(away,awnick)
        inc %x
      } 
    }
    if ($did == 10) { away | ame est de retour $+(de,$chr(40),$hget(away,awraison),$chr(92),$duration($awaytime),$chr(41)) | nick $hget(away,awrenick) | hfree away }
    if ($did == 11) {
      set %x 1
      while (%x <= $scon(0)) {
        scon %x
        away
        ame est de retour $+(de,$chr(40),$hget(away,awraison),$chr(92),$duration($awaytime),$chr(41))
        nick $hget(away,awrenick)
        inc %x
      }
      hfree away
    }
    if ($did($dname,14).state == 1) { window -ake @awlog | hadd away log 1 } 
    if ($did($dname,14).state == 0) { if ($hget(away)) { hdel away log } } 
  }
}
on *:text:*:*:{ if ($away) && ($hget(away,log) == 1) { if ($me isin $1-) { $iif($1- isin $chan,aline @awlog $timestamp $+($c(4,$b($chr(40))),$c(11,$chan),$c(11,$chr(92)),$c(11,$u($server)),$c(4,$b($chr(41)))) $c(7,$nick) $+ $c(11,:) $1-,aline @awlog $timestamp $+($c(4,$b($chr(40))),$c(11,PMSG),$c(11,$chr(92)),$c(11,$u($server)),$c(4,$b($chr(41)))) $c(7,$nick) $+ $c(11,:) $1-) } } }
on *:action:*:*:{ if ($away) && ($hget(away,log) == 1) { if ($me isin $1-) { $iif($1- isin $chan,aline @awlog $timestamp $+($c(4,$b($chr(40))),$c(11,$chan),$c(11,$chr(92)),$c(11,$u($server)),$c(4,$b($chr(41)))) $c(0,->) $c(7,$nick) $+ $c(11,:) $1-,aline @awlog $timestamp  $+($c(4,$b($chr(40))),$c(11,PMSG),$c(11,$chr(92)),$c(11,$u($server)),$c(4,$b($chr(41)))) $c(0,->) $c(7,$nick) $+ $c(11,:) $1-) } } }
on *:notice:*:*:{ if ($away) && ($hget(away,log) == 1) { aline  @awlog $timestamp Notice: $+($c(4,$b($chr(40))),$c(11,$chan),$c(11,$chr(92)),$c(11,$u($server)),$c(4,$b($chr(41)))) $c(7,$nick) $+ $c(11,:) $1- } }

Conclusion :


à+ :)
si vous voulez voir le code sans qu'il soit coupé allez ici:
http://membres.lycos.fr/xdbconcept/scripting/away.txt

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.