HELP mon premier dialog...

dave_boulanger Messages postés 7 Date d'inscription mardi 23 septembre 2003 Statut Membre Dernière intervention 24 juin 2004 - 24 juin 2004 à 07:09
cs_SornDrixer Messages postés 2084 Date d'inscription jeudi 12 décembre 2002 Statut Membre Dernière intervention 30 janvier 2011 - 24 juin 2004 à 10:51
bon, j'ai chercher toute la nuit pour faire un petit script...
bon, ca doit etre pourri comme code mais je suis newbie :D
svp, aidez moi a trouver ce qui ne va pas dans mon code...

menu menubar {
Time announcer:/dialog -m timeann
}

Dialog timeann {
Title "Timeannouncer"
Size -1 -1 306 163
Check "Time Announcer on/off", 1, 16 21 140 13,
Check "Let other users see the time announcer", 2, 16 46 251 13,
Button "Close", 3, 209 107 89 23,
on *:dialog:timerann:sclick:3: {
dialog -x timeann
}
on *:dialog:timeann:sclick:2: {
if ($did(2).state == 0) { alltimeon }
if ($did(2).state == 1 ) { alltimeoff }
}
ON *:DIALOG:timeann:sclick:1: {
if ($did(1).state == 0) { timeoff }
if ($did(1).state == 1) { timeon }
}
}

alias timeon {
timertime1 00:00 0 1 /echo The time is now : 00:00 AM
timertime2 1:00 0 1 /echo The time is now : 1:00 AM
timertime3 2:00 0 1 /echo The time is now : 2:00 AM
timertime4 3:00 0 1 /echo The time is now : 3:00 AM
timertime5 4:00 0 1 /echo The time is now : 4:00 AM
timertime6 5:00 0 1 /echo The time is now : 5:00 AM
timertime7 6:00 0 1 /echo The time is now : 6:00 AM
timertime8 7:00 0 1 /echo The time is now : 7:00 AM
timertime9 8:00 0 1 /echo The time is now : 8:00 AM
timertime10 9:00 0 1 /echo The time is now : 9:00 AM
timertime11 10:00 0 1 /echo The time is now : 10:00 AM
timertime12 11:00 0 1 /echo The time is now : 11:00 AM
timertime13 12:00 0 1 /echo The time is now : 12:00 PM
timertime14 13:00 0 1 /echo The time is now : 1:00 PM
timertime15 14:00 0 1 /echo The time is now : 2:00 PM
timertime16 15:00 0 1 /echo The time is now : 3:00 PM
timertime17 16:00 0 1 /echo The time is now : 4:00 PM
timertime18 17:00 0 1 /echo The time is now : 5:00 PM
timertime19 18:00 0 1 /echo The time is now : 6:00 PM
timertime20 19:00 0 1 /echo The time is now : 7:00 PM
timertime21 20:00 0 1 /echo The time is now : 8:00 PM
timertime22 21:00 0 1 /echo The time is now : 9:00 PM
timertime23 22:00 0 1 /echo The time is now : 10:00 PM
timertime24 23:00 0 1 /echo The time is now : 11:00 PM
echo 0[4»14»0 Retarded Script 14«4«0] Time announcer is ON
}

alias timeoff {
timertime* off
echo 0[4»14»0 Retarded Script 14«4«0] Time announcer is OFF
}

alias alltimeon {
timertime1 00:00 0 1 /amsg The time is now : 00:00 AM
timertime2 1:00 0 1 /amsg The time is now : 1:00 AM
timertime3 2:00 0 1 /amsg The time is now : 2:00 AM
timertime4 3:00 0 1 /amsg The time is now : 3:00 AM
timertime5 4:00 0 1 /amsg The time is now : 4:00 AM
timertime6 5:00 0 1 /amsg The time is now : 5:00 AM
timertime7 6:00 0 1 /amsg The time is now : 6:00 AM
timertime8 7:00 0 1 /amsg The time is now : 7:00 AM
timertime9 8:00 0 1 /amsg The time is now : 8:00 AM
timertime10 9:00 0 1 /amsg The time is now : 9:00 AM
timertime11 10:00 0 1 /amsg The time is now : 10:00 AM
timertime12 11:00 0 1 /amsg The time is now : 11:00 AM
timertime13 12:00 0 1 /amsg The time is now : 12:00 PM
timertime14 13:00 0 1 /amsg The time is now : 1:00 PM
timertime15 14:00 0 1 /amsg The time is now : 2:00 PM
timertime16 15:00 0 1 /amsg The time is now : 3:00 PM
timertime17 16:00 0 1 /amsg The time is now : 4:00 PM
timertime18 17:00 0 1 /amsg The time is now : 5:00 PM
timertime19 18:00 0 1 /amsg The time is now : 6:00 PM
timertime20 19:00 0 1 /amsg The time is now : 7:00 PM
timertime21 20:00 0 1 /amsg The time is now : 8:00 PM
timertime22 21:00 0 1 /amsg The time is now : 9:00 PM
timertime23 22:00 0 1 /amsg The time is now : 10:00 PM
timertime24 23:00 0 1 /amsg The time is now : 11:00 PM
}

alias alltimeoff {
timertime* off
echo 0[4»14»0 Retarded Script 14«4«0] Time announcer is OFF
}

(c'est ma premiere source utilisant des dialogs et des timers)

3 réponses

darkyojimbo2 Messages postés 244 Date d'inscription mercredi 11 juin 2003 Statut Membre Dernière intervention 25 juin 2005
24 juin 2004 à 09:25
Salut,

Dialog timeann {
Title "Timeannouncer"
Size -1 -1 306 163
Check "Time Announcer on/off", 1, 16 21 140 13,
Check "Let other users see the time announcer", 2, 16 46 251 13,
Button "Close", 3, 209 107 89 23, ok
}

Ton dialog est faux. Le crochet n'est pas refermé à la fin. Si tu veux te faciliter la vie pour la creation de dialog, je te conseille Dialog Studio, un très bon logiciel permettant de créer ses dialogs sans peine.
Lien ou le télécharger : http://botcorporation.free.fr/telechargement/dstudio.zip

Sinon :

on *:dialog:timeann:sclick:2: {
if ($did(2).state == 0) { alltimeon }
if ($did(2).state == 1 ) { alltimeoff }
}
au lieu de ça met ça :
on *:dialog:timeann:sclick:2: {
;si le check est non coché faire la commande
if ($did(2).state == 0) { alltimeon }
;sinon executer la commande alltimeoff
else { alltimeoff }
}

Pour les timers :
essaie de mettre ça :
timertime19 18:00 1 1 /amsg The time is now : 6:00 PM
pasque sinon ca repete indefiniment.

Ton code mérite encore d'être optimisé mais comme tu es newbie, je ne t'en parlerai pas encore. Et dernière note, quand tu auras reussi a faire marcher corrrectement ce code, ne viens pas le poster ici, ne poste que quand tu auras un niveau plusa vancé.

++

irc://koliserv.dyndns.org

www.mircstudio.tk"

-Carton- :)
0
darkyojimbo2 Messages postés 244 Date d'inscription mercredi 11 juin 2003 Statut Membre Dernière intervention 25 juin 2005
24 juin 2004 à 09:28
ah oui ! J'oubliais un petit detail.

Les / ne sont pas obligatoire dans les remotes, ceci :

timertime1 00:00 0 1 /amsg The time is now : 00:00 AM

donera ça :

timertime1 00:00 0 1 amsg The time is now : 00:00 AM

irc://koliserv.dyndns.org

-Carton- :)
0
cs_SornDrixer Messages postés 2084 Date d'inscription jeudi 12 décembre 2002 Statut Membre Dernière intervention 30 janvier 2011 8
24 juin 2004 à 10:51
Bonjour, moi je vais te proposer une optimisation dave. Je vais remplacer tes 2 gros alias par un seul, et la répétition de tout tes timers par une boucle :

alias timeractivation {
var %a = 0
while 23 >= %a {
$+(timertime,%a) $+(%a,:,00) 1 1 $iif(%alltime,amsg,echo)
inc %a
}
}


Commentaire : on fait une boucle, tant que %a ne vaut pas 23, on lance un timer comportant la valeur de %a suivis de :00 (par exemple si %a vaut 5, alors 5:00), puis, avec notre $iif, si %alltime existe, on exécute un /amsg, dans le cas contraire, on éxécute notre timer en echo.
Puis en finis par inclure notre variable %a pour continuer notre boucle, et qu'elle recommence jusqu'à se que %a valle 23.

Bien évidemment, vu que j'utilise maintenant la variable %alltime, il va falloir un tout petit peu adapter ton code ici :

on *:dialog:timeann:sclick:2: {
if ($did(2).state == 0) { alltimeon }
if ($did(2).state == 1 ) { alltimeoff }
}
ON *:DIALOG:timeann:sclick:1: {
if ($did(1).state == 0) { timeoff }
if ($did(1).state == 1) { timeon }
}
}


A remplacer par :

ON *:DIALOG:timeann:sclick:*:{
if $did == 1 {
if $did(1).state { unset %alltime }
else { timeoff }
}
if $did == 2 {
if $did(2).state { set %alltime 1 }
else { alltimeoff }
}
}


Voila, je pense qu'ainsi c'est beaucoup plus simple.
-<gras>[ Sorn_Drixer ]-</gras>
-
Un problème ? une question ? N'hésitez pas, le forum est là pour ça.

:question) Vous pouvez me retrouver sur koliserv.dyndns.org:6667

:question) Sorn-Creation
0