ACRONYME FOR BOT

vesparo Messages postés 230 Date d'inscription samedi 6 septembre 2003 Statut Membre Dernière intervention 13 mai 2004 - 23 déc. 2003 à 18:55
cs_Kolibot Messages postés 817 Date d'inscription mercredi 25 juin 2003 Statut Membre Dernière intervention 19 avril 2004 - 23 déc. 2003 à 21:43
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/18939-acronyme-for-bot

cs_Kolibot Messages postés 817 Date d'inscription mercredi 25 juin 2003 Statut Membre Dernière intervention 19 avril 2004
23 déc. 2003 à 21:43
Merci Jujuquatre...
jujuquatre Messages postés 274 Date d'inscription vendredi 27 décembre 2002 Statut Membre Dernière intervention 24 août 2004
23 déc. 2003 à 21:40
Lol Koli j'crois que tes la seul personne que je coné qui sait si bien optimiser un code :D

Sinon mci de vos commentaires & de vos note :)
cs_SornDrixer Messages postés 2084 Date d'inscription jeudi 12 décembre 2002 Statut Membre Dernière intervention 30 janvier 2011 8
23 déc. 2003 à 20:23
Lol ! toujours aussi épatant Koli :)
cs_Kolibot Messages postés 817 Date d'inscription mercredi 25 juin 2003 Statut Membre Dernière intervention 19 avril 2004
23 déc. 2003 à 20:21
Lol comme tu le disai .... bref j'ai entièrement restructuré ton code en y laissant les grandes lignes... or donc j'ai remplacé tout ça :

;############ Acronyme #############

on *:text:*!acrog*:#:{
var %textrecu = $2-
var %i = 1
while %i <= $len(%textrecu) {
var %text.temp = $mid(%textrecu,%i,1)
if (%text.temp != a) && (%text.temp != b) && (%text.temp != c) && (%text.temp != d) && (%text.temp != e) && (%text.temp != f) && (%text.temp != g) && (%text.temp != h) && (%text.temp != i) && (%text.temp != j) && (%text.temp != k) && (%text.temp != l) && (%text.temp != m) && (%text.temp != n) && (%text.temp != o) && (%text.temp != p) && (%text.temp != q) && (%text.temp != r) && (%text.temp != s) && (%text.temp != t) && (%text.temp != u) && (%text.temp != v) && (%text.temp != w) && (%text.temp != x) && (%text.temp != y) && (%text.temp != z) { set %token1acro %token1acro 4 $+ %text.temp }
if (%text.temp == a) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/a.txt) } }
if (%text.temp == b) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/b.txt) } }
if (%text.temp == c) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/c.txt) } }
if (%text.temp == d) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/d.txt) } }
if (%text.temp == e) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/e.txt) } }
if (%text.temp == f) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/f.txt) } }
if (%text.temp == g) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/g.txt) } }
if (%text.temp == h) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/h.txt) } }
if (%text.temp == i) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/i.txt) } }
if (%text.temp == j) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/j.txt) } }
if (%text.temp == k) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/k.txt) } }
if (%text.temp == l) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/l.txt) } }
if (%text.temp == m) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/m.txt) } }
if (%text.temp == n) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/n.txt) } }
if (%text.temp == o) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/o.txt) } }
if (%text.temp == p) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/p.txt) } }
if (%text.temp == q) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/q.txt) } }
if (%text.temp == r) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/r.txt) } }
if (%text.temp == s) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/s.txt) } }
if (%text.temp == t) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/t.txt) } }
if (%text.temp == u) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/u.txt) } }
if (%text.temp == v) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/v.txt) } }
if (%text.temp == w) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/w.txt) } }
if (%text.temp == x) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/x.txt) } }
if (%text.temp == y) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/y.txt) } }
if (%text.temp == z) { if %token1acro != $null { set %token1acro %token1acro $read(acro/gent/z.txt) } }
if ( %i >= $len(%textrecu)) { msg $chan %token1acro }
inc %i
}
unset %token1acro
set %token1acro Acronyme ->
return %textrecu

}
on *:text:*!acrom*:#:{
var %textrecu = $2-
var %i = 1
while %i <= $len(%textrecu) {
var %text.temp = $mid(%textrecu,%i,1)
if (%text.temp != a) && (%text.temp != b) && (%text.temp != c) && (%text.temp != d) && (%text.temp != e) && (%text.temp != f) && (%text.temp != g) && (%text.temp != h) && (%text.temp != i) && (%text.temp != j) && (%text.temp != k) && (%text.temp != l) && (%text.temp != m) && (%text.temp != n) && (%text.temp != o) && (%text.temp != p) && (%text.temp != q) && (%text.temp != r) && (%text.temp != s) && (%text.temp != t) && (%text.temp != u) && (%text.temp != v) && (%text.temp != w) && (%text.temp != x) && (%text.temp != y) && (%text.temp != z) { set %token1acro %token1acro 4 $+ %text.temp }
if (%text.temp == a) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/a.txt) } }
if (%text.temp == b) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/b.txt) } }
if (%text.temp == c) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/c.txt) } }
if (%text.temp == d) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/d.txt) } }
if (%text.temp == e) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/e.txt) } }
if (%text.temp == f) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/f.txt) } }
if (%text.temp == g) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/g.txt) } }
if (%text.temp == h) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/h.txt) } }
if (%text.temp == i) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/i.txt) } }
if (%text.temp == j) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/j.txt) } }
if (%text.temp == k) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/k.txt) } }
if (%text.temp == l) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/l.txt) } }
if (%text.temp == m) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/m.txt) } }
if (%text.temp == n) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/n.txt) } }
if (%text.temp == o) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/o.txt) } }
if (%text.temp == p) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/p.txt) } }
if (%text.temp == q) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/q.txt) } }
if (%text.temp == r) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/r.txt) } }
if (%text.temp == s) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/s.txt) } }
if (%text.temp == t) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/t.txt) } }
if (%text.temp == u) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/u.txt) } }
if (%text.temp == v) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/v.txt) } }
if (%text.temp == w) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/w.txt) } }
if (%text.temp == x) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/x.txt) } }
if (%text.temp == y) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/y.txt) } }
if (%text.temp == z) { if %token1acro != $null { set %token1acro %token1acro $read(acro/mech/z.txt) } }
if ( %i >= $len(%textrecu)) { msg $chan %token1acro }
inc %i
}
unset %token1acro
set %token1acro Acronyme ->
return %textrecu
}

on *:text:*!addacrom*:*:{
if ( $2- == $null ) { msg $chan Marque au moin un mot ! | halt }
if ($chr(32) isin $2-) { msg $chan Ne met pas d'espace ! | halt }
set %acro2.say $2-
set %acro2.PremLettre2 $left(%acro2.say,1)
set %acro2.PremLettre $left(%acro2.say,1)
Set %acro2.RestLettre.Cal $calc($len(%acro2.say) - 1)
Set %acro2.RestLettre $right(%acro2.say,%acro2.RestLettre.cal)
set %acro2.PremLettre 4 $+ $upper(%acro2.PremLettre)
set %acro2.TextComplet %acro2.PremLettre $+  $+ %acro2.RestLettre
write acro/mech/ $+ %acro2.PremLettre2 $+ .txt %acro2.TextComplet
msg $chan le Mot %acro2.TextComplet a bien etait ajouter dans les acronyme vulgaire !
}

on *:text:*!addacrog*:*:{
if ( $2- == $null ) { msg $chan Marque au moin un mot ! | halt }
if ($chr(32) isin $2-) { msg $chan Ne met pas d'espace ! | halt }
set %acro2.say $2-
set %acro2.PremLettre2 $left(%acro2.say,1)
set %acro2.PremLettre $left(%acro2.say,1)
Set %acro2.RestLettre.Cal $calc($len(%acro2.say) - 1)
Set %acro2.RestLettre $right(%acro2.say,%acro2.RestLettre.cal)
set %acro2.PremLettre 4 $+ $upper(%acro2.PremLettre)
set %acro2.TextComplet %acro2.PremLettre $+  $+ %acro2.RestLettre
write acro/gent/ $+ %acro2.PremLettre2 $+ .txt %acro2.TextComplet
msg $chan le Mot %acro2.TextComplet a bien etait ajouter dans les acronyme gentil !
}




Par cela :


;############ Acronyme #############

on *:text:!acrog*:#:acro1 $1-
on *:text:!acrom*:#:acro1 $1-
alias acro1 {
var %textrecu $2-,%i 1,%j
while %i <= $len(%textrecu) {
%j = 97
var %text.temp = $mid(%textrecu,%i,1)
if $asc(%text.temp) < %j || $asc(%text.temp) > 122 { %token1acro = $+(%token1acro 4,%text.temp) }
while %j <122 { if %text.temp $chr(%j) && %token1acro { %token1acro %token1acro $read($+(acro/,$iif(!acrog == $1,gent,mech),/,$chr(%j),.txt) } | inc %j }
if %i >= $len(%textrecu) { msg # %token1acro }
inc %i
}
unset %token1acro
set %token1acro Acronyme ->
return %textrecu
}
on *:text:!addacrom*:#:acro2 $1-
on *:text:!addacrog*:#:acro2 $1-
alias acro2 {
if !$2- { msg $# Marque au moin un mot ! | halt }
if $chr(32) isin $2- { msg # Ne met pas d'espace ! | halt }
%acro2.say = $2-
%acro2.PremLettre2 = $left(%acro2.say,1)
%acro2.PremLettre = $left(%acro2.say,1)
%acro2.RestLettre.Cal = $calc($len(%acro2.say) - 1)
%acro2.RestLettre = $right(%acro2.say,%acro2.RestLettre.cal)
%acro2.PremLettre = $+(4,$upper(%acro2.PremLettre))
%acro2.TextComplet = $+(%acro2.PremLettre,,%acro2.RestLettre)
write $+(acro/,$iif(!addacrom == $1,mech,gent),/,%acro2.PremLettre2,.txt) %acro2.TextComplet
msg # le Mot %acro2.TextComplet a bien etait ajouter dans les acronyme $iif(!addacrom == $1,vulgaire,gentil !)
}

Il est possible que mon optimisation contienne des erreurs... le but n'est pas de créer un nouveau code mais de donner des idées...
J'aime beaucoup l'idée :D c'est pourquoi je te met 8/10.
cs_SornDrixer Messages postés 2084 Date d'inscription jeudi 12 décembre 2002 Statut Membre Dernière intervention 30 janvier 2011 8
23 déc. 2003 à 20:15
C'est sympa d'avoir adapté un script tcl en mIRC Scripting, original, même si le script en lui même reste basique. Tu aurais pu un peu optimiser ça ;)
7/10 aussi
vesparo Messages postés 230 Date d'inscription samedi 6 septembre 2003 Statut Membre Dernière intervention 13 mai 2004
23 déc. 2003 à 18:55
c'est cool juju bien qu'un peu long :PPP mais sinon c'est sympa comme scripting c basique mais c'est bien. voila 7/10
Rejoignez-nous