Communauté Eggdrop
problème sur certaine commande - Version imprimable

+- Communauté Eggdrop (https://forum.eggdrop.fr)
+-- Forum : Eggdrop et TCL (https://forum.eggdrop.fr/forumdisplay.php?fid=8)
+--- Forum : Scripts TCL (https://forum.eggdrop.fr/forumdisplay.php?fid=4)
+--- Sujet : problème sur certaine commande (/showthread.php?tid=1178)



problème sur certaine commande - Alucard`68 - 18/05/2012

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
tcl
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 :\0032Pour faire fonctionner les commandes il faut taper de la maniere suivante !cmd pseudo ( exemple: !bierre Hathor )"
             putquick "NOTICE $nick :\0031Les commandes\00312 !acro !story !invoque !vdm et !couple\0031 sont a taper en noir !"
             putquick "NOTICE $nick :\0036Voici les commandes de OsiriS"
             putquick "NOTICE $nick :\0037Les commandes barman:"
             putquick "NOTICE $nick :\00312!biere\0034 !coca\00312 !sky\0034 !cafe\00312 !champagne"
             putquick "NOTICE $nick :\0037Les commandes love:"
             putquick "NOTICE $nick :\00312!kiss\0034 !palo\00312 !love\0034 !calin\00312 !rose\0034 !sexy\00312 !plotte"
             putquick "NOTICE $nick :\0037Les commandes violantes:"
             putquick "NOTICE $nick :\00312!fouette\0034 !baffe\00312 !relou\0034 !vanne\00312 !cb\0034 !pelle"
             putquick "NOTICE $nick :\0037Les commandes diverses:"
             putquick "NOTICE $nick :\00312!clope \0034!acro \00312!story \0034!vdm \00312!invoque (phrase) (pseudo) \0034!couple (pseudo) (pseudo)"
	     putquick "NOTICE $nick :\0037Les commandes concernant le site"
	     putquick "NOTICE $nick :\00312!site \0034!stats"
             putquick "NOTICE $nick :\0036Fin des commandes de OsiriS"
             putquick "NOTICE $nick :\0032OsiriS a été crée par AngeDesOmbres pour TchaT-Ever." }
    "!biere" { putquick "PRIVMSG $chan :\0037$nick \00312se décapsule une bonne bière bien fraiche."
			 } else { 
			"PRIVMSG $chan :\0037$nick \00312offre une bonne bière bien fraiche à\0034 [lrange $arg 1 end] \00312." }
  }
}


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.


RE: problème sur certaine commande - aliasangelius - 19/05/2012

Salut,

Je pense faudrais voir au niveau : rand
Si ça peut t'aider.

Exemple :

tcl
set ::phrase [lindex $::phrases [rand [llength $::phrases]]]
putserv "PRIVMSG $chan :\0031 $nick: \0034 $::phrase\0031"



Si tu as :

tcl
set ::phrases {
"Blabla"
"autreblabla"
}



Enfin c'est une idée..


RE: problème sur certaine commande - CrazyCat - 20/05/2012

A mon avis, revoir un peu le contrôle switch pourrait aider. Ou même apprendre le "If".

Si je résume:
tcl
switch -- $commande {
"!biere" {
   putquick "PRIVMSG $chan :\0037$nick \00312se décapsule une bonne bière bien fraiche."
} else {
   "PRIVMSG $chan :\0037$nick \00312offre une bonne bière bien fraiche à\0034 [lrange $arg 1 end] \00312."
}


Je suis même étonné que tu n'ais pas d'erreur de compilation.
Je te laisse trouver tes erreurs


RE: problème sur certaine commande - Alucard`68 - 20/05/2012

Bonsoir,

CrazyCat en se qui concerne le if je pense que sa doit etre quelque chose comme ça
tcl
if {$arg == ""} {


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.


RE: problème sur certaine commande - aliasangelius - 21/05/2012

tcl
if {$commande == ""} {



Ou comme ça je pense.
De plus j'aurait fait mes set différament..

Exemple :

tcl
set arg [filter $arg]
set commande [lindex $arg 1]
set commande [stripcodes abcu [lindex $arg 0]]



Avec Une proc filter qui donnerais :

tcl
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 Smile

tcl
# 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 :\00314Commande Help du Robot \002\0034$::botnick\002\0034"
    foreach c [channels] {
    if [matchattr $hand o|o $c] {
         puthelp "privmsg $nick :\0031\037Level \002Opérateur\002 :\0037"
         puthelp "privmsg $nick :\00314Auth \0031: \0034Permet de vous identifier auprès du Robot Identifia en MSG !"
         puthelp "privmsg $nick :\00314Op \0031: \0034Permet de te mettre Opérateur \0031(\00312@\0031) \0034 sur le salon ou en Msg, et pour le faire sur quelqu'un aussi !"
         puthelp "privmsg $nick :\00314Deop \0031: \0034Permet de te mettre Deop \0031(\00312-@\0031) \0034 sur le salon ou en Msg, et pour le faire sur quelqu'un aussi !"
	 puthelp "privmsg $nick :\00314Halfop \0031: \0034Permet de te mettre Halfop \0031(\00312%\0031) \0034 sur le salon , et pour le faire sur quelqu'un aussi !"
         puthelp "privmsg $nick :\00314Dehalfop \0031: \0034Permet de te mettre Dehalfop \0031(\00312-%\0031) \0034 sur le salon , et pour le faire sur quelqu'un aussi !"
         puthelp "privmsg $nick :\00314Voice \0031: \0034Permet de te mettre voice \0031(\0033+v\0031) \0034 sur le salon ou en Msg, et pour le faire sur quelqu'un aussi !"
         puthelp "privmsg $nick :\00314Devoice \0031: \0034Permet de te mettre Devoice \0031(\0033-v\0031) \0034 sur le salon ou en Msg, et pour le faire sur quelqu'un aussi !"
         puthelp "privmsg $nick :\00314Kick \0031: \0034Permet de Kick quelqu'un sur un salon défini commande Chan ou Msg !"
         puthelp "privmsg $nick :\00314Kickban \0031: \0034Permet de Kickban quelqu'un sur un salon défini commande Chan ou Msg !"
         puthelp "privmsg $nick :\00314Ban \0031: \0034Permet de Ban quelqu'un sur un salon défini commande Chan ou Msg !"
         puthelp "privmsg $nick :\00314Unban \0031: \0034Permet de Unban quelqu'un sur un salon défini commande Chan ou Msg !"
         puthelp "privmsg $nick :\00314Access \0031: \0034Permet de regarder la liste d'acces command Msg !"
         puthelp "privmsg $nick :\00314Deauth \0031: \0034Permet de vous déauthentifier auprès du Robot $::botnick commande Msg !"
         puthelp "privmsg $nick :\00314Newpass \0031: \0034Permet de changer votre mot de passe auprès du Robot $::botnick commande Msg !"
	     puthelp "privmsg $nick :\00314Infoline \0031: \0034Permet de vous mettre un texte à l'entrée d'un salon commande Msg !"
		 puthelp "privmsg $nick :\00314Topic \0031: \0034Permet de mettre un topic sur un salon défini commande Chan ou Msg !"
		 puthelp "privmsg $nick :\00314Authlist \0031: \0034Permet de regarder qui est authentifié auprès du Robot $::botnick commande Msg !"
		 puthelp "privmsg $nick :\00314Say \0031: \0034Permet d'envoyer un message sous forme de /say sur un salon défini commande Msg !"
		 puthelp "privmsg $nick :\00314Me \0031: \0034Permet 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 :\0031\037Level \002Master\002 :\037"
         puthelp "privmsg $nick :\00314Addop \0031: \0034Permet de mettre un user Opérateur sur un salon défini commande Chan ou Msg !"
         puthelp "privmsg $nick :\00314Delop \0031: \0034Permet de retirer le level Opérateur sur un salon défini commande Chan ou Msg !"
         puthelp "privmsg $nick :\00314Clearbans \0031: \0034Permet de Clearbans tout les bans sur le salon commande Chan ou Msg !"
         puthelp "privmsg $nick :\00314Mode \0031: \0034Permet de mettre ou retirer un Mode commande Chan ou Msg !"
         puthelp "privmsg $nick :\00314Opall \0031: \0034Permet de mettre tout le monde Op commande Chan ou Msg !"
         puthelp "privmsg $nick :\00314Deopall \0031: \0034Permet de mettre tout le monde Deop commande Chan ou Msg !"
	          puthelp "privmsg $nick :\00314Halfopall \0031: \0034Permet de mettre tout le monde Halfop commande Chan !"
         puthelp "privmsg $nick :\00314Dehalfop \0031: \0034Permet de mettre tout le monde Dehalfop commande Chan !"
         puthelp "privmsg $nick :\00314Voiceall \0031: \0034Permet de mettre tout le monde Voice commande Chan ou Msg !"
         puthelp "privmsg $nick :\00314Devoiceall \0031: \0034Permet de mettre tout le monde Devoice commande Chan ou Msg !"		 
		 break
	}
}
    foreach c [channels] {
    if [matchattr $hand o|n $c] {
         puthelp "privmsg $nick :\0031\037Level \002Owner\002 :\037"
		 puthelp "privmsg $nick :\00314Addmaster \0031: \0034Permet de mettre un user ou un Opérateur d'un salon le level Master commande Msg !"
         puthelp "privmsg $nick :\00314Delmaster \0031: \0034Permet de retirer le level Master sur un salon défini commande Msg !"
		 puthelp "privmsg $nick :\00314Amsg \0031: \0034Permet 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 :\0031\037Level \002SuperOp\002 :\037"
         puthelp "privmsg $nick :\00314Delowner \0031: \0034Permet de retirer le level Owner sur un salon défini commande Msg !"
	     puthelp "privmsg $nick :\00314Exempt \0031: \0034Permet de mettre/retirer/regarder les pseudos protégés commande Chan !"
	     puthelp "privmsg $nick :\00314Blacklist \0031: \0034Permet de mettre/retirer/regarder la Blacklist commande Chan !"
	     puthelp "privmsg $nick :\00314Addsuspend \0031: \0034Permet de suspendre un accéss commande Msg !"
	     puthelp "privmsg $nick :\00314Delsuspend \0031: \0034Permet de retirer un suspend commande Msg !"
	     puthelp "privmsg $nick :\00314Addchan \0031: \0034Permet de rajouter un autojoin sur un salon au bot commande Msg !"
	     puthelp "privmsg $nick :\00314Delchan \0031: \0034Permet de retirer un salon des autojoin au bot commande Msg !"
	     puthelp "privmsg $nick :\00314Listchan \0031: \0034Permet de regarder la liste des chan en autojoin qu'il y a dans $::botnick commande Msg !"
	     puthelp "privmsg $nick :\00314Addowner \0031: \0034Permet de mettre un user ou Opérateur ou un Master le level Owner commande Msg !"
	     puthelp "privmsg $nick :\00314Addsuperop \0031: \0034Permet de mettre un user ou Opérateur ou Master ou Owner le level SuperOp commande Msg !"
	     puthelp "privmsg $nick :\00314Delsuperop \0031: \0034Permet de retirer le level SuperOp commande Msg !"
		 puthelp "privmsg $nick :\00314Gbon \0031: \0034Permet d'activer le TCL sur un salon défini commande Chan !"
		 puthelp "privmsg $nick :\00314Gboff \0031: \0034Permet de désactiver le TCL sur un salon défini commande Chan !"
     break
	}
}
         puthelp "privmsg $nick :\00314Exemple de commande à taper pour avoir de l'aide plus détaillée\00314"
         puthelp "privmsg $nick :\0034/msg $::botnick help op\0034"
		 puthelp "privmsg $nick :\0031\[\0034Info\0031\] \00314Toutes les commandes sont a taper en \002\0031(Minuscules)\002"
		 puthelp "privmsg $nick :\0031\037\002Fin du Help !\002"
         puthelp "privmsg $GB::log :\00314Commande \0036\[\0033Help\0036\] \0031par : \0034$hand"
    }
    switch -- $commande {
"op" { 
         puthelp "privmsg $nick :\00314Commande Op Chan \0031: \0034$::GB::commande(choix)op \0031ou \0034$::GB::commande(choix)op <pseudo>"
         puthelp "privmsg $nick :\00314Commande Op Msg \0031: \0034/msg $::botnick op <#salon> \0031ou \0034/msg $::botnick op <#salon> <pseudo>" 
    }
"deop" { 
         puthelp "privmsg $nick :\00314Commande Deop Chan \0031: \0034$::GB::commande(choix)deop \0031ou \0034$::GB::commande(choix)deop <pseudo>" 
         puthelp "privmsg $nick :\0031Commande Deop Chan \0031: \0034/msg $::botnick deop <#salon> \0031ou \0034/msg $::botnick deop <#salon> <pseudo>" 
    }
"voice" { 
         puthelp "privmsg $nick :\00314Commande Voice Chan \0031: \0034$::GB::commande(choix)voice \0031ou \0034$::GB::commande(choix)voice <pseudo>" 
         puthelp "privmsg $nick :\00314Commande Voice Msg \0031: \0034/msg $::botnick <voice> <#salon> \0031ou \0034/msg $::botnick <voice> <#salon> <pseudo>" 
    }
"devoice" { 
         puthelp "privmsg $nick :\00314Commande Devoice Chan \0031: \0034$::GB::commande(choix)devoice \0031ou \0034$::GB::commande(choix)devoice <pseudo>" 
         puthelp "privmsg $nick :\00314Commande Devoice Msg \0031: \0034/msg $::botnick <devoice> <#salon> \0031ou \0034/msg $::botnick devoice <#salon> <pseudo>" 
    }
"halfop" { 
         puthelp "privmsg $nick :\00314Commande Halfop Chan \0031: \0034$::GB::commande(choix)halfop \0031ou \0034$::GB::commande(choix)halfop <pseudo>"
    }
"dehalfop" { 
         puthelp "privmsg $nick :\00314Commande Dehalfop Chan \0031: \0034$::GB::commande(choix)dehalfop \0031ou \0034$::GB::commande(choix)dehalfop <pseudo>"
    }
"halfopall" { 
         puthelp "privmsg $nick :\00314Commande Halfopall Chan \0031: \0034$::GB::commande(choix)halfopall \0031ou \0034$::GB::commande(choix)halfopall <pseudo>"
    }
"dehalfopall" { 
         puthelp "privmsg $nick :\00314Commande Dehalfopall Chan \0031: \0034$::GB::commande(choix)dehalfopall \0031ou \0034$::GB::commande(choix)dehalfopall <pseudo>"
    }
"kick" { 
         puthelp "privmsg $nick :\00314Commande Kick Chan \0031: \0034$::GB::commande(choix)kick <pseudo> \0031ou \0034$::GB::commande(choix)kick <pseudo> <raison>" 
         puthelp "privmsg $nick :\00314Commande Kick Msg \0031: \0034/msg $::botnick kick <#salon> <pseudo> \0031ou \0034/msg $::botnick kick <#salon> <pseudo> <raison>" 
    }
"kickban" { 
         puthelp "privmsg $nick :\00314Commande Kickban Chan \0031: \0034$::GB::commande(choix)kickban <pseudo>" 
         puthelp "privmsg $nick :\00314Commande Kickban Msg \0031: \0034/msg $::botnick kickban <#salon> <pseudo>" 
    }
"ban" { 
         puthelp "privmsg $nick :\00314Commande Ban Chan \0031: \0034$::GB::commande(choix)ban <pseudo> \0031ou \0034$::GB::commande(choix)ban <host>"
         puthelp "privmsg $nick :\00314Commande Ban Msg \0031: \0034/msg $::botnick ban <#salon> <host>" 
    }
"unban" { 
         puthelp "privmsg $nick :\00314Commande Unban Chan \0031: \0034$::GB::commande(choix)unban <pseudo> \ou \0034$::GB::commande(choix)unban <host>"
         puthelp "privmsg $nick :\00314Commande Unban Msg \0031: \0034/msg $::botnick unban <#salon> <host>" 
    }
"access" {
         puthelp "privmsg $nick :\00314Commande Access Msg \0031: \0034/msg $::botnick access <#salon> * \0031ou \0034/msg $::botnick access <#salon> al* \0037Ceci et un exemple le al* cherchera tout les access ayant dans le pseudo (al)"
    }
"addop" {
         puthelp "privmsg $nick :\00314Commande Addop Msg \0031: \0034/msg $::botnick addop <pseudo> <#salon>"
    }
"addmaster" {
         puthelp "privmsg $nick :\00314Commande Addmaster Msg \0031: \0034/msg $::botnick addmaster <pseudo> <#salon>"
    }
"addowner" {
         puthelp "privmsg $nick :\00314Commande Addowner Msg \0031: \0034/msg $::botnick addowner <pseudo> <#salon>"
    }
"delop" {
         puthelp "privmsg $nick :\00314Commande Delop Msg \0031: \0034 /msg $::botnick delop <pseudo> <#salon>"
    }
"delmaster" {
         puthelp "privmsg $nick :\00314Commande Delmaster Msg \0031: \0034/msg $::botnick delmaster <pseudo> <#salon>"
    }
"delowner" {
         puthelp "privmsg $nick :\00314Commande Delowner Msg \0031: \0034/msg $::botnick delowner <pseudo> <#salon>"
    }
"clearbans" { 
         puthelp "privmsg $nick :\00314Commande Clearbans Chan \0031: \0034$::GB::commande(choix)clearbans" 
         puthelp "privmsg $nick :\00314Commande Clearbans Msg \0031: \0034/msg $::botnick clearbans <#salon>"
    }
"mode" { 
         puthelp "privmsg $nick :\00314Commande Mode Chan \0031: \0034$::GB::commande(choix)mode <le-mode>" 
         puthelp "privmsg $nick :\00314Commande Mode Msg \0031: \0034/msg $::botnick mode <#salon> <mode>"
    }
"blacklist" { 
         puthelp "privmsg $nick :\00314Commande Blacklist Chan \0031: \0034$::GB::commande(choix)blacklist"
         puthelp "privmsg $nick :\00314Commande Blacklist Chan \0031: \0034$::GB::commande(choix)+blacklist <pseudo>"
         puthelp "privmsg $nick :\00314Commande Blacklist Chan \0031: \0034$::GB::commande(choix)-blacklist <pseudo>" 
    }
"exempt" {
         puthelp "privmsg $nick :\00314Commande Exempt Chan \0031: \0034$::GB::commande(choix)exempt"
         puthelp "privmsg $nick :\00314Commande Exempt Chan \0031: \0034$::GB::commande(choix)+exempt <pseudo>"
         puthelp "privmsg $nick :\00314Commande Exempt Chan \0031: \0034$::GB::commande(choix)-exempt <pseudo>"
    }
"newpass" {
         puthelp "privmsg $nick :\00314Commande Newpass Msg \0031: \0034/msg $::botnick newpass <ancien-pass> <nouveau-pass>"
    }
"opall" {
         puthelp "privmsg $nick :\00314Commande Opall Chan \0031: \0034$::GB::commande(choix)opall"
		 puthelp "privmsg $nick :\00314Commande Opall Msg \0031: \0034/msg $::botnick opall <#salon>"
    }
"deopall" {
         puthelp "privmsg $nick :\00314Commande Deopall Chan \0031: \0034$::GB::commande(choix)deopall"
		 puthelp "privmsg $nick :\00314Commande Deopall Msg \0031: \0034/msg $::botnick deopall <#salon>"
    }
"voiceall" {
         puthelp "privmsg $nick :\00314Commande Voiceall Chan \0031: \0034$::GB::commande(choix)voiceall"
		 puthelp "privmsg $nick :\00314Commande Voiceall Msg \0031: \0034/msg $::botnick voiceall <#salon>"
    }
"devoiceall" {
         puthelp "privmsg $nick :\00314Commande Devoiceall Chan \0031: \0034$::GB::commande(choix)devoiceall"
		 puthelp "privmsg $nick :\00314Commande Devoiceall Msg \0031: \0034/msg $::botnick devoiceall <#salon>"
    }
"addsuspend" {
         puthelp "privmsg $nick :\00314Commande Addsuspend Msg \0031: \0034/msg $::botnick addsuspend <pseudo>"
    }
"delsuspend" {
         puthelp "privmsg $nick :\00314Commande Delsuspend Msg \0031: \0034/msg $::botnick delsuspend <pseudo>"
    }
"addchan" {
         puthelp "privmsg $nick :\00314Commande Addchan Msg \0031: \0034/msg $::botnick addchan <#salon>"
    }
"delchan" {
         puthelp "privmsg $nick :\00314Commande Delchan Msg \0031: \0034/msg $::botnick delchan <#salon>"
    }
"listchan" {
         puthelp "privmsg $nick :\00314Commande Listchan Msg \0031: \0034/msg $::botnick listchan"
    }
"addsuperop" {
         puthelp "privmsg $nick :\00314Commande Addsuperop Msg \0031: \0034/msg $::botnick addsuperop <pseudo>"
    }
"delsuperop" {
         puthelp "privmsg $nick :\00314Commande Delsuperop Msg \0031: \0034/msg $::botnick delsuperop <pseudo>"
    }
"infoline" {
         puthelp "privmsg $nick :\00314Commande Infoline Msg \0031: \0034/msg $::botnick infoline <#salon> <text>"
    }
"amsg" {
		 puthelp "privmsg $nick :\00314Commande Amsg Chan \0031: \0034$::GB::commande(choix)amsg <phrase>"
	}
"topic" {
         puthelp "privmsg $nick :\00314Commande Topic Chan \0031: \0034$::GB::commande(choix)topic <phrase>"
		 puthelp "privmsg $nick :\00314Commande Topic Msg \0031: \0034/msg $::botnick topic <#salon> <text>"
	}
"authlist" {
         puthelp "privmsg $nick :\00314Commande Authlist Msg \0031: \0034/msg $::botnick authlist <#salon>"
	}
"gbon" {
		 puthelp "privmsg $nick :\00314Commande Gbon Chan \0031: \0034$::GB::commande(choix)gbon"
	}
"gboff" {
		 puthelp "privmsg $nick :\00314Commande Gboff Chan \0031: \0034$::GB::commande(choix)gboff"
    }
"say" {
		 puthelp "privmsg $nick :\00314Commande Say Msg \0031: \0034/msg $::botnick say <#salon> <text>"
 
	}
"me" {
		 puthelp "privmsg $nick :\00314Commande Me Msg \0031: \0034/msg $::botnick me <#salon> <text>"
		}
	}
	return
}





RE: problème sur certaine commande - Alucard`68 - 21/05/2012

Bonjour,

J'ai tenté de cette façon :
tcl
if {$commande == ""} {
  switch -- $commande {
  "!biere" {
    putquick "PRIVMSG $chan :\0037$nick \00312se décapsule une bonne bière bien fraiche."
} else {
    putquick "PRIVMSG $chan :\0037$nick \00312offre une bonne bière bien fraiche à\0034 [lrange $arg 1 end] \00312."
}


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


RE: problème sur certaine commande - CrazyCat - 21/05/2012

Mais bien sûr que ça ne peut pas marcher, c'est complètement faux !
Alucard`68 a écrit :
tcl
if {$commande == ""} {
  switch -- $commande {
  "!biere" {
    putquick "PRIVMSG $chan :\0037$nick \00312se décapsule une bonne bière bien fraiche."
} else {
    putquick "PRIVMSG $chan :\0037$nick \00312offre une bonne bière bien fraiche à\0034 [lrange $arg 1 end] \00312."
}


Voici à quoi ça devrait ressembler :
tcl
if {$commande == ""} {
   switch -- $commande {
      "!biere" {
         if {[llength [split $arg]]==1} {
            putquick "PRIVMSG $chan :\0037$nick \00312se décapsule une bonne bière bien fraiche."
         } else {
            putquick "PRIVMSG $chan :\0037$nick \00312offre une bonne bière bien fraiche à\0034 [lrange $arg 1 end] \00312."
         }
      }
      default { putserv "PRIVMSG $chan :$commande est inconnu" }
   }
}


Avec ton code, tu mélange du switch et du else...


RE: problème sur certaine commande - aliasangelius - 21/05/2012

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..


RE: problème sur certaine commande - Alucard`68 - 21/05/2012

Merci CrazyCat d'éclairer ma lanterne. Je verai sa se soir en rentrant du boulot Smile

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.


RE: problème sur certaine commande - aliasangelius - 21/05/2012

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.


RE: problème sur certaine commande - Alucard`68 - 22/05/2012

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.
tcl
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 :\0037$nick \00312se décapsule une bonne bière bien fraiche."
        } else {
          putquick "PRIVMSG $chan :\0037$nick \00312offre une bonne bière bien fraiche à\0034 [lrange $arg 1 end] \00312."
      }
    }
  }
}


Encore merci à vous pour votre aide.

Cordialement.

Cordialement.


RE: problème sur certaine commande - aliasangelius - 22/05/2012

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 Wink

Enfin c'est une idée mais j'avous sa serais plutot sympa d'avoir ce genre de chose Wink


RE: problème sur certaine commande - Alucard`68 - 22/05/2012

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 Smile
Merci de l'idée :p