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 

Error on script
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
XtremeSeb
Voice


Joined: 11 Jun 2016
Posts: 10
Location: Romania

PostPosted: Sat Jun 11, 2016 12:11 pm    Post subject: Error on script Reply with quote

Hello guys, i need a little help with 2 scripts . The first one:
Code:
package require http

setudef flag horoscop

 bind pub -|- !horoscop check_zodie

 proc check_zodie {nick uhost hand chan arg} {
    if {![channel get $chan horoscop]} { return 0 }

        set target [lindex [split [string tolower $arg]] 0]
    if {$target eq "" || ![regexp {^(berbec|taur|gemeni|rac|leu|fecioara|balanta|scorpion|sagetator|capricorn|varsator|pesti)$} $target]} {
        putserv "NOTICE $nick :Foloseste: !horoscop <semn zodiacal>"
        return 0
        }
       
        set pagina "http://www.zodii.ro/zodiac/$target*zodie_$target-horoscop_zilnic.html"
        set http [http::config -useragent "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320)"]
        set http [http::geturl $pagina -timeout [expr {1000*5}]]
        set html [http::data $http]
        http::cleanup $http
       
        regsub -all -- "\n" $html "" html
        regexp {</iframe><br />(.*?)</div>} $html a horoscopo
        putserv "NOTICE $nick :[string toupper $target]: $horoscopo"
      return 0
 }
 
 putlog "Horoscop loaded sucessfully. Created by Costin"

Tcl error [check_zodie]: can't read "horoscopo": no such variable.

The second :
Code:
bind join - * hymaster

proc hymaster {nick uhost hand chan} {
   global botnick

   if {[string equal -nocase $nick $botnick]} {return} elseif {
      [check:N:gl $hand]} {puthelp "PRIVMSG $chan :4WoOoW ...7 $nick 2este al meu 4Global 14MANAGER  4A2scundeti-va  de \0034$nick4;2)"} elseif {
      [check:n:gl $hand]} {puthelp "PRIVMSG $chan :4WoOoW ...10 $nick 2este al meu 4Global 10Owner  4S2alut $nick 4:2)"} elseif {
      [check:m:gl $hand]} {puthelp "PRIVMSG $chan :4WoOoW ...5 $nick 2este al meu 4Global 5Master  4S2alut $nick 4;2))"}
}


Tcl error [hymaster]: invalid command name "check:N:gl"
Back to top
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3403
Location: Area 51

PostPosted: Sat Jun 11, 2016 12:14 pm    Post subject: Reply with quote

You get that error on first cos the regexp doesn't match anything and thus he doesn't create the horoscopo and gives you an error when trying to use something hasn't been defined.

Haven't tested so give a try to:
Code:

namespace eval zodiac {
   package require http
   setudef flag horoscop
   bind pub -|- !horoscop [namespace current]::fetch

   proc fetch {nick uhost hand chan text} {
      if {![channel get $chan horoscop]} return
      if {[scan $text {%s} sign] != 1} {
         putserv "NOTICE $nick :Syntax: !horoscop <zodiac sign>"
         return
      }
      set signs [list "berbec" "taur" "gemeni" "rac" "leu" "fecioara" "balanta" "scorpion" "sagetator" "capricorn" "varsator" "pesti"]
      set sign [string tolower $sign]
      if {[lsearch $signs $sign] == -1} {
         putserv "NOTICE $nick :Error, $sign is a uknown sign. Pick another."
         return
      }
      set http [::http::geturl "http://www.zodii.ro/zodiac/$sign*zodie_$sign-horoscop_zilnic.html"]
      set data [::http::data $http]
      ::http::cleanup $http
      regexp -nocase {<div class="textArticol">(.*?)</div>} $data text
      set result [lrange $text 2 end-1]
      putserv "NOTICE $nick :[string toupper $sign]: $result"
   }
}

I'm not a regexp guru so I bet someone will come with a better solution than mine. Smile

As for the second, you are missing a chunk of that script cos it's not finding the check:m:gl function (proc).

Edit: Fixed typo.
_________________
You may say anything about me, but don't misspell my name.


Last edited by caesar on Sun Jun 12, 2016 2:31 am; edited 1 time in total
Back to top
View user's profile Send private message
XtremeSeb
Voice


Joined: 11 Jun 2016
Posts: 10
Location: Romania

PostPosted: Sat Jun 11, 2016 12:25 pm    Post subject: Reply with quote

I get this error now - Tcl error [::zodiac::fetch]: can't read "html": no such variable
Back to top
View user's profile Send private message
XtremeSeb
Voice


Joined: 11 Jun 2016
Posts: 10
Location: Romania

PostPosted: Sat Jun 11, 2016 12:57 pm    Post subject: Reply with quote

If anyone has a horoscope tcl that works , please post it.
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sat Jun 11, 2016 7:29 pm    Post subject: Reply with quote

XtremeSeb wrote:
If anyone has a horoscope tcl that works , please post it.


The problem with all scripts who use sockets is that web pages change and the code stops working.
I have tried several but none worked.
I hope you have luck and someone shares one that works.
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
XtremeSeb
Voice


Joined: 11 Jun 2016
Posts: 10
Location: Romania

PostPosted: Sat Jun 11, 2016 7:41 pm    Post subject: Reply with quote

The same script works fine on another eggdrop. But the owner is offline for a lot of time..
Back to top
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3403
Location: Area 51

PostPosted: Sun Jun 12, 2016 2:34 am    Post subject: Reply with quote

As I was testing stuff mixed variables and now should work fine. Replace:
Code:

regexp -nocase {<div class="textArticol">(.*?)</div>} $html text

with:
Code:

regexp -nocase {<div class="textArticol">(.*?)</div>} $data text

_________________
You may say anything about me, but don't misspell my name.
Back to top
View user's profile Send private message
XtremeSeb
Voice


Joined: 11 Jun 2016
Posts: 10
Location: Romania

PostPosted: Sun Jun 12, 2016 3:06 am    Post subject: Reply with quote

Yees its working fine, thank you so much caesar. But he answers to the user with notice. Can he reply on main?
Back to top
View user's profile Send private message
XtremeSeb
Voice


Joined: 11 Jun 2016
Posts: 10
Location: Romania

PostPosted: Sun Jun 12, 2016 3:29 am    Post subject: Reply with quote

Done! Its working great. Thanks again.
Back to top
View user's profile Send private message
caesar
Ass Kicker


Joined: 14 Oct 2001
Posts: 3403
Location: Area 51

PostPosted: Sun Jun 12, 2016 5:39 am    Post subject: Reply with quote

As for the other script I take it the check:N:gl, check:n:gl and check:m:gl is a proc that basically is checking if the user has the global N, n or m flag.

Easy to change things so instead of check:N:gl $hand can dirrectly use matchattr $hand N and for the other two matchattr $hand n and matchattr $hand m.

Oh and instead of:
Code:

if {[string equal -nocase $nick $botnick]} {return}

I would actually use:
Code:

if {[isbotnick $nick]} return

_________________
You may say anything about me, but don't misspell my name.
Back to top
View user's profile Send private message
XtremeSeb
Voice


Joined: 11 Jun 2016
Posts: 10
Location: Romania

PostPosted: Sun Jun 12, 2016 10:08 am    Post subject: Reply with quote

Yes! Its working great. Thank you for your help caesar
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sat Jun 18, 2016 12:56 am    Post subject: Reply with quote

XtremeSeb wrote:
Yes! Its working great. Thank you for your help caesar


You did it, XtremeSeb !
I 'll make a post to see if anyone help me with sockets.
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
XtremeSeb
Voice


Joined: 11 Jun 2016
Posts: 10
Location: Romania

PostPosted: Mon Jun 20, 2016 4:20 pm    Post subject: Reply with quote

Yes juanamores, this time Very Happy
Back to top
View user's profile Send private message
XtremeSeb
Voice


Joined: 11 Jun 2016
Posts: 10
Location: Romania

PostPosted: Mon Jun 20, 2016 4:26 pm    Post subject: Reply with quote

I don`t want to open a new topic so i will write here, i have a new problem with a code that worked fine untill the shell went down. I`ve re-uploaded but give`s me an error. This is the code:


if {![info exists anuntpublic:show_running]} {
timer $black(anunttime) anuntpublic:show
set anuntpublic:show_running 1




Error: can't read "black(anunt_time)": no such element in array
while executing
"timer $black(anunt_time) anuntpublic_show "
Back to top
View user's profile Send private message
Arnold_X-P
Op


Joined: 30 Oct 2006
Posts: 144
Location: DALnet - Trinidad - Beni - Bolivia

PostPosted: Mon Jun 20, 2016 6:48 pm    Post subject: Reply with quote

hi caesar
It is possible that your tcl
You can modify and read from :

>>> http://www.horoscope.com/


thanks
_________________
Very Happy thanks to that they help, that others learn Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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