egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem meteo.tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Kaa
Voice


Joined: 31 Oct 2007
Posts: 10
Location: Italy

PostPosted: Fri Mar 08, 2013 4:21 am    Post subject: Problem meteo.tcl Reply with quote

Code:
 meteo-0.2.tcl for eggdrop (05/11/2002)
# by elf- at #egghelp on AzzurraNet (irc.azzurra.org)
#
# per attivare lo script è necessario impostare il flag +meteo al canale (.chanset #chan +meteo)
set meteo_version 0.2

bind pub - !meteo meteo:request
setudef flag meteo

package require http
http::config -useragent "Mozilla/1.0"

proc meteo:request { nick uhost hand chan arg } {
   if { [ lsearch -exact [ channel info $chan ] "+meteo" ] == -1 } { return }
   putlog "METEO :: request \"!meteo $arg\" from $nick!$uhost on $chan"
   if { $arg == "" || $arg == "help" } {
       putserv "privmsg $chan :\002\0034-\0035-\00314M\002eteo HELP\002\0035:\002\00314 Visualizza tempo e temperature minime/massime\
       di una città. Uso: \002!meteo città\002"
       return
   } elseif { [ string length $arg ] < 3 } {
      putserv "privmsg $chan :\002\0034-\0035-\00314M\002eteo\002\0035:\002\00314 La città *non* può essere inferiore ai 3 caratteri."
      return
   }
   regsub -all -- " " $arg "%20" args
   set url "http://meteo.ansa.it/ricerca.asp?cerca=$args"
   set http [ http::geturl $url ]
   upvar #0 $http state
   foreach { name value } $state(meta) {
      if { [ regexp -nocase -- ^location$ $name ] } {   set url "http://meteo.ansa.it/$value" }
   }
    set http [ http::geturl $url ]
   set html [ http::data $http ]
   foreach line [ split $html "\n" ] {
      if { [ regexp -nocase -- {<td height\=\"20\" bgcolor\=.*<a href\=\"(.*)\" class\=\"menu\">(.*)</a></td>}\
      $line all rif citta ] } {
         if { [ regexp -nocase -- .*${arg}.* $citta ] } {
            regsub -- {amp;} $rif "" rif
            set url "http://meteo.ansa.it/$rif"
            break
         }
      }
   }
   set flag 0
   set min_max {}
   set http [ http::geturl $url ]
   set html [ http::data $http ]
   foreach line [ split $html "\n" ] {
      if { [ regexp -nocase -- {\"><a href\=\"(.*)\" class\=\"menu\">(.*)</a></td>$}   $line all rif citta ] } {
         if { [ regexp -nocase -- .*${arg}.* $citta ] } { set flag 1 }
      } elseif { [ regexp -- {\s+(.?\d+)</div>} $line all minmax ] && ( $flag == 1 ) } {
         lappend min_max $minmax
      } elseif { [ regexp -- {\s+<div ALIGN\=\"right\"><img SRC\=\"images\/simbolipiccoli.*ALT\=\"(.*)\"></div>}\
      $line all tempo ] && ( $flag == 1 ) } {
         break
      } elseif { [ regexp -- {<small><small>&nbsp;(.+)</small></small></font></td><td align\=\"right\">}\
      $line all regione ] } { continue }
   }
   if { [ info exists regione ] && [ info exists citta ] } {
      if { [ llength $min_max ] == 2 } {
         putserv "privmsg $chan \002\0034-\0035-\00314M\002eteo $regione\002\0035:\002\00314 A \002$citta\002 il tempo è\
         [ string tolower $tempo], minima [ lindex $min_max 0 ] massima [ lindex $min_max 1 ]"
      } else {
         putserv "privmsg $chan :\002\0034-\0035-\00314M\002eteo $regione\002\0035:\002\00314 A \002$citta\002 il tempo è\
         [ string tolower $tempo]"
      }
   } else {
      putserv "privmsg $chan :\002\0034-\0035-\00314M\002eteo\002\0035:\002\00314 \037$arg\037 città non trovata."
   }
}

putlog "METEO :: version $meteo_version loaded"


I have problems with this tcl. I get no response from the tcl and even errors in pl. The author has disappeared. Can you help me to run the tcl? Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber