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 tcl horoscope

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


Joined: 31 Oct 2007
Posts: 10
Location: Italy

PostPosted: Tue Feb 25, 2014 1:11 am    Post subject: problem tcl horoscope Reply with quote

The author is gone and doesn't respond to emails.
Code:

### GLOBALS ###
set oroscopo(version) 1.5

package require http
http::config -useragent "Mozilla/1.0"
### END GLOBALS ###

### FLAGS ###
setudef flag oroscopo
### END FLAGS###

### BINDS ###
bind pub - !oroscopo oroscopo:request
bind msgm - * oroscopo:pvt: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:pvt:request { nick uhost hand arg } {
        set arg [ lindex $arg 0 ]
        if { [ lsearch -exact {ariete toro gemelli cancro leone vergine bilancia scorpione sagittario capricorno acquario pesci} [ string tolower $arg ] ] == -1 } { return }
        regsub -all -- " " $arg "%20" args
        set url "http://it.horoscopofree.com/rss/horoscopofree-it.rss"
        set http [ http::geturl $url ]
        set html [ http::data $http ]
        set flag 0
        if { [ regexp -nocase -all -- "<item>\[^<\]*<title>($arg)</title>\[^<\]*<link>\[^<\]*</link>\[^<\]*<guid \[^<\]*</guid>\[^<\]*<description><!\[^a-z\]CDATA\[^a-z\](\[^<\]*?)" $html all segno testo ] } {
                set testosegno [lindex $testo [lsearch -exact $segno $args]]
                set risposta "\037OROSCOPO\037 \002::\002 \037[ string toupper $args ]\037 $testo"
                set flag 1
        }
        if { $flag == 0 } {
                putserv "PRIVMSG $nick :\037OROSCOPO\037 \002::\002 \037[strupr $arg]\037 Segno zodiacale non trovato"
        } else {
                set max_chars [ max:privmsg:chars $nick ]
                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 $nick :$risptemp ..."
                        } else {
                                putserv "PRIVMSG $nick :$risptemp"
                        }
                }
        }
}

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 :\037OROSCOPO\037 \002::\002 \037HELP\037 Mostra l'oroscopo per un dato segno zodiacale\037Utilizzo:\037 !oroscopo segno"
                 return
        }
        regsub -all -- " " $arg "%20" args
        set url "http://it.horoscopofree.com/rss/horoscopofree-it.rss"
        set http [ http::geturl $url ]
        set html [ http::data $http ]
        set flag 0
        if { [ regexp -nocase -all -- "<item>\[^<\]*<title>($arg)</title>\[^<\]*<link>\[^<\]*</link>\[^<\]*<guid \[^<\]*</guid>\[^<\]*<description><!\[^a-z\]CDATA\[^a-z\](\[^<\]*?)" $html all segno testo ] } {
                set testosegno [lindex $testo [lsearch -exact $segno $args]]
                set risposta "\037OROSCOPO\037 \002::\002 \037[ string toupper $args ]\037 $testo"
                set flag 1
        }
        if { $flag == 0 } {
                putserv "PRIVMSG $chan :\037OROSCOPO\037 \002::\002 \037[strupr $arg]\037 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 ###


The problem is that the tcl show bad hyphenated words. Can you help me? I don't know where to fix. please. Thank you.
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 Requests 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