Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

AWAY SYSTEM (SNIPPET HASHTABLES)


Information sur la source

Catégorie :Tutoriaux Niveau : Débutant Date de création : 02/01/2004 Date de mise à jour : 02/01/2004 20:36:49 Vu : 3 071

Note :
8,29 / 10 - par 7 personnes
8,29 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

Commentaire sur cette source (10)
Ajouter un commentaire et/ou une note

Description

Cliquez pour voir la capture en taille normale
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

  • 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- } }
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
 

Commentaires et avis

signaler à un administrateur
Commentaire de t0nt0n le 02/01/2004 19:09:29

Vu et revu pour l'add on en lui même, pour le codage, c'est pas mal du tout:
6/10.

signaler à un administrateur
Commentaire de ReMi34 le 02/01/2004 19:11:51

Idem

signaler à un administrateur
Commentaire de tofu le 02/01/2004 19:47:44

je sais que le principe de "l'away system" est est vu et revu, mais je voulais juste montrer que on peut éviter d'utiliser des variables ou .ini trop souvent utilisé tout en restant dans un code assez simple et puis en meme temps sa montre comment faire une action en "multiserver" donc voila ;)

signaler à un administrateur
Commentaire de Kolibot le 02/01/2004 19:55:58

Je trouve que la 5 on de la fin de ton script sont véritablement simplifiable... dans la mesure ou très peu de paramètres changent...

Un Petit alias avec quelques $iif pourrait faire l'affaire...

Sinon c'est bien scripter ... le dialog est struturé, et l'utilisation des htables est vraiment un bon atout !! Je te mets 7/10

signaler à un administrateur
Commentaire de tofu le 02/01/2004 20:09:49

oui, je vais voir pour améliorer sa :)

signaler à un administrateur
Commentaire de tofu le 02/01/2004 20:37:45

voila, je viens de modifier lese "on" donc il en reste 3 au lieu de 5 au départ, si l'on peut encore raccourcir dites le moi ;)

signaler à un administrateur
Commentaire de vesparo le 03/01/2004 14:31:56

et ben moi je t'ai deja dit ce que je penser :)
8/10 bon travail :D

signaler à un administrateur
Commentaire de AxeL364 le 03/01/2004 17:23:12

Cool :) ca va m'aider dans mon script !

10/10

iNsAnE_aXeL

signaler à un administrateur
Commentaire de Sun-Burst le 05/01/2004 20:13:28

C'est comme joliement bien fait tout ca :)

signaler à un administrateur
Commentaire de tofu le 05/01/2004 21:33:40

merci ;)

Ajouter un commentaire



Nos sponsors

Sondage...

CalendriCode

Janvier 2009
LMMJVSD
   1234
567891011
12131415161718
19202122232425
262728293031 

Consulter la suite du CalendriCode



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel BAÏSE, Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,468 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.