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 / Exemple :
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 ^_^
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.