Communauté Eggdrop
[Tuto] Coder proprement un script en TCL - Version imprimable

+- Communauté Eggdrop (https://forum.eggdrop.fr)
+-- Forum : Eggdrop et scripts (https://forum.eggdrop.fr/forumdisplay.php?fid=8)
+--- Forum : F.A.Q. (https://forum.eggdrop.fr/forumdisplay.php?fid=9)
+--- Sujet : [Tuto] Coder proprement un script en TCL (/showthread.php?tid=634)

Pages : 1 2


RE: [Tuto] Coder proprement un script en TCL - Ahinu - 06/12/2012

personnelement j'utilise la syntaxe US pour codé c'est à dire qu'a chaque { je tab sous vim
le code est plus aéré je trouve et beaucoup plus plaisant à la lecture, j'ai déjà codé avec des "porcs" et je trouve sa ultra dégelasse !
à ne pas faire

Code :
bind dcc - xwhois xwhois:dcc proc xwhois:dcc {hand idx arg} { global irc botnick if {[matchattr $hand n] || [matchattr $hand A]} { set irc(whois:idx) $idx; set irc(whois:hand) $hand; set irc(cmd) "xwhois"; set user [lindex $arg 0] if {$user==""} { putdcc $idx "\2.xWhois\2 <tChatteur>"; return 0 } send ":$irc(uworld:nick) WHOIS $user" } else { avertdcc $hand } }

la syntaxe que j'applique
Code :
bind dcc - xwhois xwhois:dcc proc xwhois:dcc {hand idx arg} { global irc botnick if {[matchattr $hand n] || [matchattr $hand A]} { set irc(whois:idx) $idx set irc(whois:hand) $hand set irc(cmd) "xwhois" set user [lindex $arg 0] if {$user==""} { putdcc $idx "\2.xWhois\2 <tChatteur>"; return 0 } send ":$irc(uworld:nick) WHOIS $user" } else { avertdcc $hand } }

Voilà pour ma part sur les bind, sinon mon en tête ressemble à:

Code :
#~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ # # * Uworld.tcl pour ircu2.10.* - 2012 # # * @autor: Trenks <trenks@stark-network.fr # # * @category: IRC/services # # * @version 0.1 # # * @Protection: Gnu/GPL # # # # * Introduction: # # ------------------------ # # Service permetant de géré un ircu2.10 maniere definitive # # Ce service requiere les package tcl tcl-dev & mysqltcl # # Pour toute modification merci de demander la permission # # sur le mail indiqué ci-dessus # # ------------------------ # # * @Service: Pooshy # # * @Base du link: ircu.doc # putlog "\2Pooshy.tcl\2 by Tr€nKs" #~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~#

Parcontre le C/c de vim sous le forum fait moche !