Ce code est en fait un regroupement des codes Météo et Départements déjà présents sur ce site, mais rajoute à ceux-là une image "Ensoleillement de la Terre à l'heure actuelle"
Je suis parti du code Météo, que j'ai bien largement amélioré :
- il télécharge désormais le fichier GUI-ArKanis.mrc et le charge automatiquement dès qu'il est nécessaire, ainsi que le fichier departements.ini
- la fonction désinstallation est plus performante
- de nombreux bugs ont été corrigés
URL de la source Météo de laquelle je suis parti :
http://www.ircfr.com/codes/METEO-PICWIN-FRANCE-DOM-TOM_41367.aspx
Je rappelle que la météo présentée est celle de la France et de ses DOM-TOM
Le code Départements :
- Fonction recherche bien plus interessante (localise directement sur la carte le résultat de la recherche)
- Design refait (un rectangle où s'affichent les infos s'ouvre en passant la souris sur un département)
- Jeu recodé entièrement
URL de la source Départements que j'ai utilisée :
http://www.ircfr.com/codes/DEPARTEMENTS-FRANCAIS-INTERACTIF-JEU-PICWIN_33941.aspx
Le code Ensoleillement :
- Tout nouveau
- Télécharge l'image de l'ensoleillement sur un site internet
- Possibilité de choisir quel format télécharger (choix entre 1600 et 1024)
Si je fais une nouvelle sources, c'est tout d'abord parce que je pense laisser en libre téléchargement la météo et les départements individuellement, et qu'autrement je ne savais pas laquelle des deux modifier :)
En plus, comme ça je peux tester si l'envoi de sources fonctionne toujours, ce qui n'est pas le cas de uaip, à ce qu'il paraît
Une aide est inclue dans un des menus (comme d'habitude).
mIRC version 6.17 minimum, 6.21 très largement conseillée ! (il y a un bug graphique avec la 6.17)
Source / Exemple :
;*********************************
; Meteo, Departements & SunLight
; By ArKanis
; www.arkanis.eu
;*********************************
; Version 2.2
; Powered by
; www.lachainemeteo.com
; &
; www.die.net/earth
alias meteo {
if ($version < 6.17) {
return $input(Il faut impérativement avoir une version de mIRC plus récente ou équivalente à la version 6.17,o)
}
if ($window(@DepCache)) window -c @DepCache
if ($hget(@DepDL)) hfree $ifmatch
if ($hget(@DepDLDo)) hfree $ifmatch
var %l = france.bmp departements.ini, %t = 1, %m = $numtok(%l,32)
while %t <= %m {
var %w = $gettok(%l,%t,32)
if (!$exists($meteo.f(%w))) hadd -m @DepDL %w 1
inc %t
}
if (!$script(GUI-ArKanis.mrc)) {
if ($findfile($mircdir,GUI-ArKanis.mrc,1)) {
.load -rs $qt($ifmatch)
.timer 1 1 meteo
return
}
else {
hadd -m @DepDL GUI-ArKanis.mrc 1
dep.DL
return
}
}
if (!$isalias(²picwin)) {
if ($?!="L'alias ²picwin n'existe pas. Voulez-vous retélécharger le code GUI-ArKanis pour corriger ce problème ?") hadd -m @DepDL GUI-ArKanis.mrc 1
else return
}
if ($hget(@DepDL)) dep.DL
else {
²freehash @Dep Colors Nums DL DLDo
hmake @DepColors 20
hload -i @DepColors $meteo.f(departements.ini) Couleur
hmake @DepNums 20
hload -i @DepNums $meteo.f(departements.ini) Num
²picwin @Meteo 500 500 "Meteo"
titlebar @Meteo By ArKanis
²newmenu @Meteo Consulter la météo
²newitem @Meteo En France:²meteo.sel France,DOM TOM:²meteo.sel,$chr(9),Changer le jour:²meteo.selday,$chr(9),Fermer:²close @Meteo
²newmenu @Meteo Autres écrans
²newitem @Meteo Vigilance:²meteo.vigilance,Recherche:²meteo.rech
²newmenu @Meteo Départements
²newitem @Meteo Voir la carte:²meteo.dep,Jouer:²meteo.play
²newmenu @Meteo Ensoleillement
²newitem @Meteo Voir la carte:²meteo.ens,Configurer:²meteo.enscfg
²newmenu @Meteo ?
²newitem @Meteo Aide:²meteo.aide,Crédits:²meteo.credits,Désinstaller:²meteo.delete
if ($1 == dep) ²drawmenu @Meteo 3 1
elseif ($1 == sunlight) ²drawmenu @Meteo 4 1
else ²drawmenu @Meteo $iif($exists($meteo.f(Backup.png)),1 1,5 1)
²description @Meteo Temps 400
²ref @Meteo
}
}
alias ²meteo.sel {
if (!$window(@Meteo)) return
if ($hget(Meteo,Jour) !isnum 0-9) hadd -m Meteo Jour 0
if ($1) {
hadd -m Meteo Link $+(index.php?langue=fr&echeance=,$hget(Meteo,Jour))
²meteoopen France
}
else {
²centre @Meteo -b 40 Sélection d'un DOM-TOM
²centre @Meteo 225 Sélectionnez votre DOM-TOM
²select @Meteo 100 150 245 200 30 Guadeloupe¥Martinique¥Guyane¥La Réunion¥St Pierre et Miquelon¥Mayotte¥Polynésie Française¥Nouvelle Calédonie¥Wallis et Futuna
²button @Meteo 101 200 280 100 20 Sélectionner
²setdefault @Meteo 101
²description @Meteo 100 Change la région sélectionnée dans une permutation circulaire
²description @Meteo 101 Affiche la météo de la région choisie
}
}
alias ²meteo.selday {
if (!$window(@Meteo)) return
²centre @Meteo -b 40 Sélection du jour
var %l = Aujourd'hui¥Demain¥Après-Demain¥Dans 3 jours¥Dans 4 jours¥Dans 5 jours¥Dans 6 jours, %s = $gettok(%l,$calc($hget(Meteo,Jour) +1),165)
if ($hget(Meteo,Jour) isnum 0-6) {
while ($gettok(%l,1,165) != %s) var %l = $addtok($deltok(%l,1,165),$gettok(%l,1,165),165)
}
²select @Meteo 102 200 245 100 30 %l
²button @Meteo 103 200 280 100 20 Sélectionner
²setdefault @Meteo 103
²description @Meteo 103 Donne la météo prévue pour dans X jours pour toutes les demandes à venir
}
alias ²meteo.rech {
²centre @Meteo -b 40 Recherche
²centre @Meteo 70 Entrez le nom de la ville ou son code postal
²edit @Meteo -a 8 200 110 100 20
²button @Meteo 9 200 135 100 20 Rechercher
²setdefault @Meteo 9
²description @Meteo 9 Etablie une liste des résultats trouvés pour sélectionner rapidement une ville
}
alias meteo.answer if ($1 == ²meteo.rech) meteo.sclick 9 $2
alias ²meteo.delete {
²close @Meteo
noop $findfile($meteo.f,*,0,.remove $qt($1-))
.rmdir Meteo
window -a "Status Window"
if ($?!="Souhaitez-vous décharger le fichier $script (contient la Météo) ?") {
if (!$?!="Voulez-vous GARDER le fichier ?") .timer 1 1 .remove $qt($script)
.timer 1 1 .unload -rs $qt($script)
}
var %s = $script(GUI-ArKanis.mrc)
if ((%s) && ($?="Voulez-vous décharger le code GUI-ArKanis ?")) {
.unload -rs GUI-ArKanis.mrc
echo 2 -at * Déchargement du code GUI-ArKanis effectué.
}
if (($exists(%s)) && ($?!="Voulez-vous effacer le fichier GUI-ArKanis.mrc ?")) {
.remove $qt(%s)
echo 2 -at * Effacement du fichier GUI-ArKanis.mrc effectué.
}
}
;**************
;Données du GUI
;**************
alias meteo.menu {
sockclose meteo*
if (($1) && ($hget(MeteoLocation))) hfree MeteoLocation
}
alias meteo.close {
²freehash @Dep Colors Num DL DLDo Jeu
hfree -w Meteo*
if ($window(@Meteo.copyVilles)) window -c $ifmatch
if ($window(@DepCache)) window -c $ifmatch
if ($window(@DepCache2)) window -c $ifmatch
}
on *:close:@Meteo:meteo.close
alias meteo.mouse {
if (!$window(@Meteo)) return
var %x = $1, %y = $2
if ($hget(@Meteo,Main) == ²meteo.dep) {
var %c = $rgb($getdot(@DepCache2,$1,$2))
if (($inrect($1,$2,40,70,500,500)) && ($hget(@DepColors,%c))) {
var %x = $calc($1 +10), %y = $calc($2 +4), %l = $+($ifmatch,¥,$hget(@DepNums,$ifmatch)), %z = Numéro :-Département :-Préfecture :-Région :
if ($hget(@Dep,Temp) == %c) return
drawcopy -n @DepCache 0 0 500 470 @Meteo 0 0
hadd -m @Dep Temp %c
var %t = 1, %w = 100, %h = 46
while %t <= 4 {
if ($width($gettok(%z,%t,45) $gettok(%l,%t,165),Tahoma,10,0,1) > %w) var %w = $v1
inc %t
}
if (!%w) return
inc %w 6
if ($calc(%x + %w) > 497) dec %x $calc(%w +20)
if ($calc(%y + %h) > 469) dec %y $calc(%h +8)
drawrect -fnr @Meteo 16761024 1 %x %y %w %h
drawrect -nr @Meteo 0 1 %x %y %w %h
var %i = 1
while %i <= 4 {
drawtext -pnr @Meteo 0 Tahoma 10 $calc(%x +3) $calc(%y + %i *10-8) $gettok(%z,%i,45) $gettok(%l,%i,165)
inc %i
}
drawdot @Meteo
}
elseif ($hget(@Dep,Temp)) {
drawcopy -n @DepCache 0 0 500 470 @Meteo 0 0
hdel @Dep Temp
}
}
else {
var %x = $1, %y = $2, %g
var %f = $hget(Meteo,Origin), %ox = $gettok(%f,1,32), %oy = $gettok(%f,2,32), %dx = $gettok(%f,3,32), %dy = $gettok(%f,4,32)
if (($inrect(%x,%y,%ox,%oy,%dx,%dy)) && ($hget(MeteoLocation)) && ($hget(Meteo,Ready))) {
var %t = 1, %l = MeteoLocation
while $hget(%l,%t).item {
var %i = $ifmatch, %d = $hget(%l,%i)
tokenize 32 %d
if ($inrect(%x,%y,$1,$2,35,28)) {
var %g = 1
if ($hget(MeteoTemp,Loc) == %i) break
hadd -m MeteoTemp Loc %i
.²backup @Meteo Villes
if (!$window(@Meteo.copyVilles)) ²svg @Meteo Villes
var %ht = $+(MeteoVille,$hget(Meteo,Period))
if (!$hget(%ht,0).item) var %ht = MeteoVille0
var %t1 = $replace(%i,$chr(165),$chr(32)), %t2 = T° : $gettok($hget(%ht,%i),3,32), %dy = 32
if (%t2 == T° : ø) var %t2, %dy = $calc(%dy - 14)
var %w = $max($width(%t1,Tahoma,10),$width(%t2,Tahoma,10)), %ox = $calc($1 -4 - %w / 2), %oy = $calc($2 -26)
drawrect -nr @Meteo 0 1 $calc($1 - %w) %oy $calc(%w +6) %dy
drawrect -fnr @Meteo 16761024 1 $calc($1 - %w +1) $calc(%oy +1) $calc(%w +4) $calc(%dy -2)
drawtext -nr @Meteo 0 Tahoma 10 $calc($1 -%w + (%w +6- $width(%t1,Tahoma,10)) /2) $calc(%oy + 2) %t1
if (%t2) drawtext -nr @Meteo 0 Tahoma 10 $calc($1 -%w + (%w +6- $width(%t2,Tahoma,10)) /2) $calc(%oy +17) %t2
²ref @Meteo
break
}
inc %t
}
if (%g) return
}
if ((!%g) && ($hget(MeteoTemp,Loc))) {
hdel MeteoTemp Loc
²backup @Meteo Villes
}
if ((!$hget(MeteoVille,Vigilance)) && ($hget(Meteo,Jour) <= 2) && ($hget(Meteo,Ready)) && (!$hget(@Meteo,Main))) {
if (($inrect(%x,%y,49,471,56,23)) && ($hget(Meteo,Period) != 0)) {
hadd -m Meteo Period 0
²efface @Meteo 25 60 450 410
.meteo.fond.apply Meteo/Backup.png
meteo.fond.apply
}
elseif (($inrect(%x,%y,371,471,79,23)) && ($hget(Meteo,Period) != 1)) {
hadd -m Meteo Period 1
²efface @Meteo 25 60 450 410
.meteo.fond.apply Meteo/Backup.png
meteo.fond.apply
}
}
}
}
alias meteo.sclick {
if (!$window(@Meteo)) return
var %x = $mouse.x, %y = $mouse.y
if ($hget(@Meteo,Main) == ²meteo.dep) {
if ($hget(@Meteo,On)) {
hdel @Meteo On
meteo.newgame
return
}
if ($inrect(%x,%y,40,70,500,500)) {
var %c = $rgb($getdot(@DepCache2,%x,%y))
if ($hget(@DepColors,%c)) {
var %g = $ifmatch
url -n $+(http://www.quid.fr/departements.html?mode=detail&style=fiche,&dep=,$iif(%g < 10,$+(0,%g),%g))
}
}
}
elseif ($hget(@Meteo,Main) == ²meteo.play) {
if ($inrect(%x,%y,40,70,500,500)) {
var %c = $rgb($getdot(@DepCache2,%x,%y))
if ($hget(@DepColors,%c)) {
var %it = $ifmatch
if ($istok($hget(@DepJeu,Sol),%it,165)) {
hadd -m @DepJeu Score $+($calc($gettok($hget(@DepJeu,Score),1,47) + $iif(!$hget(@DepJeu,Aide),2,1)),/,$calc($gettok($hget(@DepJeu,Score),2,47) +1))
hadd -m @DepJeu Last 1
meteo.newgame
meteo.mouse %x %y
}
elseif (!$hget(@DepJeu,$+(Clic,%it))) {
hadd -m @DepJeu Score $+($gettok($hget(@DepJeu,Score),1,47),/,$calc($gettok($hget(@DepJeu,Score),2,47) +1))
hinc -m @DepJeu Aide
tokenize 44 $hfind(@DepColors,$gettok($hget(@DepJeu,Sol),1,165)).data
hadd -m @DepJeu Last 0
if (($hget(@DepJeu,Aide) == 4) && ($rgb($1,$2,$3))) drawrect -fnr @Meteo $ifmatch 1 250 450 50 20
elseif ($hget(@DepJeu,Aide) > 7) meteo.newgame
hadd -m @DepJeu $+(Clic,%it) 1
}
²efface @Meteo 10 40 60 20
drawtext -cnr @Meteo 12 Tahoma 0 10 40 60 20 $hget(@DepJeu,Score)
drawdot @Meteo
}
}
}
elseif ($left($hget(@Meteo,Main),10) == ²meteo.ens) {
if ($1 == 300) {
if ($exists($meteo.f(map.jpg))) run $qt($meteo.f(map.jpg))
if ($window(@²Desc)) window -c $ifmatch
}
elseif ($1 == 301) writeini -n $meteo.f(departements.ini,Config,Resol) $²did(@Meteo,301)
elseif ($1 == 302) ²menu.do @Meteo ²meteo.ens
}
else {
if ($1 == 101) {
var %g = $calc(96 + $findtok(Guadeloupe¥Martinique¥Guyane¥La Réunion¥St Pierre et Miquelon¥Mayotte¥Polynésie Française¥Nouvelle Calédonie¥Wallis et Futuna,$²did(@Meteo,100),1,165))
hadd -m Meteo Link $+(index.php?langue=fr&echeance=,$hget(Meteo,Jour),&domtom=,%g)
²meteoopen $²did(@Meteo,100)
}
elseif ($1 == 103) {
hadd -m Meteo Jour $calc($findtok(Aujourd'hui¥Demain¥Après-Demain¥Dans 3 jours¥Dans 4 jours¥Dans 5 jours¥Dans 6 jours,$²did(@Meteo,102),1,165) -1)
²drawmenu @Meteo 1 1
}
elseif ($hget(MeteoTemp,Loc)) {
var %i = $ifmatch
if ($hget(Meteo,Jour) < 3) var %t = $hget(Meteo,Period)
else var %t = 0
hadd -m Meteo Link $+(index_detail.php?langue=fr&echeance=,$hget(Meteo,Jour),&num_ville=,$gettok($hget($+(MeteoVille,%t),%i),5,32))
²meteoopen $hget(MeteoTemp,Loc)
}
elseif ($1 == 9) {
if ($²did(@Meteo,8)) {
hadd -m Meteo Link $+(moteur_recherche.php?langue=fr&txt_search=,$ifmatch)
²efface @Meteo 150 195 210 230
if ($hget(@MeteoButtons,11)) hdel @MeteoButtons 11
hadd -m MeteoVille Rech 1
.meteo.wait Recherche
.²meteoopen
}
}
elseif ($1 == 11) {
if (!$hget(Meteo,Jour)) hadd -m Meteo Jour 0
var %v = $replace($²did(@Meteo,10),$chr(32),$chr(165)), %r = /(\([^\)]+\))/g
hadd -m Meteo Link $+(index_detail.php?langue=fr&echeance=,$hget(Meteo,Jour),&num_ville=,$hget(MeteoVille,%v))
²meteoopen $regsubex(%v,%r,)
}
}
}
alias meteo.edit .timermeteoedit -m 1 500 meteo.edit2 $1-
alias meteo.edit2 {
if ($1 == 200) {
tokenize 32 $replace($²did(@Meteo,$1),-,$chr(32))
if ($1-) {
var %r = $1-, %t = 1
drawcopy -n @DepCache2 0 0 500 470 @Meteo 0 0
while $hget(@DepNums,%t).data {
var %i = 1, %m = $0, %n = $hget(@DepNums,%t).item, %h = $+(%n,¥,$replace($ifmatch,-,$chr(165),$chr(32),$chr(165))), %ok = 1
var %c = $hfind(@DepColors,%n).data, %rgb = $rgb($gettok(%c,1,44),$gettok(%c,2,44),$gettok(%c,3,44))
if (%rgb) {
while %i <= %m {
var %f = $gettok($1-,%i,32)
if (%f isnum) var %re = %f
else var %re = $+(%f,$iif(%i == %m,*))
if (!$wildtok(%h,%re,1,165)) unset %ok
inc %i
}
if (%ok) drawreplace -nr @Meteo %rgb 255 40 70 427 397
}
inc %t
}
drawcopy -n @Meteo 0 0 500 470 @DepCache 0 0
}
else {
drawcopy -n @DepCache2 0 0 500 470 @Meteo 0 0
drawcopy -n @Meteo 0 0 500 470 @DepCache 0 0
}
drawdot @Meteo
}
}
;*******
;Sockets
;*******
alias -l ²meteoopen {
if (!$window(@Meteo)) return
if ($window(@Meteo.copyVilles)) window -c $ifmatch
if ($show) {
meteo.wait
²centre @Meteo -b 40 $replace($1-,¥,$chr(32)) $meteo.date($iif($hget(Meteo,Jour) isnum 0-,$ifmatch,0))
if ($hget(Meteo,Jour) <= 2) {
var %p = 51
while %p < 451 {
drawline -nr @Meteo $rgb($calc(30 + %p /2),250,$calc(255 - %p /2)) 2 %p 471 %p 494
inc %p 2
}
drawrect -nr @Meteo 0 1 49 470 402 26
drawtext -nr @Meteo 8388608 Tahoma 12 60 475 MATIN
drawtext -nr @Meteo 8388608 Tahoma 12 376 475 APRES-MIDI
}
}
sockclose meteo
sockopen meteo www.lachainemeteo.com 80
}
alias -l meteo.date {
var %d = $+($chr(40),$date($calc($ctime + 86400 * $1)),$chr(41))
if ($1 == 0) return aujourd'hui %d
if ($1 == 1) return demain %d
if ($1 == 2) return après-demain %d
else return dans $1 jours %d
}
on *:sockopen:meteo:{
if ($hget(MeteoQueue)) hfree MeteoQueue
var %t
if ($hget(MeteoVille,Rech)) var %t = 1
hfree -w MeteoVille*
if (%t) hadd -m MeteoVille Rech 1
hfree -w MeteoTemp
hadd -m Meteo Period 1
sockwrite -n $sockname GET $+(http://www.lachainemeteo.com/,$$hget(Meteo,Link)) HTTP/1.0
sockwrite -n $sockname $+(Host: lachainemeteo.com,$str($crlf,2)))
}
on *:sockread:meteo:{
var %a
sockread %a
if ($gettok(%a,1,9) == .Fond_Carte) sockmark $sockname FOND
elseif (($regex(%a,/background-image:url\('(.+)'\)/gi)) && ($sock($sockname).mark == FOND)) {
fond.meteo $regml(1)
sockmark $sockname 0
}
elseif ($regex(%a,Menu_Periode_200_([0-9])_J([0-9]))) {
if ($regml(2) != $hget(Meteo,Jour)) sockmark $sockname 0
else {
hadd -m MeteoTemp Heure $regml(1)
sockmark $sockname VILLES
if ($exists(Meteo/Backup.png)) drawpic -n @Meteo 50 70 Meteo/Backup.png
drawrect -nr @Meteo 0 1 49 69 402 402
²centre @Meteo 240 Chargement en cours ...
}
}
elseif ($regex(%a,bloc_ephem_j([0-9]))) {
if ($regml(1) == $hget(Meteo,Jour)) sockmark $sockname Ephemerides
}
elseif ($sock($sockname).mark == Ephemerides) {
if ($regex(%a,/height: 30px;.+>([^>]+)</div>$/i)) hadd -m MeteoVille Eph $hget(MeteoVille,Eph) $replace($regml(1),$chr(32),$chr(165))
elseif ($regex(%a,(-?[0-9]+)°C)) hadd -m MeteoVille Eph $hget(MeteoVille,Eph) $replace($+($regml(1),°C),$chr(32),$chr(165))
elseif ($regex(%a,/height: 13px;.+">(.+)</div>/U)) hadd -m MeteoVille Eph $hget(MeteoVille,Eph) $replace($regml(1),<br>,$chr(165),$chr(32),$chr(165))
elseif ($regex(%a,/(Lever|Coucher) : <[^>]+>([^<]+)</span></div>/i)) hadd -m MeteoVille Eph $hget(MeteoVille,Eph) $replace($regml(2),$chr(32),$chr(165))
elseif ($regex(%a,/info([0-9])_ephem/i)) {
if (($regml(1) isnum 2-) && ($regex(H,%a,/>([^>]+)</div>/i))) hadd -m MeteoVille Eph $hget(MeteoVille,Eph) $replace($regml(H,1),$chr(32),$chr(165))
}
}
elseif ($regex(%a,/num_ville=([0-9]+)".+class="Liste_Elt_href">(.+)</a>/gU)) {
hadd -m MeteoVille Rech $addtok($hget(MeteoVille,Rech),$regml(2),165)
hadd -m MeteoVille $replace($regml(2),$chr(32),$chr(165)) $regml(1)
}
elseif ($regex(%a,/src="/image/logo/lachainemeteo/lcm_60x40.gif"/i)) sockmark $sockname VILLES
elseif ($sock($sockname).mark == VILLES) {
if ($regex(%a,/Periode_Temps_([0-1])/i)) hadd -m MeteoTemp Heure $regml(1)
if ($regex(%a,(-?[0-9]+) &\#176;)) hadd -m $+(MeteoVille,$hget(MeteoTemp,Heure)) $hget(MeteoTemp,Ville) $regml(1) $hget(MeteoTemp,Pic) $hget(MeteoTemp,CP)
elseif ($regex(%a,num_ville=([0-9]+))) hadd -m MeteoTemp CP $regml(1)
else {
if ($regex(%a,src="(.+)" class='Lien_Icone')) {
var %i = $regml(1), %f = $gettok(%i,-1,47)
if (!$exists($+(Meteo/,%f))) dl.meteo %i 1
hadd -m MeteoTemp Pic %f
}
var %r = /left\:(-?[0-9]+\.?[0-9]?)px\;top\:([0-9]+\.?[0-9]?)px.+'(.+)'/ig
if ($regex(%a,%r)) hadd -m MeteoTemp Ville $remove($replace($regml(3),é,é,è,è,ç,ç,$chr(32),$chr(165),#039;,',ï,ï),&) $regml(1) $regml(2)
}
}
}
on *:sockclose:meteo:{
if ($hget(Meteo,Link)) hdel Meteo Link
if ($hget(MeteoVille,Rech)) {
if ($deltok($hget(MeteoVille,Rech),1,165)) {
²list @Meteo 10 150 200 200 200 $v1
²button @Meteo 11 150 405 200 20 Sélectionner
²setdefault @Meteo 11
}
else {
²efface @Meteo 150 195 210 230
²centre @Meteo 240 Aucun résultat !
}
hdel MeteoVille Rech
drawdot @Meteo
}
}
alias -l fond.meteo {
if (!$isdir(Meteo)) mkdir Meteo
var %f = $meteo.f($+(fond.,$extension($1-)))
if ($exists(%f)) .remove %f
hadd -m Meteo Fond $1-
hadd -m Meteo Fond2 %f
sockclose MeteoFond
sockopen MeteoFond www.lachainemeteo.com 80
}
on *:sockopen:MeteoFond:{
sockwrite -n $sockname GET $$hget(Meteo,Fond) HTTP/1.0
sockwrite -n $sockname $+(Host: lachainemeteo.com,$str($crlf,2)))
}
on *:sockread:MeteoFond:{
var %a
sockread &a
if ((!$sock($sockname).mark) && ($bfind(&a, 1,$str($crlf,2)))) {
bcopy &b 1 &a $calc($ifmatch +4) -1
if ($bvar(&b,0)) bwrite $hget(Meteo,Fond2) -1 -1 &b
sockmark $sockname 1
}
elseif ($bvar(&a,0)) bwrite $hget(Meteo,Fond2) -1 -1 &a
}
on *:sockclose:MeteoFond:meteo.fond.apply
alias -l meteo.fond.apply {
if (!$window(@Meteo)) return
var %f = $hget(Meteo,Fond2)
if ($1-) var %f = $1-
elseif (!%f) var %f = $meteo.f(fond.png)
if (!$exists(%f)) return
var %x = $pic(%f).width, %y = $pic(%f).height, %ox = $calc(250 - %x / 2), %oy = $calc(270 - %y /2)
drawrect -nr @Meteo 0 1 $calc(%ox -1) $calc(%oy -1) $calc(%x +2) $calc(%y +2)
drawpic -n @Meteo %ox %oy $shortfn(%f)
if ($show) {
hdel -w Meteo Fond*
hadd -m Meteo Origin %ox %oy %x %y
if ((!$sock(Meteo.dl)) && (!$hget(MeteoQueue,0).item)) meteo.generate
}
}
alias -l dl.meteo {
hadd -m MeteoQueue $1- 1
if ($exists($+(Meteo/,$gettok($1,-1,47)))) .remove $meteo.f($gettok($1,-1,47))
if ($sock(dl.meteo)) return
.timer -h 1 500 dl.meteo.do
}
alias -l dl.meteo.do {
var %f = $hget(MeteoQueue,1).item
if (!%f) {
if (!$sock(MeteoFond)) meteo.generate
return
}
hadd -m MeteoTemp DL %f
hadd -m MeteoTemp DLName $meteo.f($gettok(%f,-1,47))
sockclose Meteo.dl
sockopen Meteo.dl www.lachainemeteo.com 80
}
on *:sockopen:Meteo.dl:{
sockwrite -n $sockname GET $$hget(MeteoTemp,DL) HTTP/1.0
sockwrite -n $sockname $+(Host: lachainemeteo.com,$str($crlf,2)))
}
on *:sockread:Meteo.dl:{
sockread &a
if ((!$sock($sockname).mark) && ($bfind(&a, 1,$str($crlf,2)))) {
bcopy &b 1 &a $calc($ifmatch +4) -1
if ($bvar(&b,0)) bwrite $$hget(MeteoTemp,DLName) -1 -1 &b
sockmark $sockname 1
}
elseif ($bvar(&a,0)) bwrite $$hget(MeteoTemp,DLName) -1 -1 &a
}
on *:sockclose:Meteo.dl:{
if ($hget(MeteoQueue,$hget(MeteoTemp,DL))) hdel MeteoQueue $hget(MeteoTemp,DL)
hdel -w MeteoTemp DL*
dl.meteo.do
}
alias -l meteo.generate {
if (!$window(@Meteo)) return
if ($window(@Meteo.copyVilles)) window -c @Meteo.copyVilles
var %t = 1, %p = MeteoLocation
if ($hget(%p)) hfree %p
var %ht = $+(MeteoVille,$hget(Meteo,Period)), %f = $hget(Meteo,Origin), %ox = $gettok(%f,1,32), %oy = $gettok(%f,2,32), %x = $gettok(%f,3,32)
if (!$hget(%ht,0).item) var %ht = MeteoVille0
if ($pic(Meteo/fond.png).width > 350) .copy -o $qt($meteo.f(fond.png)) $qt($meteo.f(Backup.png))
while $hget(%ht,%t).item {
var %i = $ifmatch, %d = $hget(%ht,%i)
tokenize 32 %d
if (anim !isin $4) drawpic -tn @Meteo 0 $calc($1 + %ox) $calc($2 + %oy) $shortfn($meteo.f($4))
else drawpic -ctn @Meteo 16777215 $calc($1 + %ox) $calc($2 + %oy) $shortfn($meteo.f($4))
if ($3 != ø) drawtext -nr @Meteo 0 Tahoma 10 $calc($1 + %ox + 15) $calc($2 + %oy + 25) $+($3,°)
hadd -m %p %i $calc($1 + %ox) $calc($2 + %oy)
inc %t
}
if (!$hget(MeteoVille,Vigilance)) {
var %te = $meteo.translate($puttok($asctime(dd mm yyyy),$calc($asctime(dd) + $hget(Meteo,Jour)),1,32)) $iif($hget(Meteo,Jour) <= 2,$iif(!$hget(Meteo,Period),Matin,Après-Midi))
²surligne @Meteo 10 $calc(%ox +2) $calc(%oy +2) %te
}
if ($hget(MeteoVille,Eph)) {
tokenize 32 $replace($gettok($ifmatch,$+($calc($hget(Meteo,Period) +1),-),32), ,$chr(165))
²surligne @Meteo 12 70 375 $replace($1,$chr(165),$chr(32))
²surligne @Meteo -l 12 430 375 $replace($3,$chr(165),$chr(32))
²surligne @Meteo 12 70 395 $replace($5,$chr(165),$chr(32))
²surligne @Meteo 12 70 415 Lever du soleil : $replace($gettok($1-,-3,32),$chr(165),$chr(32))
²surligne @Meteo 12 70 435 Coucher du soleil : $replace($gettok($1-,-2,32),$chr(165),$chr(32))
²surligne @Meteo -l 12 430 395 Lune : $replace($gettok($1-,-1,32),$chr(165),$chr(32))
}
hadd -m Meteo Ready 1
²ref @Meteo
}
;*************
;Autres écrans
;*************
alias ²meteo.vigilance {
if (!$window(@Meteo)) return
²centre @Meteo -b 40 Carte de vigilance
meteo.wait
if ($hget(MeteoLocation)) hfree MeteoLocation
if ($hget(Meteo,Period) != $null) hdel Meteo Period
hfree -w MeteoVille*
hadd -m MeteoVille Vigilance 0 0 ø vigilance.gif
fond.meteo /image/carte/vigilance/vigilance_fond.gif
dl.meteo /image/carte/vigilance/vigilance.gif
hadd -m MeteoTemp Carte Vigilance
}
alias ²meteo.aide {
if (!$window(@Meteo)) return
²centre @Meteo -b 40 Aide
var %d = drawtext -pnr @Meteo 0 Tahoma 12 30
%d 80 Bienvenue sur l'aide de Meteo & Départements (codé par ArKanis)
%d 120 Météo :
%d 140 Cette version très simple permet de connaître la météo en France ou ses
%d 160 DOM-TOMs et ce de un à six jours.
%d 180 Pour commencer, choisissez où regarder la météo.
%d 200 Vous obtiendrez plus d'informations et passant la souris sur une ville et en
%d 220 cliquant dessus
%d 260 Départements :
%d 280 Vous donne toutes les infos relatives à chaque département à savoir son
%d 300 numéro, son nom, sa préfecture et sa région.
%d 320 En cliquand sur un département, vous ouvrirez le quid à la page du département.
%d 340 Le jeu consiste à localiser le département à partir d'une de ses
%d 360 informations. Au bout de quatre erreurs, une aide s'affiche.
%d 380 Trouver du premier coup vous octroie deux points, ne pas trouver au bout
%d 400 de huit fait passer à une autre question.
%d 440 Ensoleillement :
%d 460 Montre l'ensoleillement actuel du monde. Nuages actualisés toutes les heures.
%d 480 Pour les connexions lentes, choisissez l'image en 1024.
}
alias ²meteo.credits {
if (!$window(@Meteo)) return
²centre @Meteo -b 40 Crédits
var %d = drawtext -pnr @Meteo 0 Tahoma 12 40
%d 105 Utilitaire codé par ArKanis
%d 125 Mon Site :
²link @Meteo 96 213 125 "www.arkanis.eu" www.arkanis.eu
%d 145 Météo, images provenant de :
²link @Meteo 97 213 145 "www.lachainemeteo.com" www.lachainemeteo.com
%d 165 Départements :
²link @Meteo 95 213 165 "www.arkanis.eu" ArKanis
%d 185 Ensoleillement :
²link @Meteo 94 213 185 "www.die.net/earth/" www.die.net/earth
drawtext -onr @Meteo 0 Tahoma 12 40 240 Remerciements :
%d 260 A mes testeurs, Meli, NeoBlaster et Panthouffle
%d 280 A mes amis (non cités car trop nombreux pour l'être sans oubli :D)
%d 300 A ma famille
%d 345 Deux sites de scripting mIRC :
²link @Meteo 98 204 345 "www.ircfr.com" IRCfr
drawtext -nr @Meteo 0 Tahoma 12 233 345 et
²link @Meteo 99 247 345 "www.scriptsdb.org" ScriptsDB
²centre @Meteo 375 Météo : 03/02/07 et 04/02/07
²centre @Meteo 395 Départements : 01/08/07
²centre @Meteo 415 Ensoleillement : 02/08/07
}
;***************************************
;Téléchargement des fichiers nécessaires
;***************************************
alias -l dep.DL {
if (!$isdir(Meteo)) mkdir Meteo
var %n = $hget(@DepDL,0).item
if (!%n) { dep.dl.end | return }
if ($hget(@DepDLDo)) .hfree $ifmatch
else echo 2 -at * Le code Meteo doit télécharger %n $+(fichier,$iif(%n > 1,s),.)
hadd -m @DepDLDo Fichier $hget(@DepDL,1).item
hadd -m @DepDLDo Ticks $ticks
sockclose dep.dl
sockopen dep.dl arkanisfr.free.fr 80
}
on *:sockopen:dep.dl:{
if ($sockerr) return
if (!$hget(@DepDLDo,Fichier)) return
sockwrite -n $sockname GET $+(http://arkanisfr.free.fr/Script-ArKanis/,$hget(@DepDLDo,Fichier)) HTTP/1.0
sockwrite -n $sockname $+(Host: free.fr,$str($crlf,2))
}
on *:sockread:dep.dl:{
sockread &a
if ((!$sock($sockname).mark) && ($bfind(&a, 1,$str($crlf,2)))) {
bcopy &b 1 &a $calc($ifmatch +4) -1
if ($bvar(&b,0)) bwrite $qt($meteo.f($$hget(@DepDLDo,Fichier))) -1 -1 &b
sockmark $sockname 1
}
elseif ($bvar(&a,0)) bwrite $qt($meteo.f($$hget(@DepDLDo,Fichier))) -1 -1 &a
}
on *:sockclose:dep.dl:{
var %n = $hget(@DepDLDo,Fichier)
echo 2 -at * Téléchargement de %n terminé.
if ($hget(@DepDL,%n)) hdel @DepDL %n
dep.dl
}
alias -l dep.dl.end {
echo 2 -at * Tous les fichiers ont été téléchargés en $+($calc($ticks - $hget(@DepDLDo,Ticks)),ms.)
if ($hget(@DepDLDo)) .hfree $ifmatch
dep
}
;******
;Divers
;******
alias -l meteo.wait {
if ($show) ²clear @Meteo
hadd -m Meteo Ready 0
²centre @Meteo 240 $iif($1,$1,Chargement) en cours ...
²ref @Meteo
}
alias -l meteo.f return $+(Meteo\,$1-)
alias dep departements $1-
alias departements {
if (!$1) meteo dep
else {
if (!$exists($meteo.f(departements.ini))) {
echo 2 -at * Veuillez taper /dep avant d'accéder aux options de cette commande (pour télécharger les fichiers nécessaires).
return
}
if (!$hget(@DepNums)) {
hmake @DepNums 20
hload -i @DepNums $meteo.f(departements.ini) Num
}
if (!$hget(@DepNums,Liste)) {
var %t = 1, %max = $hget(@DepNums,0).item
while %t <= %max {
hadd -m @DepNums Liste $addtok($hget(@DepNums,Liste),$hget(@DepNums,%t).item,165)
inc %t
}
hadd -m @DepNums Liste $sorttok($hget(@DepNums,Liste),165,n)
}
if (($1 isnum) && ($hget(@DepNums,$1))) echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Département $1 : $gettok($hget(@DepNums,$1),1,165) 12::0 Préfecture : $gettok($hget(@DepNums,$1),2,165) 12::0 Région administrative : $gettok($hget(@DepNums,$1),3,165) 12]
else {
var %t = 1, %max = $numtok($hget(@DepNums,Liste),165)
while %t <= %max {
var %f = $gettok($hget(@DepNums,Liste),%t,165), %g = $hget(@DepNums,%f)
if (($wildtok(%g,$1,0,165)) && (%f != Liste)) echo -a 2 $+ $asctime([HH:nn:ss]) 12,1[ 0Département %f : $gettok(%g,1,165) 12::0 Préfecture : $gettok(%g,2,165) 12::0 Région administrative : $gettok(%g,3,165) 12]
inc %t
}
}
}
}
;************
;Départements
;************
alias ²meteo.dep {
if (!$window(@Meteo)) return
drawpic -ct @Meteo 16777215 40 70 $qt($meteo.f(france.bmp))
if ($window(@DepCache)) window -c @DepCache
drawtext -nr @Meteo 0 Tahoma 12 20 455 Recherche :
²edit @Meteo -a 200 20 470 200 20 $chr(124)
window -BCdg0hk0npRz +d @DepCache 0 0 500 470
window -BCdg0hk0npRz +d @DepCache2 0 0 500 470
drawcopy -n @Meteo 0 0 500 470 @DepCache 0 0
drawcopy -n @Meteo 0 0 500 470 @DepCache2 0 0
}
alias ²meteo.play {
if (!$window(@Meteo)) return
if ($hget(@DepJeu)) .hfree @DepJeu
hadd -m @DepJeu Score 0/0
drawpic -ct @Meteo 16777215 40 70 $qt($meteo.f(france.bmp))
if ($window(@DepCache2)) window -c $ifmatch
window -BCdg0hk0npRz +d @DepCache2 0 0 500 470
²efface @Meteo 10 40 60 20
drawtext -cnr @Meteo 12 Tahoma 0 10 40 60 20 $hget(@DepJeu,Score)
drawcopy -n @Meteo 0 0 500 470 @DepCache2 0 0
meteo.newgame
}
alias -l meteo.newgame {
if ($hget(@DepJeu,Sol)) {
var %t = 1
²efface @Meteo 10 40 60 20
drawtext -cnr @Meteo 12 Tahoma 0 10 40 60 20 $hget(@DepJeu,Score)
drawcopy -n @Meteo 0 0 500 470 @DepCache2 0 0
while $gettok($hget(@DepJeu,Sol),%t,165) {
var %it = $ifmatch, %c = $hfind(@DepColors,%it).data
tokenize 44 %c
drawreplace -nr @Meteo $rgb($1,$2,$3) 255 40 70 427 397
drawrect -fnr @Meteo $rgb($1,$2,$3) 1 250 450 50 20
drawrect -nr @Meteo $iif($hget(@DepJeu,Last),65280,255) 1 250 450 50 20
inc %t
}
if ($window(@DepCache)) window -c $ifmatch
window -BCdg0hk0npRz +d @DepCache 0 0 500 470
drawcopy -n @Meteo 0 0 500 470 @DepCache 0 0
hadd -m @Meteo On 1
hadd -m @Meteo Main ²meteo.dep
hdel @DepJeu Sol
drawdot @Meteo
return
}
drawcopy -n @DepCache2 0 0 500 470 @Meteo 0 0
hadd -m @Meteo Main ²meteo.play
var %ok, %type = $r(1,4), %titre = $replace(%type,1,du numéro,2,du département,3,de la préfecture,4,de la région)
while !%ok {
var %r = $r(1,100)
if (%r isnum 96-100) var %r = $calc(%r + 874)
if (%r != $hget(@DepJeu,Num)) var %ok = 1
if (%r == 20) var %r = $+(20,$r(a,b))
if (!$hfind(@DepColors,%r).data) var %ok = 0
}
hadd -m @DepJeu,Num) %r
hadd -m @DepJeu Type %type
hadd -m @DepJeu Aide 0
hdel -w @DepJeu Clic*
var %l = $+(%r,¥,$hget(@DepNums,%r)), %sol = $gettok(%l,%type,165), %t = 1, %m
if (!%sol) {
.timer -m 1 0 meteo.newgame
return
}
var %max = $hget(@DepNums,0).item
while %t <= %max {
var %rep = $hget(@DepNums,%t).item, %it = %rep
if (%type > 1) var %rep = $gettok($hget(@DepNums,%rep),$calc(%type -1),165)
if (%rep == %sol) var %m = $addtok(%m,%it,165)
inc %t
}
hadd -m @DepJeu Sol %m
if (%type == 1) var %qu = %sol
elseif (%type == 2) var %qu = $qt(%sol)
elseif (%type == 3) var %qu = dont la préfecture est %sol
else var %qu = faisant partie de la région %sol
²efface @Meteo 20 450 300 20
drawtext -nr @Meteo 0 Tahoma 12 20 450 A partir $+(%titre,$chr(44))
²efface @Meteo 20 470 475 20
drawtext -cnr @Meteo 0 Tahoma 12 20 470 475 20 localisez $iif(%type != 2,$iif(%type == 4,un,le) département) %qu
drawdot @Meteo
}
;**************
;Ensoleillement
;**************
alias sunlight meteo sunlight
alias ²meteo.ens {
.meteo.wait
²centre @Meteo -b 40 Ensoleillement sur Terre
sockclose meteo.sunlight
if ($exists($meteo.f(map.jpg))) .remove $qt($meteo.f(map.jpg))
sockopen meteo.sunlight static.die.net 80
}
on *:sockopen:meteo.sunlight:{
if ($sockerr) return
var %r = $readini($meteo.f(departements.ini),Config,Resol)
sockwrite -n $sockname GET $+(http://static.die.net/earth/mercator/,$iif($istok(1600 1024,%r,32),%r,1600),.jpg) HTTP/1.0
sockwrite -n $sockname Host: $+(die.net,$str($crlf,2))
}
on *:sockread:meteo.sunlight:{
sockread &a
if ((!$sock($sockname).mark) && ($bfind(&a, 1,$str($crlf,2)))) {
bcopy &b 1 &a $calc($ifmatch +4) -1
if ($bvar(&b,0)) bwrite $qt($meteo.f(map.jpg)) -1 -1 &b
sockmark $sockname 1
}
elseif ($bvar(&a,0)) bwrite $qt($meteo.f(map.jpg)) -1 -1 &a
}
on *:sockclose:meteo.sunlight:{
drawpic -smn @Meteo 20 130 460 255 $qt($meteo.f(map.jpg))
²zone @Meteo 300 20 130 460 255
drawrect -nr @Meteo 0 1 19 129 462 257
²description @Meteo 300 Ensoleillement sur Terre provenant de www.die.net/earth/. Cliquez pour agrandir
²button @Meteo 302 200 390 100 20 Rafraîchir
²centre @Meteo 415 Dernière mise à jour : le $date à $time
drawdot @Meteo
}
alias ²meteo.enscfg {
²centre @Meteo -b 40 Configuration de la partie Ensoleillement
var %r = $readini($meteo.f(departements.ini),Config,Resol)
if ($istok(1600 1024,%r,32)) var %l = $+(%r,¥,$iif(%r == 1600,1024,1600))
else var %l = 1600¥1024
²select @Meteo 301 200 250 100 20 %l
}
;**************
;Aliases utiles
;**************
alias -l min return $calc(($1 + $2 - $abs($calc($1 - $2)))/2)
alias -l max return $calc(($1 + $2 + $abs($calc($1 - $2)))/2)
alias -l extension return $regsubex($1,(.+)\.([^\.]+)$,\2)
alias -l meteo.translate {
tokenize 32 $1-
if (!$3) return
var %j = $1, %m = $2, %a = $3
if (%m < 3) var %n = $calc($int($calc(365.25*(%a - 1))) + $int($calc(30.6*(%m + 13))) + %j - 621049)
else var %n = $calc($int($calc(365.25 * %a)) + $int($calc(30.6*(%m +1))) + %j - 621049)
var %d = $iif($calc(%n % 7),$ifmatch,7)
return $gettok(Lundi Mardi Mercredi Jeudi Vendredi Samedi Dimanche,%d,32)
}
;End Of File
Conclusion :
Charger le code et tapez /meteo pour télécharger les fichiers.
/meteo ouvrira la picwin sur la prévision météorologique de la France
/dep ouvrira la picwin sur la fenêtre Départements
/sunlight ouvrira la picwin sur la fenêtre Ensoleillement
(je me permets de copier un paragraphe que j'avais écrit pour le code Départements Français)
Une autre fonction du remote est de donner rapidement le résultat d'une recherche :
/dep 67 => renvoie [ Département 67 : Bas Rhin :: Préfecture : Strasbourg :: Région administrative : Alsace ]
/dep Strasbourg : la même chose
/dep Bas?Rhin : toujours pareil
/dep Alsace : [ Département 67 : Bas Rhin :: Préfecture : Strasbourg :: Région administrative : Alsace ] et [ Département 68 : Haut Rhin :: Préfecture : Colmar :: Région administrative : Alsace ]
/dep Als* : renvoie 2 résultats
(Vous l'aurez compris, j'habite en Alsace :))
J'espère qu'elle vous plaira tout autant que les autres, en espérant plus encore :)
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.