begin process at 2010 02 10 16:39:00
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

AddOns

 > HORLOGE / REVEIL [PICWIN]

HORLOGE / REVEIL [PICWIN]


 Information sur la source

Note :
8 / 10 - par 7 personnes
8,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :AddOns Niveau :Débutant Date de création :26/02/2005 Date de mise à jour :01/05/2005 07:56:01 Vu :3 294

Auteur : MaX_62

Ecrire un message privé
Commentaire sur cette source (18)
Ajouter un commentaire et/ou une note

 Description

Cliquez pour voir la capture en taille normale
Voici ma première source en picwin, c'est une horloge qui fait également réveil :p Vous pouvez personnaliser les couleurs et le format de l'heure a partir du click droit :)

Comme je l'ai deja dit, c'est ma première picwin alors n'hésitez pas pour les critiques =]

Source

  • alias horloge {
  • if ($window(@Time)) { window -c @Time }
  • window -pdCBdk0 +Let @Time 0 0 215 95
  • horloge_init
  • }
  • alias -l horloge_drawchiffre {
  • if ($2 == 0) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 10 $calc(10 + $1) 60 }
  • elseif ($2 == 1) { ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 }
  • elseif ($2 == 2) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(45 + $1) 10 $calc(45 + $1) 35 | ho_dl 5 $calc(10 + $1) 35 $calc(45 + $1) 35 | ho_dl $calc(10 + $1) 35 $calc(10 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 }
  • elseif ($2 == 3) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 35 $calc(45 + $1) 35 }
  • elseif ($2 == 4) { ho_dl $calc(10 + $1) 10 $calc(10 + $1) 35 | ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 35 $calc(45 + $1) 35 }
  • elseif ($2 == 5) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(10 + $1) 10 $calc(10 + $1) 35 | ho_dl $calc(10 + $1) 35 $calc(45 + $1) 35 | ho_dl $calc(45 + $1) 35 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 }
  • elseif ($2 == 6) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(10 + $1) 10 $calc(10 + $1) 60 | ho_dl $calc(10 + $1) 35 $calc(45 + $1) 35 | ho_dl $calc(45 + $1) 35 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 }
  • elseif ($2 == 7) { ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 }
  • elseif ($2 == 8) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 10 $calc(10 + $1) 60 | ho_dl $calc(10 + $1) 35 $calc(45 + $1) 35 }
  • elseif ($2 == 9) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 10 $calc(10 + $1) 35 | ho_dl $calc(10 + $1) 35 $calc(45 + $1) 35 }
  • }
  • alias -l horloge_delchiffre { drawrect -f @Time $hget(horloge,bgc) 0 $replacex($1,1,0,2,48,3,108,4,154) 0 50 $window(@Time).h }
  • alias horloge_afficheur {
  • var %a $len($time($hget(horloge,fmt)))
  • while (%a) {
  • if ($mid($time,%a,1) != $chr(58)) { horloge_delchiffre $iif(%a > 3,$calc(%a - 1),%a) | horloge_drawchiffre $replacex(%a,1,0,2,45,4,105,5,150) $mid($time($hget(horloge,fmt)),%a,1) }
  • dec %a
  • }
  • if ($time($hget(horloge,fmt)) == $hget(horloge,reveil)) {
  • if ($active == @Time) {
  • var %a $chan(0)
  • while (%a) { echo $chan(%a) 12[4REVEIL12]7 Il est $time($hget(horloge,fmt)) ! 12[4REVEIL12] | dec %a }
  • }
  • echo -a 12[4REVEIL12]7 Il est $time($hget(horloge,fmt)) ! 12[4REVEIL12]
  • }
  • }
  • alias -l horloge_init {
  • drawrect -f @Time $hget(horloge,bgc) 0 0 0 $window(@Time).w $window(@Time).h
  • drawdot @Time $hget(horloge,pts) 5 105 30
  • drawdot @Time $hget(horloge,pts) 5 105 45
  • horloge_afficheur
  • .timerhorloge 0 60 horloge_afficheur
  • }
  • alias -l ho_dl { drawline @Time $hget(horloge,ctext) 5 $1- }
  • menu @Time {
  • Couleur
  • .Texte:var %a $$input(Couleur du texte ? ( actuelle : $hget(horloge,ctext) ),e,Couleur du texte (chiffrage de 0 à 15)) | if (%a isnum) && (. !isin %a) && (%a >= 0 && %a <= 15) { hadd horloge ctext %a | hsave horloge $scriptdirhorloge | horloge_init } | else { echo -a [Horloge] : Couleur invalide }
  • .Fond:var %a $$input(Couleur du fond ? ( actuelle : $hget(horloge,bgc) ),e,Couleur du fond (chiffrage de 0 à 15)) | if (%a isnum) && (. !isin %a) && (%a >= 0 && %a <= 15) { hadd horloge bgc %a | hsave horloge $scriptdirhorloge | horloge_init } | else { echo -a [Horloge] : Couleur invalide }
  • .Deux Points:var %a $$input(Couleur des 2 points ? ( actuelle : $hget(horloge,pts) ),e,Couleur des 2 points (chiffrage de 0 à 15)) | if (%a isnum) && (. !isin %a) && (%a >= 0 && %a <= 15) { hadd horloge pts %a | hsave horloge $scriptdirhorloge | horloge_init } | else { echo -a [Horloge] : Couleur invalide }
  • Format
  • .Passer en mode $iif($hget(horloge,fmt) === $+(hh,$chr(58),nn),24h,12h) :hadd -m horloge fmt $replacexcs($hget(horloge,fmt),HH,hh,hh,HH) | hsave horloge $scriptdirhorloge | horloge_init
  • Réveil
  • .Définir un réveil:hadd -m horloge reveil $$input(Heure du réveil ? (sous le format Heure:minutes),e,Heure du réveil)
  • }
  • menu menubar,status,channel {
  • -
  • Horloge:horloge
  • }
  • on *:LOAD:{
  • echo -a Horloge chargée !
  • hadd -m horloge ctext 9 | hadd -m horloge bgc 2 | hadd -m horloge pts 4 | hadd -m horloge fmt HH:nn
  • hsave horloge $scriptdirhorloge
  • horloge
  • .timer 1 2 .enable #horloge_start
  • }
  • #horloge_start off
  • on *:START:{
  • hmake horloge
  • $iif($exists($scriptdirhorloge),hload,hsave) horloge $scriptdirhorloge
  • }
  • #horloge_start end
  • on *:CLOSE:@Time:{ .timerhorloge off }
alias horloge {
  if ($window(@Time)) { window -c @Time }
  window -pdCBdk0 +Let @Time 0 0 215 95
  horloge_init
}
alias -l horloge_drawchiffre {
  if ($2 == 0) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 10 $calc(10 + $1) 60 }
  elseif ($2 == 1) { ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 }
  elseif ($2 == 2) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(45 + $1) 10 $calc(45 + $1) 35 | ho_dl 5 $calc(10 + $1) 35 $calc(45 + $1) 35 | ho_dl $calc(10 + $1) 35 $calc(10 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 }
  elseif ($2 == 3) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 35 $calc(45 + $1) 35 }
  elseif ($2 == 4) { ho_dl $calc(10 + $1) 10 $calc(10 + $1) 35 | ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 35 $calc(45 + $1) 35 }
  elseif ($2 == 5) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(10 + $1) 10 $calc(10 + $1) 35 | ho_dl $calc(10 + $1) 35 $calc(45 + $1) 35 | ho_dl $calc(45 + $1) 35 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 }
  elseif ($2 == 6) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(10 + $1) 10 $calc(10 + $1) 60 | ho_dl $calc(10 + $1) 35 $calc(45 + $1) 35 | ho_dl $calc(45 + $1) 35 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 }
  elseif ($2 == 7) { ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 }
  elseif ($2 == 8) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 10 $calc(10 + $1) 60 | ho_dl $calc(10 + $1) 35 $calc(45 + $1) 35 }
  elseif ($2 == 9) { ho_dl $calc(10 + $1) 10 $calc(45 + $1) 10 | ho_dl $calc(45 + $1) 10 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 60 $calc(45 + $1) 60 | ho_dl $calc(10 + $1) 10 $calc(10 + $1) 35 | ho_dl $calc(10 + $1) 35 $calc(45 + $1) 35 }
}
alias -l horloge_delchiffre { drawrect -f @Time $hget(horloge,bgc) 0 $replacex($1,1,0,2,48,3,108,4,154) 0 50 $window(@Time).h }
alias horloge_afficheur {
  var %a $len($time($hget(horloge,fmt)))
  while (%a) {
    if ($mid($time,%a,1) != $chr(58)) { horloge_delchiffre $iif(%a > 3,$calc(%a - 1),%a) | horloge_drawchiffre $replacex(%a,1,0,2,45,4,105,5,150) $mid($time($hget(horloge,fmt)),%a,1) }
    dec %a
  }
  if ($time($hget(horloge,fmt)) == $hget(horloge,reveil)) { 
    if ($active == @Time) {
      var %a $chan(0)
      while (%a) { echo $chan(%a) 12[4REVEIL12]7 Il est $time($hget(horloge,fmt)) ! 12[4REVEIL12] | dec %a }
    }
    echo -a 12[4REVEIL12]7 Il est $time($hget(horloge,fmt)) ! 12[4REVEIL12]
  }
}
alias -l horloge_init {
  drawrect -f @Time $hget(horloge,bgc) 0 0 0 $window(@Time).w $window(@Time).h
  drawdot @Time $hget(horloge,pts) 5 105 30
  drawdot @Time $hget(horloge,pts) 5 105 45
  horloge_afficheur
  .timerhorloge 0 60 horloge_afficheur
}
alias -l ho_dl { drawline @Time $hget(horloge,ctext) 5 $1- }
menu @Time {
  Couleur
  .Texte:var %a $$input(Couleur du texte ? ( actuelle : $hget(horloge,ctext) ),e,Couleur du texte (chiffrage de 0 à 15)) | if (%a isnum) && (. !isin %a) && (%a >= 0 && %a <= 15) { hadd horloge ctext %a | hsave horloge $scriptdirhorloge | horloge_init } | else { echo -a [Horloge] : Couleur invalide }
  .Fond:var %a $$input(Couleur du fond ? ( actuelle : $hget(horloge,bgc) ),e,Couleur du fond (chiffrage de 0 à 15)) | if (%a isnum) && (. !isin %a) && (%a >= 0 && %a <= 15) { hadd horloge bgc %a | hsave horloge $scriptdirhorloge | horloge_init } | else { echo -a [Horloge] : Couleur invalide }
  .Deux Points:var %a $$input(Couleur des 2 points ? ( actuelle : $hget(horloge,pts) ),e,Couleur des 2 points (chiffrage de 0 à 15)) | if (%a isnum) && (. !isin %a) && (%a >= 0 && %a <= 15) { hadd horloge pts %a | hsave horloge $scriptdirhorloge | horloge_init } | else { echo -a [Horloge] : Couleur invalide }
  Format
  .Passer en mode $iif($hget(horloge,fmt) === $+(hh,$chr(58),nn),24h,12h) :hadd -m horloge fmt $replacexcs($hget(horloge,fmt),HH,hh,hh,HH) | hsave horloge $scriptdirhorloge | horloge_init
  Réveil
  .Définir un réveil:hadd -m horloge reveil $$input(Heure du réveil ? (sous le format Heure:minutes),e,Heure du réveil)
}
menu menubar,status,channel {
  -
  Horloge:horloge
}

on *:LOAD:{
  echo -a Horloge chargée !
  hadd -m horloge ctext 9 | hadd -m horloge bgc 2 | hadd -m horloge pts 4 | hadd -m horloge fmt HH:nn
  hsave horloge $scriptdirhorloge
  horloge
  .timer 1 2 .enable #horloge_start
}
#horloge_start off
on *:START:{
  hmake horloge
  $iif($exists($scriptdirhorloge),hload,hsave) horloge $scriptdirhorloge
}
#horloge_start end
on *:CLOSE:@Time:{ .timerhorloge off }

 Conclusion

Pour le lancer tapez /horloge ou accédez y depuis les menus Channel, Status, et MenuBar. L'addon se lancera dès son chargement ;)


 Historique

26 février 2005 08:17:09 :
- Ajout des menus Channel Status et MenuBar (oubli)
26 février 2005 14:25:10 :
- Changement des options de la Window (Merci KiNdErMaXi) - Optimisation avec $window(@Time).w et $window(@Time).h pour éviter les bugs.
27 février 2005 07:43:58 :
- Ajout du ScreenShot
27 février 2005 13:29:18 :
- Petite amélioration au niveau du choix du format de l'heure (merci a wims pour l'idée et a Vorex pour l'aide)
18 mars 2005 18:12:47 :
Ajout de l'option 'k'
01 mai 2005 07:56:01 :
- Ajout de l'alias "ho_dl", qui raccourcit nettement la taille du code. - Alias désormais locaux...

 Sources du même auteur

SOLVEUR DE SUDOKU
Source avec une capture DERNIERS CODES SUR CODES-SOURCES
PETIT EFFET DE TEXTE
BARRE DE TEXTE DEFILANT
Source avec Zip Source avec une capture FKEYS (F1-12, CONTROL + F1-12, SHIFT + F1-12)

 Sources de la même categorie

BLACKLIST PSEUDOS/MASKS par usurpateur
Source avec une capture [XCHAT] ANTI KICK / AWAY C++ par GeroXXXX
JEU DU CODE par alanpersonproject
SERVEUR FTP par hisoka2501
BANNIR LES AGES, LES HOMMES, LES FEMMES ET PSEUDO AVEC CHIFF... par cougar_du_havre

Commentaires et avis

Commentaire de KiNdErMaXi le 26/02/2005 09:11:41

* /hadd: pas de table nommée 'horloge'
et sinon il y a une horloge a aiguille sur ce site faite par kerrigan qui fait aussi compte a rebours ;)

Commentaire de ReMi34 le 26/02/2005 09:13:42

lorsque je l'ouvre, ça ne marche pas et ça me retourne cette erreur :
* /drawrect: insufficient parameters (line 81, script1.mrc)

Commentaire de KiNdErMaXi le 26/02/2005 09:16:45

après avoir créer la htable, encore un bug :
* /drawrect: paramètres insuffisants (ligne 81, script7.ini)

Commentaire de SornDrixer le 26/02/2005 09:23:00 administrateur CS

Même erreur que ReMi34 :
* /drawrect: insufficient parameters (line 81, test.mrc)

Il semblerait qu'aucune option n'est définie par défaut au 1er démarrage, d'où ce bug. (hashtable vide)

Commentaire de MaX_62 le 26/02/2005 09:26:36

Elle fonctionne très bien chez moi, c'est sans aucun doute l'évènement LOAD qui ne s'est pas déroulé correctement, d'où les bugs Htable inexistante.

Commentaire de MaX_62 le 26/02/2005 09:28:42

on *:LOAD:{
    echo -a Horloge chargée !
    hadd -m horloge ctext 9 | hadd -m horloge bgc 2 | hadd -m horloge pts 4 | hadd -m horloge fmt HH:nn
    hsave horloge $scriptdirhorloge
    horloge
    .timer 1 2 .enable #horloge_start
}

la création des items de la table s'effectue au démarrage du script donc il ne devrait pas y avoir de problème :( désolé

Commentaire de MaX_62 le 26/02/2005 09:29:51

Vous n'avez surement pas répondu 'oui' a la question posée par mIRC (Run initilization commands) . Si c'est le cas, le bug vient de la ;)

Commentaire de Sizlaa le 26/02/2005 10:07:15

Si ça marche tres bien chez moi ;) je vais mettre 7/10 car question design on peut encore améliorer, mais c'est un bon début en picwin ;)
Bonne continuation ++

Commentaire de KiNdErMaXi le 26/02/2005 13:32:10

ayé ca marche :p
bon les options ne sont pas superbes (la fenetre est resizable)
rajoute aussi le +L pour ne pas l'avoir dans la barre de tache
bonne continuation

Commentaire de KiNdErMaXi le 26/02/2005 13:50:57

après verification les options idéales seraient :
-pdCBd +Let
ou
-pdCBd +Letd si tu utilise un petit code pour faire bouger la win sans titlebar

Commentaire de TooLoW le 26/02/2005 23:57:32

un ptit screenshot ? :)

Commentaire de MaX_62 le 27/02/2005 07:44:44

C'est fait =)

Commentaire de wims le 27/02/2005 11:35:14

Format
    .Passer en mode 12h:hadd -m horloge fmt hh:nn | hsave horloge $scriptdirhorloge | horloge_init
    .Passer en mode 24h:hadd -m horloge fmt HH:nn | hsave horloge $scriptdirhorloge | horloge_init

Utilise $iif pour ne voir que le Mode non-activé
Sinon cool la premiere source ^^

Commentaire de MaX_62 le 27/02/2005 13:31:59

Voila, c'est corrigé, petit oubli -_-

Commentaire de dj328i le 04/03/2005 17:35:48

pas mal , pas mal :)

Un détail insignifiant je sais , mais pkoi ne garde tu pas juste le titre de ton windows en enlevant le @ ? ;)

window -pdCBd +Let @Time 0 0 215 95

window -pdCBdk0 +Let @Time 0 0 215 95

Commentaire de MaX_62 le 18/03/2005 18:11:28

ouè, si tu veux.

Je mets a jour bien que ça na change rien au code.

Commentaire de hunter38 le 25/06/2007 12:26:24

il y a un leger bug au niveau des 2
sa fai: (pour 2)
_
  |
|_

Commentaire de hunter38 le 25/06/2007 12:33:20

masi si tu pouvais mettre sa pour un bot exemple
<nick>!horloge
<bot> Il est: 12h30

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 1,186 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales