Robot d'animation en socket

Description

C'est un robot d'animation classique, sauf qu'il est en sockets. Ce qui rend ça plus interessant et qui évites d'ouvrir un autre mIRC. Merci à DixrouE pour son tuto pour les sockets :o)

Source / Exemple :


Menu menubar,channel {
  -
  A&nimation
  .&Réponses:sautos
  .&Config:sanim
  .-
  .&Connecter:naz-con
  .&Déconnecter:naz-dec
  .-
  .C&ontacts
  ..&Site:run http://Naika.tk
  ..&Mail: run mailto:Nazario@SexMagnet.com?Subject= $+ $me
  -
}
On 1:load:{
echo -a 2Add-on bien chargé.
echo -a 2By Nazario...
sanim
}
alias naztxt { return Anim/infos.naz }
alias naz.code { return $read($naztxt ,5) }
alias naz.chan { return $read($naztxt, 1) }
alias naz.me { return $read($naztxt, 2) }
alias naz.serv { return $read($naztxt, 3) }
alias naz.port { return $read($naztxt, 4) }
alias naz-con {
  if $chr(35) !isin $naz.chan { var %x = $input(Tu as mal configuré ! $crlf $+ Salon rentré correctement! $crlf $+ Vérifie qu'il y a le $chr(35) !,300,Erreur) | sanim }
  else { sockopen nazsock $naz.serv $naz.port
  }
}
alias naz-dec { sockclose nazsock !! }
on *:sockopen:nazsock:{
  if ($sockerr) { echo -a $naz.code Erreur... | return }
  sockwrite -n nazsock NICK $naz.me
  sockwrite -n nazsock USER Naz Naz Naz : $+ $nazcode Animation - Socketz
  sockwrite -n nazsock JOIN $naz.chan
}
on *:sockread:nazsock:{
  sockread %naz.infos 
  if PRIVMSG isin %naz.infos { 
    set %naz.infos %naz.infos XXX | var %i 1 
    while %i <= $lines(Anim/mots.naz) { 
      if $gettok($read(Anim/mots.naz ,%i),1,44)  isin %naz.infos  {
        if .txt isin $read(Anim/mots.naz ,%i) { set %xxx $chr(36) $+ read( $+ $gettok($read(Anim/mots.naz,%i),2,44) $+ ) | sockwrite -n nazsock PRIVMSG $naz.chan : $eval(%xxx ,2) | halt }
        sockwrite -n nazsock PRIVMSG $naz.chan : $gettok($read(Anim/mots.naz ,%i),2,44)
      }
      inc %i
    }
} } }
alias sanim { dialog -m sanim sanim }
dialog sanim {
  title Animation Socket 
  size -1 -1 170 220
  box &Salon ,1,5 2 160 65
  edit $naz.chan ,2, 10 20 150 17, autohs center
  text Rentres le nom du salon . $crlf $+ Avec le $chr(35) (sinon marche pas),3, 10 40 150 30, center
  box &Pseudo,4, 5 70 160 40
  edit $naz.me ,5, 10 85 150 17, autohs center
  box &Serveur et Port,6, 5 110 160 40
  edit $naz.serv,7, 10 125 110 17, autohs center
  edit $naz.port,8, 120 125 40 17, autohs center
  button &Réponses,9, 3 195 55 20 
  button &Connection,10, 61 195 60 20
  button &Fermer,11, 125 195 43 20,ok
  box &Couleurs,12, 5 150 160 40
  edit $naz.code,13, 10 165 50 17, center autohs
  text &Code de couleurs devant les phrases.,14, 60 160 100 30, center
}
On 1:dialog:sanim:*:*:{
  if $devent = init { dll Anim\dlls\mdx.dll SetMircVersion $version |  dll Anim\dlls\mdx.dll MarkDialog sanim | dll Anim\dlls\mdx.dll SetFont 1,2,3,4,5,6,7,8,9,10,11,12,13,14 12 500 tahoma |  dll Anim\dlls\mdx.dll SetBorderStyle 2,5,7,8,13 border  }
  if $devent = edit {
    if $did = 2 { write -l1 $naztxt $did(2) } | if $did == 5 { write -l2 $naztxt $did(5) } | if $did == 7 { write -l3 $naztxt $did(7) } | if $did == 8 { write -l4 $naztxt $did(8)  } | if $did == 13 { write -l5 $naztxt $did(13) }
  }
  if $devent = sclick {
    if $did = 9 { sautos } | if $did == 10 { .timer -mh 1 50 dialog -x $dname | naz-con } 
} }
alias sautos { dialog -m sautos sautos }
dialog sautos {
  size -1 -1 200 195
  title Réponses automatiques
  list 1, 5 5 190 150, size
  button Ajouter,2, 7 165 50 20
  button Effacer,3, 72 165 50 20
  button Astuce,5, 137 165 50 20
  text Réponse :,6, 10 200 70 14
  edit "",7, 65 200 100 14,autohs
  button ...,8, 175 200 20 14
  text Au mot :,9, 10 220 70 14
  edit "",10, 65 220 100 14,autohs
  button Ok,11, 175 220 20 14
}
on 1:dialog:sautos:*:*:{
  if $devent = init {
    dll Anim\dlls\mdx.dll SetMircVersion $version |  dll Anim\dlls\mdx.dll MarkDialog sautos |  dll Anim\dlls\mdx.dll SetBorderStyle 1,7,10 border | dll Anim\dlls\mdx.dll SetFont 1,2,3,5,6,7,8,9,10,11 12 500 tahoma 
    dll Anim\dlls\mdx.dll SetControlMDX $dname 1 listview nosortheader rowselect showsel single flatsb headerdrag labeltip report > Anim\dlls\views.mdx | did -i $dname 1 1 headerdims 70 120 | did -i $dname 1 1 headertext Mots $chr(9) Réponses
    var %i 1 | while %i <= $lines(Anim/mots.naz) { | did -a $dname 1 $gettok($read(Anim/mots.naz,%i),1,44) $chr(9) $nopath($gettok($read(Anim/mots.naz,%i),2,44)) | inc %i }
  }
  if $devent = sclick {
    if $did = 5 { var %x $input(Si tu souhaites avoir des réponses automatiques $+ $chr(44) entres un chemin vers un fichier texte dont ils y aura les réponses.,300,Astuce) }
    if $did = 2 { dialog -s $dname -1 -1 200 240 | did -b $dname 2 }
    if $did = 3 && $did(1).sel { write -dl $+ $calc($did(1).sel - 1) Anim/mots.naz | did -d $dname 1 $did(1).sel }
    if $did = 8 { did -ra $dname 7 $dir="Séléctionnes le fichier texte)" Anim/Textes/*.txt }
    if $did = 11 && $did(7) && $did(10) { write Anim/mots.naz $did(10) $+ , $+ $did(7) | did -a $dname 1 $did(10) $chr(9) $did(7) | dialog -s $dname -1 -1 200 195 | did -e $dname 2 | did -ra $dname 7,10 $chr(32) }
} }

Conclusion :


J'ai mit le code mais c'est mieux de dl le zip :p

Codes Sources

A voir également