Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

HOROSCOPE


Information sur la source

Catégorie :AddOns Niveau : Débutant Date de création : 02/05/2005 Date de mise à jour : 03/05/2005 07:16:44 Vu / téléchargé: 4 068 / 194

Note :
5 / 10 - par 1 personne
5,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

Commentaire sur cette source (7)
Ajouter un commentaire et/ou une note

Description

Voici un addon qui vous permettra, soit de récupérer l'horoscope de n'importe quel signe immédiatement, soit d'afficher celui ci a chaque démarrage du script, ou une fois par jour.
Caractéristiques : horoscopes récupérés a partir de http://www.horoscope.fr/ (socket), un peu de $regex, données stockées dans un .ini
Je sais que l'utilité ne plaira pas a tout le monde (moi le premier ^^), mais si ça peut servir a quelqu'un... :D
 

Source

  • dialog -l hor {
  • title "Horoscope"
  • size -1 -1 115 108
  • option dbu
  • tab "Horoscope", 1, 2 0 110 91
  • text "Votre signe :", 3, 7 18 33 8, tab 1
  • combo 4, 41 16 62 12, tab 1 drop
  • edit "Veuillez choisir votre signe...", 5, 5 30 104 58, tab 1 vsbar read multi return
  • tab "Options", 2
  • radio "Afficher à chaque démarrage du script.", 6, 6 16 105 10, tab 2
  • radio "Afficher une fois par jour.", 7, 6 26 74 10, tab 2
  • radio "Ne pas afficher.", 8, 6 36 50 10, tab 2
  • text "Raccourci :", 9, 6 47 38 10, tab 2
  • edit "", 10, 41 46 42 10, tab 2 autohs
  • text "Signe choisi :", 11, 6 60 33 8, tab 2
  • combo 12, 41 58 60 11, tab 2 drop
  • text "Note : Taper le raccourci affichera votre Horoscope dans la fenêtre active.", 13, 7 74 98 14, tab 2
  • button "Fermer", 14, 40 94 37 12, cancel
  • }
  • on *:LOAD:{
  • writeini $horpath hor rac !oro | writeini $horpath hor dem 6
  • writeini $horpath hor signe Belier | writeini $horpath hor date $ctime($fulldate)
  • echo -a [12Horoscope] Addon correctement installé ! Tapez /hor pour le lancer
  • }
  • on *:UNLOAD:{ .remove $horpath | echo -a [12Horoscope] Addon correctement désinstallé ! }
  • on *:START:{
  • var %o $readini($horpath,hor,dem)
  • if (%o == 8) { halt }
  • elseif ((%o == 6) || (%o == 7 && $ctime >= $readini($horpath,hor,date))) { horsock 2 }
  • }
  • on *:DIALOG:hor:*:*:{
  • if ($devent == init) {
  • did -c $dname $readini($horpath,hor,dem)
  • if ($readini($horpath,hor,rac)) { did -a $dname 10 $ifmatch }
  • didtok $dname 4,12 46 $horsignes
  • }
  • elseif ($devent == sclick) {
  • if ($did == 2) { did -c $dname 12 $findtok($horsignes,$readini($horpath,hor,signe),1,46) }
  • elseif ($did == 4) { horsock 1 | did -ra $dname 5 Veuillez patienter... }
  • elseif ($istok(6.7.8,$did,46)) { writeini $horpath hor dem $did }
  • elseif ($did == 12) { writeini $horpath hor signe $did(12) }
  • }
  • elseif ($devent == edit) { var %z $did(10) | $iif(%z,writeini,remini) $horpath hor rac %z }
  • }
  • on *:SOCKOPEN:hor:{
  • var %m $readini($horpath,hor,m)
  • remini $horpath hor hor
  • if (%m == 1 && $dialog(hor)) { sockwrite -n hor GET /horoscopes/horoscopes.php?Signe= $+ $did(hor,4) }
  • elseif (%m == 2) { sockwrite -n $sockname GET /horoscopes/horoscopes.php?Signe= $+ $readini($horpath,hor,signe) }
  • sockwrite -n $sockname Host: www.horoscope.fr $+ $str($crlf,2)
  • }
  • on *:SOCKREAD:hor:{
  • sockread %hor
  • if (align="justify" isin %hor && <img !isin %hor) { writeini $horpath hor hor $addtok($readini($horpath,hor,hor),$deltags(%hor),47) }
  • unset %hor
  • }
  • on *:SOCKCLOSE:hor:{
  • var %n $readini($horpath,hor,m)
  • tokenize 47 $readini($horpath,hor,hor)
  • if (%n == 1 && $dialog(hor)) {
  • did -ra hor 5 $+(Humeur :,$crlf,$1,$str($crlf,2),Amour :,$crlf,$2,$str($crlf,2),Travail :,$crlf,$3,$str($crlf,2),Vitalité :,$crlf,$4)
  • remini $horpath hor m | remini $horpath hor hor
  • }
  • if (%n == 2) {
  • var %p echo -a [12Horoscope]
  • %p Voici votre horoscope actuel $+($chr(40),,$readini($horpath,hor,signe),,$chr(41)) :
  • %p Humeur : $1 | %p Amour : $2 | %p Travail : $3 | %p Vitalité : $4
  • writeini $horpath hor date $ctime($puttok($fulldate,23:59:59,4,32))
  • }
  • }
  • on *:INPUT:*:{ if ($$readini($horpath,hor,rac) == $1-) { horsock 2 | haltdef } }
  • alias -l horpath return $scriptdirhoroscope.ini
  • alias -l horsock { writeini $horpath hor m $1 | sockclose hor | sockopen hor www.horoscope.fr 80 }
  • alias -l deltags { var %b = $regsub($1-,/(?:<.+?>)/g,,%i) | return %i }
  • alias -l horsignes return Belier.Taureau.Gemeaux.Cancer.Lion.Vierge.Balance.Scorpion.Sagittaire.Capricorne.Verseau.Poissons
  • alias hor dialog $+(-,$iif($dialog(hor),v,m)) hor hor
dialog -l hor {
  title "Horoscope"
  size -1 -1 115 108
  option dbu
  tab "Horoscope", 1, 2 0 110 91
  text "Votre signe :", 3, 7 18 33 8, tab 1
  combo 4, 41 16 62 12, tab 1 drop
  edit "Veuillez choisir votre signe...", 5, 5 30 104 58, tab 1 vsbar read multi return
  tab "Options", 2
  radio "Afficher à chaque démarrage du script.", 6, 6 16 105 10, tab 2
  radio "Afficher une fois par jour.", 7, 6 26 74 10, tab 2
  radio "Ne pas afficher.", 8, 6 36 50 10, tab 2
  text "Raccourci :", 9, 6 47 38 10, tab 2
  edit "", 10, 41 46 42 10, tab 2 autohs
  text "Signe choisi :", 11, 6 60 33 8, tab 2
  combo 12, 41 58 60 11, tab 2 drop
  text "Note : Taper le raccourci affichera votre Horoscope dans la fenêtre active.", 13, 7 74 98 14, tab 2
  button "Fermer", 14, 40 94 37 12, cancel
}
on *:LOAD:{ 
  writeini $horpath hor rac !oro | writeini $horpath hor dem 6 
  writeini $horpath hor signe Belier | writeini $horpath hor date $ctime($fulldate) 
  echo -a [12Horoscope] Addon correctement installé ! Tapez /hor pour le lancer 
}
on *:UNLOAD:{ .remove $horpath | echo -a [12Horoscope] Addon correctement désinstallé ! }
on *:START:{
  var %o $readini($horpath,hor,dem)
  if (%o == 8) { halt }
  elseif ((%o == 6) || (%o == 7 && $ctime >= $readini($horpath,hor,date))) { horsock 2 }
}
on *:DIALOG:hor:*:*:{
  if ($devent == init) { 
    did -c $dname $readini($horpath,hor,dem)
    if ($readini($horpath,hor,rac)) { did -a $dname 10 $ifmatch }
    didtok $dname 4,12 46 $horsignes
  }
  elseif ($devent == sclick) {
    if ($did == 2) { did -c $dname 12 $findtok($horsignes,$readini($horpath,hor,signe),1,46) }
    elseif ($did == 4) { horsock 1 | did -ra $dname 5 Veuillez patienter... }
    elseif ($istok(6.7.8,$did,46)) { writeini $horpath hor dem $did }
    elseif ($did == 12) { writeini $horpath hor signe $did(12) }
  }
  elseif ($devent == edit) { var %z $did(10) | $iif(%z,writeini,remini) $horpath hor rac %z }
}
on *:SOCKOPEN:hor:{
  var %m $readini($horpath,hor,m)
  remini $horpath hor hor
  if (%m == 1 && $dialog(hor)) { sockwrite -n hor GET /horoscopes/horoscopes.php?Signe= $+ $did(hor,4) }
  elseif (%m == 2) { sockwrite -n $sockname GET /horoscopes/horoscopes.php?Signe= $+ $readini($horpath,hor,signe) }
  sockwrite -n $sockname Host: www.horoscope.fr $+ $str($crlf,2)
}
on *:SOCKREAD:hor:{ 
  sockread %hor 
  if (align="justify" isin %hor && <img !isin %hor) { writeini $horpath hor hor $addtok($readini($horpath,hor,hor),$deltags(%hor),47) } 
  unset %hor 
}
on *:SOCKCLOSE:hor:{
  var %n $readini($horpath,hor,m)
  tokenize 47 $readini($horpath,hor,hor)
  if (%n == 1 && $dialog(hor)) { 
    did -ra hor 5 $+(Humeur :,$crlf,$1,$str($crlf,2),Amour :,$crlf,$2,$str($crlf,2),Travail :,$crlf,$3,$str($crlf,2),Vitalité :,$crlf,$4) 
    remini $horpath hor m | remini $horpath hor hor 
  }
  if (%n == 2) { 
    var %p echo -a [12Horoscope] 
    %p Voici votre horoscope actuel $+($chr(40),,$readini($horpath,hor,signe),,$chr(41)) : 
    %p Humeur : $1 | %p Amour : $2 | %p Travail : $3 | %p Vitalité : $4 
    writeini $horpath hor date $ctime($puttok($fulldate,23:59:59,4,32)) 
  }
}
on *:INPUT:*:{ if ($$readini($horpath,hor,rac) == $1-) { horsock 2 | haltdef } }
alias -l horpath return $scriptdirhoroscope.ini
alias -l horsock { writeini $horpath hor m $1 | sockclose hor | sockopen hor www.horoscope.fr 80 }
alias -l deltags { var %b = $regsub($1-,/(?:<.+?>)/g,,%i) | return %i }
alias -l horsignes return Belier.Taureau.Gemeaux.Cancer.Lion.Vierge.Balance.Scorpion.Sagittaire.Capricorne.Verseau.Poissons
alias hor dialog $+(-,$iif($dialog(hor),v,m)) hor hor

Conclusion

Pour lancer l'addon : /hor
Et surtout, il faut accepter le message de mIRC (run initialization commands)

voila ^_^
 

Fichier Zip

Pour les "Membres Club", vous pouvez télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip

Historique

02 mai 2005 21:00:22 :
- Ajout d'un zip, apparemment, la source est pas super bien mise en page...
03 mai 2005 07:16:44 :
- Optimisation du code, merci tout le monde :)

Commentaires et avis

signaler à un administrateur
Commentaire de KiNdErMaXi le 02/05/2005 22:08:52

  combo 4, 41 16 62 12, tab 1 drop <= merci pour ceux qui sont sous win 98 :(

jvais pas juger sur l'utilité sinon ca vaut un zéro :p
sinon ca a l'air plutot bien codé meme si j'ai tjs pas compris les socket tcp mais bon :(

signaler à un administrateur
Commentaire de COOLMAN002 le 02/05/2005 22:58:50

J'ai survoler le code et:

>
    if (%m == 1 && $dialog(hor)) { sockwrite -n hor GET http://www.horoscope.fr/horoscopes/horoscopes.php?Signe= $+ $did(hor,4) }
<
ça peut devenir:

if (%m == 1 && $dialog(hor)) { sockwrite -n hor GET /horoscopes/horoscopes.php?Signe= $+ $did(hor,4) }

je crois :\

Ton alias "deltags", peut devenir local :]
ton dialog aussi (le lancé via l'alias suffit)
dialog -l hor {

  combo 4, 41 16 62 12, tab 1 drop

pk 12 ? on voit ke-dal :\

signaler à un administrateur
Commentaire de Nolson le 02/05/2005 23:24:23

*Doit figurer à la racine du mirc sinon ça marche pas. (j'ai essayé de le loader depuis mon dossier téléchargement et il est inopérant)

*Au premier chargement nous balance en echo le signe belier, même avant de demander quoique ce soit.

*Bon point : Utilisation des Regex pour apurer les infos entrantes.

*Petit addon fonctionnel et sympa, même si cela ne m'interesse pas du tout.

signaler à un administrateur
Commentaire de PaDa le 02/05/2005 23:43:42

- dans ton SOCKCLOSE, un tokenize 47 blabla aurait ptet amélioré la lisibilité :p
- A quoi servent les parenthèses non capturantes dans la regex ? :D
- Pas vrmt de commentaire sinon, bonne continuation ^^

signaler à un administrateur
Commentaire de winwarrior le 03/05/2005 01:47:21

heu .. ça va dans l'ensemble apart un ptit détail qui me trouble:
dans le protocol http pour une requette GET ou POST il faut pas rajouter HTTP/<version> (ex: HTTP/1.0) à la fin ?
>> GET /page.ext HTTP/<version>
je doute que ça fonctionne sur tous les serveurs sinon .. je pense que t'aurais une belle erreur 400 :p

signaler à un administrateur
Commentaire de MaX_62 le 08/05/2005 18:33:03

Peut etre, en tout cas ça fonctionne sur ce site, donc c'est pas trop génant je pense ^^

signaler à un administrateur
Commentaire de djdadou le 27/09/2007 09:05:51

bonjour, heu sa marche pas :(
message erreur : * /did: insufficient parameters (line 33, script10.ini)
-
peut - on m'aider svp

Ajouter un commentaire



Nos sponsors

Sondage...

CalendriCode

Juillet 2009
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
2728293031  

Consulter la suite du CalendriCode

Comparez les prix Nouvelle version

Photothèque Nouveau !



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
Temps d'éxécution de la page : 0,546 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.