| View previous topic :: View next topic |
| Author |
Message |
doni Voice
Joined: 21 Aug 2018 Posts: 13
|
Posted: Tue Dec 03, 2019 2:44 am Post subject: Horoscope tcl error |
|
|
Hi guys!
I get this error in PL:
| Code: | | Tcl error [oroscopo:request]: can't read "segno": no such variable |
Someone can help me, please?
| Code: | ###########################################################
#
# Oroscopo 1.3 tcl for eggdrop (13/06/2005)
# by lnx85 at #lnxlabs on Azzurra (irc.azzurra.org)
# E-mail: lnx85@lnxlabs.it
#
# Per attivare lo script è necessario impostare il flag "+oroscopo" al canale
# (.chanset #chan +oroscopo)
#
###########################################################
### GLOBALS ###
set oroscopo(version) 1.3
package require http
http::config -useragent "Mozilla/1.0"
### END GLOBALS ###
### FLAGS ###
setudef flag oroscopo
### END FLAGS###
### BINDS ###
bind pub - !oroscopo oroscopo:request
### END BINDS ###
### PROCS ###
proc strlastpos { string char {max 0} } {
if { $max == 0} { set max [ string length $string ] }
if { [ string length $string ] <= $max } { return [ string length $string ] }
for { set i 0 } { $i < $max } { incr i } {
if { [ string index $string [ expr $max - $i ] ] == $char } {
return [ expr $max - $i ]
}
}
return $max
}
proc max:privmsg:chars { target } {
return [ expr 500 - 1 - [ string length $::nick ] - 30 - [ string length $target ] - 2 ]
}
proc oroscopo:request { nick uhost hand chan arg } {
if { [ lsearch -exact [ channel info $chan ] "+oroscopo" ] == -1 } { return }
putlog "OROSCOPO :: request \"!oroscopo $arg\" from $nick!$uhost on $chan"
if { $arg == "" || $arg == "help" } {
putserv "NOTICE $nick :\002\0034-\0035-\00314O\002roscopo HELP\002\0035:\002\00314 Mostra l'oroscopo per un dato segno zodiacale\
\037Utilizzo:\037 !oroscopo segno"
return
}
regsub -all -- " " $arg "%20" args
set url "http://www.oroscopi.com/oroscopo/oroscopo_giorno.php?segno=$args"
set http [ http::geturl $url ]
set html [ http::data $http ]
set flag 0
if { [ regexp -nocase -- {<font face="Verdana" size="2"><b>([^<]+)</b> <br>([^<]+)</td>} $html all segno testo ] } {
set risposta "\002\0034-\0035-\00314O\002roscopo \037[ string toupper $segno ]\037\002\0035:\002\00314 $testo"
set flag 1
}
if { $flag == 0 } {
putserv "PRIVMSG $chan :\002\0034-\0035-\00314O\002roscopo \037[ string toupper $segno ]\037\002\0035:\002\00314 Segno zodiacale non trovato"
} else {
set max_chars [ max:privmsg:chars $chan ]
while { [ string length $risposta ] > 0 } {
set limit [ strlastpos $risposta " " $max_chars ]
set risptemp [ string range $risposta 0 $limit ]
set risposta [ string range $risposta $limit end ]
if { [ string length $risposta ] != 0 } {
putserv "PRIVMSG $chan :$risptemp ..."
} else {
putserv "PRIVMSG $chan :$risptemp"
}
}
}
}
### END PROCS ###
### INITIAL ###
putlog "\037OROSCOPO\037 \002::\002 \037LOADED\037 version $oroscopo(version) by lnx85" |
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Tue Dec 03, 2019 4:27 am Post subject: |
|
|
The template of the page has changed.
May work with something like:
| Code: | | if { [ regexp -nocase -- {<div class="oroscopo">.+<h1>(.+)<span.+<p>([^<]+)</p>} $html all segno testo ] } { |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
doni Voice
Joined: 21 Aug 2018 Posts: 13
|
Posted: Tue Dec 03, 2019 2:24 pm Post subject: |
|
|
| CrazyCat wrote: | The template of the page has changed.
May work with something like:
| Code: | | if { [ regexp -nocase -- {<div class="oroscopo">.+<h1>(.+)<span.+<p>([^<]+)</p>} $html all segno testo ] } { |
|
reply is empty:
| Code: | [19:18:11] <@doni> !oroscopo vergine
[19:18:12] <Toolz> --Oroscopo VERGINE: |
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
|
| Back to top |
|
 |
doni Voice
Joined: 21 Aug 2018 Posts: 13
|
Posted: Wed Dec 04, 2019 5:11 pm Post subject: |
|
|
i have fixed in this way:
| Code: | | if { [ regexp -nocase -- {<p>([^<]+)</p>} $html all segno testo ] } { |
|
|
| Back to top |
|
 |
MrBeta Voice
Joined: 28 Dec 2013 Posts: 35
|
Posted: Thu Sep 10, 2020 3:49 am Post subject: |
|
|
it stopped working for me  |
|
| Back to top |
|
 |
Suratka Voice
Joined: 25 Jun 2016 Posts: 19
|
Posted: Sat Dec 19, 2020 5:08 pm Post subject: |
|
|
-NOTICE- *** Cannot send to #siamosolonoi: your message contains too many capital letters (93% >= 50%)
????
helpme
| Code: | ###########################################################
#
# Oroscopo 1.3 tcl for eggdrop (13/06/2005)
# by lnx85 at #lnxlabs on Azzurra (irc.azzurra.org)
# E-mail: lnx85@lnxlabs.it
#
# Per attivare lo script è necessario impostare il flag "+oroscopo" al canale
# (.chanset #chan +oroscopo)
#
###########################################################
### GLOBALS ###
set oroscopo(version) 1.3
package require http
http::config -useragent "Mozilla/1.0"
### END GLOBALS ###
### FLAGS ###
setudef flag oroscopo
### END FLAGS###
### BINDS ###
bind pub - !oroscopo oroscopo:request
### END BINDS ###
### PROCS ###
proc strlastpos { string char {max 0} } {
if { $max == 0} { set max [ string length $string ] }
if { [ string length $string ] <= $max } { return [ string length $string ] }
for { set i 0 } { $i < $max } { incr i } {
if { [ string index $string [ expr $max - $i ] ] == $char } {
return [ expr $max - $i ]
}
}
return $max
}
proc max:privmsg:chars { target } {
return [ expr 500 - 1 - [ string length $::nick ] - 30 - [ string length $target ] - 2 ]
}
proc oroscopo:request { nick uhost hand chan arg } {
if { [ lsearch -exact [ channel info $chan ] "+oroscopo" ] == -1 } { return }
putlog "OROSCOPO :: request \"!oroscopo $arg\" from $nick!$uhost on $chan"
if { $arg == "" || $arg == "help" } {
putserv "NOTICE $nick :\002\0034-\0035-\00314O\002roscopo HELP\002\0035:\002\00314 Mostra l'oroscopo per un dato segno zodiacale\
\037Utilizzo:\037 !oroscopo segno"
return
}
regsub -all -- " " $arg "%20" args
set url "http://www.oroscopi.com/oroscopo/oroscopo_giorno.php?segno=$args"
set http [ http::geturl $url ]
set html [ http::data $http ]
set flag 0
if { [ regexp -nocase -- {<p>([^<]+)</p>} $html all segno testo ] } {
set risposta "\002\0034-\0035-\00314O\002roscopo \037[ string toupper $segno ]\037\002\0035:\002\00314 $testo"
set flag 1
}
if { $flag == 0 } {
putserv "PRIVMSG $chan :\002\0034-\0035-\00314O\002roscopo \037[ string toupper $segno ]\037\002\0035:\002\00314 Segno zodiacale non trovato"
} else {
set max_chars [ max:privmsg:chars $chan ]
while { [ string length $risposta ] > 0 } {
set limit [ strlastpos $risposta " " $max_chars ]
set risptemp [ string range $risposta 0 $limit ]
set risposta [ string range $risposta $limit end ]
if { [ string length $risposta ] != 0 } {
putserv "PRIVMSG $chan :$risptemp ..."
} else {
putserv "PRIVMSG $chan :$risptemp"
}
}
}
}
### END PROCS ###
### INITIAL ###
putlog "\037OROSCOPO\037 \002::\002 \037LOADED\037 version $oroscopo(version) by lnx85" |
|
|
| Back to top |
|
 |
|