Bonjour,
donc j'ai codé un bot anim avec diverses commandes qui fonctionnent très bien i compris au niveau des couleurs.
Mon problème est que j'essai de le modifier, quand mes users tape !biere pseudo sa fonctionne en revanche quand ils tapent juste !biere sa fonctionne pas correctement.
Je met un exemple:
Code :
[15:08:19] ‹AngeDesOmbres› !biere
[15:08:20] ‹+OsiriS› AngeDesOmbres offre une bonne bière bien fraiche à .
[15:08:32] ‹AngeDesOmbres› !biere Aragorn
[15:08:33] ‹+OsiriS› AngeDesOmbres offre une bonne bière bien fraiche à Aragorn .
Donc voila sa remet la même phrase à chaque fois...
J'ai tenté de modifier mon code de cette façon (j'ai pas mis toute les commandes d'animations)
se que j'aimerai c'est quand l'user tape !biere sans le pseudo d'une personne sa renvoie la phrase : se décapsule une bonne bière bien fraiche.
Et quand il rajoute le pseudo sa renvoie la phrase : offre une bonne biere bien fraiche à ...
Voila le code modifier
tclcopier
bind pubm - * pub:animation
proc pub:animation { nick uhost handle chan arg } {
set arg [ stripcodes bcruag $arg ]
set commande [ lindex $arg 0 ]
switch -- $commande {
"!cmd" { putquick "NOTICE $nick :\0 032Pour faire fonctionner les commandes il faut taper de la maniere suivante !cmd pseudo ( exemple: !bierre Hathor )"
putquick "NOTICE $nick :\0 031Les commandes\0 0312 !acro !story !invoque !vdm et !couple\0 031 sont a taper en noir !"
putquick "NOTICE $nick :\0 036Voici les commandes de OsiriS"
putquick "NOTICE $nick :\0 037Les commandes barman:"
putquick "NOTICE $nick :\0 0312!biere\0 034 !coca\0 0312 !sky\0 034 !cafe\0 0312 !champagne"
putquick "NOTICE $nick :\0 037Les commandes love:"
putquick "NOTICE $nick :\0 0312!kiss\0 034 !palo\0 0312 !love\0 034 !calin\0 0312 !rose\0 034 !sexy\0 0312 !plotte"
putquick "NOTICE $nick :\0 037Les commandes violantes:"
putquick "NOTICE $nick :\0 0312!fouette\0 034 !baffe\0 0312 !relou\0 034 !vanne\0 0312 !cb\0 034 !pelle"
putquick "NOTICE $nick :\0 037Les commandes diverses:"
putquick "NOTICE $nick :\0 0312!clope \0 034!acro \0 0312!story \0 034!vdm \0 0312!invoque (phrase) (pseudo) \0 034!couple (pseudo) (pseudo)"
putquick "NOTICE $nick :\0 037Les commandes concernant le site"
putquick "NOTICE $nick :\0 0312!site \0 034!stats"
putquick "NOTICE $nick :\0 036Fin des commandes de OsiriS"
putquick "NOTICE $nick :\0 032OsiriS a été crée par AngeDesOmbres pour TchaT-Ever." }
"!biere" { putquick "PRIVMSG $chan :\0 037$nick \0 0312se décapsule une bonne bière bien fraiche."
} else {
"PRIVMSG $chan :\0 037$nick \0 0312offre une bonne bière bien fraiche à\0 034 [lrange $arg 1 end] \0 0312." }
}
}
et voila se qu'il se passe quand je tape !biere :
Code :
[15:17:09] ‹AngeDesOmbres› !biere
[15:17:11] ‹+OsiriS› AngeDesOmbres s'offre une bonne bière bien fraiche.
[15:17:25] ‹AngeDesOmbres› !biere Aragorn
[15:17:26] ‹+OsiriS› AngeDesOmbres s'offre une bonne bière bien fraiche.
Sa répète de nouveau la même phrase...
Je ne voit pas comment faire :s
Merci de votre aide future.
Cordialement.
Salut,
Je pense faudrais voir au niveau : rand
Si ça peut t'aider.
Exemple :
tclcopier
set ::phrase [ lindex $ ::phrases [ rand [ llength $ ::phrases ] ] ]
putserv "PRIVMSG $chan :\0 031 $nick: \0 034 $::phrase\0 031"
Si tu as :
tclcopier
set ::phrases {
"Blabla"
"autreblabla"
}
Enfin c'est une idée..
A mon avis, revoir un peu le contrôle
switch pourrait aider. Ou même apprendre le "If".
Si je résume:
tclcopier
switch -- $commande {
"!biere" {
putquick "PRIVMSG $chan :\0 037$nick \0 0312se décapsule une bonne bière bien fraiche."
} else {
"PRIVMSG $chan :\0 037$nick \0 0312offre une bonne bière bien fraiche à\0 034 [lrange $arg 1 end] \0 0312."
}
Je suis même étonné que tu n'ais pas d'erreur de compilation.
Je te laisse trouver tes erreurs
Bonsoir,
CrazyCat en se qui concerne le if je pense que sa doit etre quelque chose comme ça
après en se qui concerne l'erreur du contrôle switch je ne vois pas comment faire... mais je continu a cherché si il était possible de me mètre sur la voie sa serait cool.
Merci d'avance.
Cordialement.
Ou comme ça je pense.
De plus j'aurait fait mes set différament..
Exemple :
tclcopier
set arg [ filter $arg ]
set commande [ lindex $arg 1 ]
set commande [ stripcodes abcu [ lindex $arg 0 ] ]
Avec Une proc filter qui donnerais :
tclcopier
proc filter { arg} {
regsub -all -- \\\\ $arg \\\\\\\\ arg
regsub -all -- \\\[ $arg \\\\\[ arg
regsub -all -- \\\] $arg \\\\\] arg
regsub -all -- \\\} $arg \\\\\} arg
regsub -all -- \\\{ $arg \\\\\{ arg
regsub -all -- \\\" $arg \\ \\ \" arg
return $arg
}
Moi J'avais fait un switch sur un tcl regarde ce que j'avais fait ceci était en msg mais tu peut t'en inspirer
tclcopier
# Help #
proc help { nick host hand arg } {
set arg [ gbfilter $arg ]
set commande [ lindex $arg 1 ]
set commande [ stripcodes abcu [ lindex $arg 0 ] ]
if { $commande == "" } {
puthelp "privmsg $nick :\0 0314Commande Help du Robot \0 02\0 034$::botnick\0 02\0 034"
foreach c [ channels] {
if [ matchattr $hand o|o $c ] {
puthelp "privmsg $nick :\0 031\0 37Level \0 02Opérateur\0 02 :\0 037"
puthelp "privmsg $nick :\0 0314Auth \0 031: \0 034Permet de vous identifier auprès du Robot Identifia en MSG !"
puthelp "privmsg $nick :\0 0314Op \0 031: \0 034Permet de te mettre Opérateur \0 031(\0 0312@\0 031) \0 034 sur le salon ou en Msg, et pour le faire sur quelqu'un aussi !"
puthelp "privmsg $nick :\0 0314Deop \0 031: \0 034Permet de te mettre Deop \0 031(\0 0312-@\0 031) \0 034 sur le salon ou en Msg, et pour le faire sur quelqu'un aussi !"
puthelp "privmsg $nick :\0 0314Halfop \0 031: \0 034Permet de te mettre Halfop \0 031(\0 0312%\0 031) \0 034 sur le salon , et pour le faire sur quelqu'un aussi !"
puthelp "privmsg $nick :\0 0314Dehalfop \0 031: \0 034Permet de te mettre Dehalfop \0 031(\0 0312-%\0 031) \0 034 sur le salon , et pour le faire sur quelqu'un aussi !"
puthelp "privmsg $nick :\0 0314Voice \0 031: \0 034Permet de te mettre voice \0 031(\0 033+v\0 031) \0 034 sur le salon ou en Msg, et pour le faire sur quelqu'un aussi !"
puthelp "privmsg $nick :\0 0314Devoice \0 031: \0 034Permet de te mettre Devoice \0 031(\0 033-v\0 031) \0 034 sur le salon ou en Msg, et pour le faire sur quelqu'un aussi !"
puthelp "privmsg $nick :\0 0314Kick \0 031: \0 034Permet de Kick quelqu'un sur un salon défini commande Chan ou Msg !"
puthelp "privmsg $nick :\0 0314Kickban \0 031: \0 034Permet de Kickban quelqu'un sur un salon défini commande Chan ou Msg !"
puthelp "privmsg $nick :\0 0314Ban \0 031: \0 034Permet de Ban quelqu'un sur un salon défini commande Chan ou Msg !"
puthelp "privmsg $nick :\0 0314Unban \0 031: \0 034Permet de Unban quelqu'un sur un salon défini commande Chan ou Msg !"
puthelp "privmsg $nick :\0 0314Access \0 031: \0 034Permet de regarder la liste d'acces command Msg !"
puthelp "privmsg $nick :\0 0314Deauth \0 031: \0 034Permet de vous déauthentifier auprès du Robot $::botnick commande Msg !"
puthelp "privmsg $nick :\0 0314Newpass \0 031: \0 034Permet de changer votre mot de passe auprès du Robot $::botnick commande Msg !"
puthelp "privmsg $nick :\0 0314Infoline \0 031: \0 034Permet de vous mettre un texte à l'entrée d'un salon commande Msg !"
puthelp "privmsg $nick :\0 0314Topic \0 031: \0 034Permet de mettre un topic sur un salon défini commande Chan ou Msg !"
puthelp "privmsg $nick :\0 0314Authlist \0 031: \0 034Permet de regarder qui est authentifié auprès du Robot $::botnick commande Msg !"
puthelp "privmsg $nick :\0 0314Say \0 031: \0 034Permet d'envoyer un message sous forme de /say sur un salon défini commande Msg !"
puthelp "privmsg $nick :\0 0314Me \0 031: \0 034Permet d'envoyer un message sous forme de /me sur un salon défini commande en Msg !"
break
}
}
foreach c [ channels] {
if [ matchattr $hand o|m $c ] {
puthelp "privmsg $nick :\0 031\0 37Level \0 02Master\0 02 :\0 37"
puthelp "privmsg $nick :\0 0314Addop \0 031: \0 034Permet de mettre un user Opérateur sur un salon défini commande Chan ou Msg !"
puthelp "privmsg $nick :\0 0314Delop \0 031: \0 034Permet de retirer le level Opérateur sur un salon défini commande Chan ou Msg !"
puthelp "privmsg $nick :\0 0314Clearbans \0 031: \0 034Permet de Clearbans tout les bans sur le salon commande Chan ou Msg !"
puthelp "privmsg $nick :\0 0314Mode \0 031: \0 034Permet de mettre ou retirer un Mode commande Chan ou Msg !"
puthelp "privmsg $nick :\0 0314Opall \0 031: \0 034Permet de mettre tout le monde Op commande Chan ou Msg !"
puthelp "privmsg $nick :\0 0314Deopall \0 031: \0 034Permet de mettre tout le monde Deop commande Chan ou Msg !"
puthelp "privmsg $nick :\0 0314Halfopall \0 031: \0 034Permet de mettre tout le monde Halfop commande Chan !"
puthelp "privmsg $nick :\0 0314Dehalfop \0 031: \0 034Permet de mettre tout le monde Dehalfop commande Chan !"
puthelp "privmsg $nick :\0 0314Voiceall \0 031: \0 034Permet de mettre tout le monde Voice commande Chan ou Msg !"
puthelp "privmsg $nick :\0 0314Devoiceall \0 031: \0 034Permet de mettre tout le monde Devoice commande Chan ou Msg !"
break
}
}
foreach c [ channels] {
if [ matchattr $hand o|n $c ] {
puthelp "privmsg $nick :\0 031\0 37Level \0 02Owner\0 02 :\0 37"
puthelp "privmsg $nick :\0 0314Addmaster \0 031: \0 034Permet de mettre un user ou un Opérateur d'un salon le level Master commande Msg !"
puthelp "privmsg $nick :\0 0314Delmaster \0 031: \0 034Permet de retirer le level Master sur un salon défini commande Msg !"
puthelp "privmsg $nick :\0 0314Amsg \0 031: \0 034Permet de faire un Amsg sur tout les salons où se situe $::botnick commande Chan seulement sur $::GB::log Il faut taper la commande sinon cela ne fonctionne pas !"
break
}
}
foreach c [ channels] {
if [ matchattr $hand o $c ] {
puthelp "privmsg $nick :\0 031\0 37Level \0 02SuperOp\0 02 :\0 37"
puthelp "privmsg $nick :\0 0314Delowner \0 031: \0 034Permet de retirer le level Owner sur un salon défini commande Msg !"
puthelp "privmsg $nick :\0 0314Exempt \0 031: \0 034Permet de mettre/retirer/regarder les pseudos protégés commande Chan !"
puthelp "privmsg $nick :\0 0314Blacklist \0 031: \0 034Permet de mettre/retirer/regarder la Blacklist commande Chan !"
puthelp "privmsg $nick :\0 0314Addsuspend \0 031: \0 034Permet de suspendre un accéss commande Msg !"
puthelp "privmsg $nick :\0 0314Delsuspend \0 031: \0 034Permet de retirer un suspend commande Msg !"
puthelp "privmsg $nick :\0 0314Addchan \0 031: \0 034Permet de rajouter un autojoin sur un salon au bot commande Msg !"
puthelp "privmsg $nick :\0 0314Delchan \0 031: \0 034Permet de retirer un salon des autojoin au bot commande Msg !"
puthelp "privmsg $nick :\0 0314Listchan \0 031: \0 034Permet de regarder la liste des chan en autojoin qu'il y a dans $::botnick commande Msg !"
puthelp "privmsg $nick :\0 0314Addowner \0 031: \0 034Permet de mettre un user ou Opérateur ou un Master le level Owner commande Msg !"
puthelp "privmsg $nick :\0 0314Addsuperop \0 031: \0 034Permet de mettre un user ou Opérateur ou Master ou Owner le level SuperOp commande Msg !"
puthelp "privmsg $nick :\0 0314Delsuperop \0 031: \0 034Permet de retirer le level SuperOp commande Msg !"
puthelp "privmsg $nick :\0 0314Gbon \0 031: \0 034Permet d'activer le TCL sur un salon défini commande Chan !"
puthelp "privmsg $nick :\0 0314Gboff \0 031: \0 034Permet de désactiver le TCL sur un salon défini commande Chan !"
break
}
}
puthelp "privmsg $nick :\0 0314Exemple de commande à taper pour avoir de l'aide plus détaillée\0 0314"
puthelp "privmsg $nick :\0 034/msg $::botnick help op\0 034"
puthelp "privmsg $nick :\0 031\[ \0 034Info\0 031\] \0 0314Toutes les commandes sont a taper en \0 02\0 031(Minuscules)\0 02"
puthelp "privmsg $nick :\0 031\0 37\0 02Fin du Help !\0 02"
puthelp "privmsg $GB::log :\0 0314Commande \0 036\[ \0 033Help\0 036\] \0 031par : \0 034$hand"
}
switch -- $commande {
"op" {
puthelp "privmsg $nick :\0 0314Commande Op Chan \0 031: \0 034$::GB::commande(choix)op \0 031ou \0 034$::GB::commande(choix)op <pseudo>"
puthelp "privmsg $nick :\0 0314Commande Op Msg \0 031: \0 034/msg $::botnick op <#salon> \0 031ou \0 034/msg $::botnick op <#salon> <pseudo>"
}
"deop" {
puthelp "privmsg $nick :\0 0314Commande Deop Chan \0 031: \0 034$::GB::commande(choix)deop \0 031ou \0 034$::GB::commande(choix)deop <pseudo>"
puthelp "privmsg $nick :\0 031Commande Deop Chan \0 031: \0 034/msg $::botnick deop <#salon> \0 031ou \0 034/msg $::botnick deop <#salon> <pseudo>"
}
"voice" {
puthelp "privmsg $nick :\0 0314Commande Voice Chan \0 031: \0 034$::GB::commande(choix)voice \0 031ou \0 034$::GB::commande(choix)voice <pseudo>"
puthelp "privmsg $nick :\0 0314Commande Voice Msg \0 031: \0 034/msg $::botnick <voice> <#salon> \0 031ou \0 034/msg $::botnick <voice> <#salon> <pseudo>"
}
"devoice" {
puthelp "privmsg $nick :\0 0314Commande Devoice Chan \0 031: \0 034$::GB::commande(choix)devoice \0 031ou \0 034$::GB::commande(choix)devoice <pseudo>"
puthelp "privmsg $nick :\0 0314Commande Devoice Msg \0 031: \0 034/msg $::botnick <devoice> <#salon> \0 031ou \0 034/msg $::botnick devoice <#salon> <pseudo>"
}
"halfop" {
puthelp "privmsg $nick :\0 0314Commande Halfop Chan \0 031: \0 034$::GB::commande(choix)halfop \0 031ou \0 034$::GB::commande(choix)halfop <pseudo>"
}
"dehalfop" {
puthelp "privmsg $nick :\0 0314Commande Dehalfop Chan \0 031: \0 034$::GB::commande(choix)dehalfop \0 031ou \0 034$::GB::commande(choix)dehalfop <pseudo>"
}
"halfopall" {
puthelp "privmsg $nick :\0 0314Commande Halfopall Chan \0 031: \0 034$::GB::commande(choix)halfopall \0 031ou \0 034$::GB::commande(choix)halfopall <pseudo>"
}
"dehalfopall" {
puthelp "privmsg $nick :\0 0314Commande Dehalfopall Chan \0 031: \0 034$::GB::commande(choix)dehalfopall \0 031ou \0 034$::GB::commande(choix)dehalfopall <pseudo>"
}
"kick" {
puthelp "privmsg $nick :\0 0314Commande Kick Chan \0 031: \0 034$::GB::commande(choix)kick <pseudo> \0 031ou \0 034$::GB::commande(choix)kick <pseudo> <raison>"
puthelp "privmsg $nick :\0 0314Commande Kick Msg \0 031: \0 034/msg $::botnick kick <#salon> <pseudo> \0 031ou \0 034/msg $::botnick kick <#salon> <pseudo> <raison>"
}
"kickban" {
puthelp "privmsg $nick :\0 0314Commande Kickban Chan \0 031: \0 034$::GB::commande(choix)kickban <pseudo>"
puthelp "privmsg $nick :\0 0314Commande Kickban Msg \0 031: \0 034/msg $::botnick kickban <#salon> <pseudo>"
}
"ban" {
puthelp "privmsg $nick :\0 0314Commande Ban Chan \0 031: \0 034$::GB::commande(choix)ban <pseudo> \0 031ou \0 034$::GB::commande(choix)ban <host>"
puthelp "privmsg $nick :\0 0314Commande Ban Msg \0 031: \0 034/msg $::botnick ban <#salon> <host>"
}
"unban" {
puthelp "privmsg $nick :\0 0314Commande Unban Chan \0 031: \0 034$::GB::commande(choix)unban <pseudo> \o u \0 034$::GB::commande(choix)unban <host>"
puthelp "privmsg $nick :\0 0314Commande Unban Msg \0 031: \0 034/msg $::botnick unban <#salon> <host>"
}
"access" {
puthelp "privmsg $nick :\0 0314Commande Access Msg \0 031: \0 034/msg $::botnick access <#salon> * \0 031ou \0 034/msg $::botnick access <#salon> al* \0 037Ceci et un exemple le al* cherchera tout les access ayant dans le pseudo (al)"
}
"addop" {
puthelp "privmsg $nick :\0 0314Commande Addop Msg \0 031: \0 034/msg $::botnick addop <pseudo> <#salon>"
}
"addmaster" {
puthelp "privmsg $nick :\0 0314Commande Addmaster Msg \0 031: \0 034/msg $::botnick addmaster <pseudo> <#salon>"
}
"addowner" {
puthelp "privmsg $nick :\0 0314Commande Addowner Msg \0 031: \0 034/msg $::botnick addowner <pseudo> <#salon>"
}
"delop" {
puthelp "privmsg $nick :\0 0314Commande Delop Msg \0 031: \0 034 /msg $::botnick delop <pseudo> <#salon>"
}
"delmaster" {
puthelp "privmsg $nick :\0 0314Commande Delmaster Msg \0 031: \0 034/msg $::botnick delmaster <pseudo> <#salon>"
}
"delowner" {
puthelp "privmsg $nick :\0 0314Commande Delowner Msg \0 031: \0 034/msg $::botnick delowner <pseudo> <#salon>"
}
"clearbans" {
puthelp "privmsg $nick :\0 0314Commande Clearbans Chan \0 031: \0 034$::GB::commande(choix)clearbans"
puthelp "privmsg $nick :\0 0314Commande Clearbans Msg \0 031: \0 034/msg $::botnick clearbans <#salon>"
}
"mode" {
puthelp "privmsg $nick :\0 0314Commande Mode Chan \0 031: \0 034$::GB::commande(choix)mode <le-mode>"
puthelp "privmsg $nick :\0 0314Commande Mode Msg \0 031: \0 034/msg $::botnick mode <#salon> <mode>"
}
"blacklist" {
puthelp "privmsg $nick :\0 0314Commande Blacklist Chan \0 031: \0 034$::GB::commande(choix)blacklist"
puthelp "privmsg $nick :\0 0314Commande Blacklist Chan \0 031: \0 034$::GB::commande(choix)+blacklist <pseudo>"
puthelp "privmsg $nick :\0 0314Commande Blacklist Chan \0 031: \0 034$::GB::commande(choix)-blacklist <pseudo>"
}
"exempt" {
puthelp "privmsg $nick :\0 0314Commande Exempt Chan \0 031: \0 034$::GB::commande(choix)exempt"
puthelp "privmsg $nick :\0 0314Commande Exempt Chan \0 031: \0 034$::GB::commande(choix)+exempt <pseudo>"
puthelp "privmsg $nick :\0 0314Commande Exempt Chan \0 031: \0 034$::GB::commande(choix)-exempt <pseudo>"
}
"newpass" {
puthelp "privmsg $nick :\0 0314Commande Newpass Msg \0 031: \0 034/msg $::botnick newpass <ancien-pass> <nouveau-pass>"
}
"opall" {
puthelp "privmsg $nick :\0 0314Commande Opall Chan \0 031: \0 034$::GB::commande(choix)opall"
puthelp "privmsg $nick :\0 0314Commande Opall Msg \0 031: \0 034/msg $::botnick opall <#salon>"
}
"deopall" {
puthelp "privmsg $nick :\0 0314Commande Deopall Chan \0 031: \0 034$::GB::commande(choix)deopall"
puthelp "privmsg $nick :\0 0314Commande Deopall Msg \0 031: \0 034/msg $::botnick deopall <#salon>"
}
"voiceall" {
puthelp "privmsg $nick :\0 0314Commande Voiceall Chan \0 031: \0 034$::GB::commande(choix)voiceall"
puthelp "privmsg $nick :\0 0314Commande Voiceall Msg \0 031: \0 034/msg $::botnick voiceall <#salon>"
}
"devoiceall" {
puthelp "privmsg $nick :\0 0314Commande Devoiceall Chan \0 031: \0 034$::GB::commande(choix)devoiceall"
puthelp "privmsg $nick :\0 0314Commande Devoiceall Msg \0 031: \0 034/msg $::botnick devoiceall <#salon>"
}
"addsuspend" {
puthelp "privmsg $nick :\0 0314Commande Addsuspend Msg \0 031: \0 034/msg $::botnick addsuspend <pseudo>"
}
"delsuspend" {
puthelp "privmsg $nick :\0 0314Commande Delsuspend Msg \0 031: \0 034/msg $::botnick delsuspend <pseudo>"
}
"addchan" {
puthelp "privmsg $nick :\0 0314Commande Addchan Msg \0 031: \0 034/msg $::botnick addchan <#salon>"
}
"delchan" {
puthelp "privmsg $nick :\0 0314Commande Delchan Msg \0 031: \0 034/msg $::botnick delchan <#salon>"
}
"listchan" {
puthelp "privmsg $nick :\0 0314Commande Listchan Msg \0 031: \0 034/msg $::botnick listchan"
}
"addsuperop" {
puthelp "privmsg $nick :\0 0314Commande Addsuperop Msg \0 031: \0 034/msg $::botnick addsuperop <pseudo>"
}
"delsuperop" {
puthelp "privmsg $nick :\0 0314Commande Delsuperop Msg \0 031: \0 034/msg $::botnick delsuperop <pseudo>"
}
"infoline" {
puthelp "privmsg $nick :\0 0314Commande Infoline Msg \0 031: \0 034/msg $::botnick infoline <#salon> <text>"
}
"amsg" {
puthelp "privmsg $nick :\0 0314Commande Amsg Chan \0 031: \0 034$::GB::commande(choix)amsg <phrase>"
}
"topic" {
puthelp "privmsg $nick :\0 0314Commande Topic Chan \0 031: \0 034$::GB::commande(choix)topic <phrase>"
puthelp "privmsg $nick :\0 0314Commande Topic Msg \0 031: \0 034/msg $::botnick topic <#salon> <text>"
}
"authlist" {
puthelp "privmsg $nick :\0 0314Commande Authlist Msg \0 031: \0 034/msg $::botnick authlist <#salon>"
}
"gbon" {
puthelp "privmsg $nick :\0 0314Commande Gbon Chan \0 031: \0 034$::GB::commande(choix)gbon"
}
"gboff" {
puthelp "privmsg $nick :\0 0314Commande Gboff Chan \0 031: \0 034$::GB::commande(choix)gboff"
}
"say" {
puthelp "privmsg $nick :\0 0314Commande Say Msg \0 031: \0 034/msg $::botnick say <#salon> <text>"
}
"me" {
puthelp "privmsg $nick :\0 0314Commande Me Msg \0 031: \0 034/msg $::botnick me <#salon> <text>"
}
}
return
}
Bonjour,
J'ai tenté de cette façon :
tclcopier
if { $commande == "" } {
switch -- $commande {
"!biere" {
putquick "PRIVMSG $chan :\0 037$nick \0 0312se décapsule une bonne bière bien fraiche."
} else {
putquick "PRIVMSG $chan :\0 037$nick \0 0312offre une bonne bière bien fraiche à\0 034 [lrange $arg 1 end] \0 0312."
}
Mais plus aucune commande ne fonctionne et aucun message d'erreur en PL...
alors dans le if j'ai remplacer $commande par [lrange $arg 1 end]. J'ai aucun message en PL mais plus aucune commande en ajoutant le pseudo ne fonctionne...
Code :
[10:10:11] ‹AngeDesOmbres› !biere
[10:10:11] ‹+OsiriS› AngeDesOmbres se décapsule une bonne bière bien fraiche.
[10:10:18] ‹AngeDesOmbres› !biere OsiriS
[10:10:33] ‹AngeDesOmbres› !fouette OsiriS
Cordialement
Mais bien sûr que ça ne peut pas marcher, c'est complètement faux !
Alucard`68 a écrit : tclcopier
if { $commande == "" } {
switch -- $commande {
"!biere" {
putquick "PRIVMSG $chan :\0 037$nick \0 0312se décapsule une bonne bière bien fraiche."
} else {
putquick "PRIVMSG $chan :\0 037$nick \0 0312offre une bonne bière bien fraiche à\0 034 [lrange $arg 1 end] \0 0312."
}
Voici à quoi ça devrait ressembler :
tclcopier
if { $commande == "" } {
switch -- $commande {
"!biere" {
if { [ llength [ split $arg ] ] ==1 } {
putquick "PRIVMSG $chan :\0 037$nick \0 0312se décapsule une bonne bière bien fraiche."
} else {
putquick "PRIVMSG $chan :\0 037$nick \0 0312offre une bonne bière bien fraiche à\0 034 [lrange $arg 1 end] \0 0312."
}
}
default { putserv "PRIVMSG $chan :$commande est inconnu" }
}
}
Avec ton code, tu mélange du switch et du else...
Salut,
Sinon ya une meilleur solution :
En 3 étapes.
1) Ont clic sur rechercher ?
Clic
2) Ont mais quoi ensuite ? hmm pourquoi pas : Jokes ?
Ont re Clic ?
Ensuite ont regarde bien.. et ont peut voir un post sur Jokes.tcl non ?
Mais si regarde..
En résumer ce que tu désire faire j'ai pas oser le dire au début..
Mais tu cherche simplement à re créer Jokes.tcl qui existe déjà et qui fonctionne sans bug..
Pourquoi ne pas l'utilisé et le modifié à ta guise celon ce que tu désire ?
Enfin je dit ça je dit rien..
Merci CrazyCat d'éclairer ma lanterne. Je verai sa se soir en rentrant du boulot
alias_angelius tout simplement pour apprendre a coder en tcl. Pour ma part modifier un code me permet pas d'apprendre ni de comprendre le fonctionnement de celui-çi.
Et à quoi sert la proc filter qui tu m'as conseiller de rajouter à mon code ? Je ne comprend pas a quoi elle sert :s
Cordialement.
Modifié un code n'apprend pas ?
Heu.. La tu as complêtement tord.
Modifié un code t'apprend à te familliariser avec les bind,proc...
Pour ce qui concerne filter tien une réponse pour bien comprendre ya eut un post fait à ce sujet de Artix et de DjKenny qui la bien repris :
Clic.
Bonjour,
CrazyCat j'ai tester le code mais rien ne fonctionne
Je ne vois vraiment pas comment faire
alias_angelius comme je l'ai dit dans mon message précédent cela ne concerne que moi pas les autres donc non je n'es pas tord.
Enfin bref
Je ne comprend pas le 2eme if quelqu'un pourrait m'éclairer ?
Problème résolu voila le code tout fonctionne très bien.
tclcopier
proc pub:animation { nick uhost handle chan arg } {
set commande [ lindex $arg 1 ]
set commande [ stripcodes bcruag [ lindex $arg 0 ] ]
switch -- $commande {
"!biere" {
if { [ lrange $arg 1 end] == "" } {
putquick "PRIVMSG $chan :\0 037$nick \0 0312se décapsule une bonne bière bien fraiche."
} else {
putquick "PRIVMSG $chan :\0 037$nick \0 0312offre une bonne bière bien fraiche à\0 034 [lrange $arg 1 end] \0 0312."
}
}
}
}
Encore merci à vous pour votre aide.
Cordialement.
Cordialement.
Salut,
Ou alors une idées que je pense na pas était faite encore..
Tu fait un code comme tu as le tout par traitement de fichier.
Chaque fichier aurez c'est propre phrases dedans exemple :
Tu va dans scripts/blabla le dossier blabla va contenir des fichier text.
Ont va prendre exemple sur !biere
Tu va avoir un fichier qui va se nommer biere.txt par exemple et dedans tu aura plusieurs phrase.
Donc ce qui fait que lorsqu'une personne va taper une commande du genr !biere etc le Robot va rechercher dans le dossier et fichier : blabla/biere.txt Une phrase au hasard de mise dedans..
Je pense sa serait beaucoup plus sympa de faire comme ça car sa permet vraiment d'avoir un code personalisable au lieu que tu t'amuse à taper 500 putquick etc.. la en l'encurence tu en tapera qu'un seul
Enfin c'est une idée mais j'avous sa serais plutot sympa d'avoir ce genre de chose
exact j'en est tapé pluiseurs des putquick lol
oui effectivement sa serais très sympa je vais bosser dessus pour la V2 de mon bot
Merci de l'idée :p