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 

Ramdom quote from fmylife.com
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sun Oct 18, 2009 9:12 pm    Post subject: Reply with quote

Thanhas wrote:
i need it auto work but i get this Errer in PL

Tcl error [fm_main_proc]: invalid command name "clock"

Try changing all occurences of [clock seconds] into [unixtime]. It's weird though since [clock seconds] _is_ a command. But if [unixtime] works in place this is at least a work-around.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
Thanhas
Op


Joined: 02 Sep 2006
Posts: 124
Location: Ottawa, Canada

PostPosted: Mon Oct 19, 2009 11:53 pm    Post subject: Reply with quote

speechles wrote:
Thanhas wrote:
i need it auto work but i get this Errer in PL

Tcl error [fm_main_proc]: invalid command name "clock"

Try changing all occurences of [clock seconds] into [unixtime]. It's weird though since [clock seconds] _is_ a command. But if [unixtime] works in place this is at least a work-around.


hello Thanks for the answer well all my TCLs are giving such errer i changed in few and they are now crrupt Sad
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
br_brutal
Voice


Joined: 20 Apr 2010
Posts: 6
Location: baluwatar-4, Nepal

PostPosted: Tue Apr 20, 2010 11:09 am    Post subject: Reply with quote

username wrote:
My site currently down, this is the script:
Code:
# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.3.1
#
# 16.07.09 - changed parsing code and added country and city to quote info.
#
# New html tag by username@forum.egghelp.org
# Wordwrap proc from this post by user http://forum.egghelp.org/viewtopic.php?p=81741#81741
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# channels for !fmylife
set fmylife_channels {#egghelp #erotic}

# time between use !fmylife (seconds)
set fmylife_reuse_time 20

# auto query
# 0 - off, 1 - on
set fmylife_auto_query 0

# set auto query interval (minutes)
set fmylife_auto_interval 10

###########################################################
bind pub - !fmylife fm_main_proc

package require http

proc get_fmylife { } {
   set f_http_uagent "Opera/9.61 (Windows i686; U; en) Presto/2.1.1"
   set f_http_token [http::config -useragent $f_http_uagent]
   if {[catch {set f_http_token [::http::geturl "http://www.fmylife.com/random" -timeout 15000]}]} {
      return "error"
   } {
      return [http::data $f_http_token]
   }
}

set fmylife_reuse 1

proc fmylife_timer { } {
   global fmylife_auto_interval
   fm_auto_proc

   if {[string match *fmylife_timer* [timers]] != 1} {
      timer $fmylife_auto_interval fmylife_timer
   }
}

proc fm_auto_proc { } {
   global fmylife_channels

   set fm_quote ""
        set fm_quote [get_fmylife]

   if {($fm_quote == "error") || ($fm_quote == "")} {
      putlog "auto-quote-fmylife: problem with connection"
      return
   }

   foreach fm_each_chan [split $fmylife_channels] {
      if {$fm_each_chan != ""} {
         set fm_each_chan [string trim $fm_each_chan]

         if {[botonchan $fm_each_chan]} {
             fmylife_print $fm_quote $fm_each_chan
         }
      }
   }
}

proc fm_main_proc { nick uhost hand chan arg } {
   global fmylife_channels fmylife_reuse fmylife_reuse_time

   if {[expr [clock seconds] - $fmylife_reuse] <= $fmylife_reuse_time} {
      putquick "PRIVMSG $chan :$nick: to fast, sorry"
      return
   }

   if {[lsearch $fmylife_channels $chan] == -1} {
      return
   }

   set fm_quote ""
   set fm_quote [get_fmylife]

   if {($fm_quote == "error") || ($fm_quote == "")} {
      putquick "PRIVMSG $chan :problem with connection, try again later, sorry"
      return
        }

   fmylife_print $fm_quote $chan
}

proc fmylife_print { fm_data fm_chan } {
   global fmylife_reuse

   set fm_link ""

   regsub -all -nocase "\n" $fm_data "" fm_data
   regsub -all -nocase "\r" $fm_data "" fm_data
   regsub -all -nocase "\t" $fm_data "" fm_data

   # 1st quote
   regsub -nocase {.*<div\s+class=\"clear\"><\/div><\/div>(.+)<div\s+class=\"more\">.*} $fm_data {\1} fm_data

   # 1st link
   regsub -nocase {.*<a\s+href=\"([a-z0-9\/ ]+)\"\s+class="fmllink">.*} $fm_data {\1} fm_link

   # del rest of links from quote
   regsub -all -nocase {<a\s+href=\"[a-z0-9\/ ]+\"\s+class=\"fmllink\">} $fm_data "" fm_data

   # voting result
   regsub -nocase {.*sucks<\/a>\s+(.+)<\/span>\s+-.*} $fm_data {\1} fm_fckd
   regsub -nocase {.*it<\/a>\s+(.+)<\/span>.*} $fm_data {\1} fm_dsrv

   # date and name
   regsub -nocase {.*<p\s+style=\"margin-top\:2px\;\">(.+)\s+-\s+<a\s+class=\"liencat\".*} $fm_data {\1} fm_date
   regsub -nocase {.*<a\s+class=\"liencat\"\s+href="/[a-z0-9\/ ]+\">[a-z0-9\/ ]+<\/a>\s+-\s+by\s+(.*?)\s+-\s+<a\s+href=\"\/country\/.*} $fm_data {\1} fm_name
   regsub -all -nocase {<a href="/gender/woman" class="light">} $fm_name "" fm_name
   regsub -all -nocase {<a href="/gender/man" class="light">} $fm_name "" fm_name
   regsub -all -nocase {</a>} $fm_name "" fm_name

   # country and city
   regsub -nocase {.*<a\s+href=\"\/country\/(.*?)\"\s+class=\"liencat\">.*} $fm_data {\1} fm_coun
   regsub -nocase {.*<a\s+href=\"\/region\/(.*?)"\s+class=\"light\">.*} $fm_data {\1} fm_city

   # fml text
   regsub -nocase {.*<div\s+class=\"post\"><p>(.*?)<div\s+class=\"date\">.*} $fm_data {\1} fm_data

   # the rest of useless tags
   regsub -all -nocase "<\/a>" $fm_data "" fm_data
   regsub -all -nocase "<\/p>" $fm_data "" fm_data
   regsub -all -nocase "<\/div>" $fm_data "" fm_data
   regsub -all -nocase "&quote;" $fm_data "\"" fm_data
   regsub -all -nocase "<div.*>" $fm_data "\"" fm_data
   regsub -all -nocase "&quot" $fm_data "\"" fm_data

   set fm_link "http://www.fmylife.com$fm_link"

   if {[regexp -nocase {http:\/\/www\.fmylife\.com[a-z0-9\/ ]+} $fm_link]} {
      fm_msg $fm_chan \00310$fm_data
      putquick "PRIVMSG $fm_chan :\00314I agree, your life sucks \00303$fm_fckd \00314- you totally deserved it \00303$fm_dsrv\00314. Added \00303$fm_date \00314by \00303$fm_name\00314, \00303$fm_coun \00314(\00303$fm_city\00314)."
      putquick "PRIVMSG $fm_chan :\00304--| \00312\037$fm_link\037\003"
      set fmylife_reuse [clock seconds]
   } {
      putquick "PRIVMSG $fm_chan :some problem with data, try again later, sorry"
   }
}

if {$fmylife_auto_query != 0} {
   if {[string match *fmylife_timer* [timers]] != 1} {
      timer $fmylife_auto_interval fmylife_timer
   }
}

    proc fm_msg {dest data} {
       set len [expr {512-[string len ":$::botname PRIVMSG $dest :\r\n"]}]
       foreach line [fm_wordwrap $data $len] {
          puthelp "PRIVMSG $dest :$line"
       }
    }

    proc fm_wordwrap {data len} {
       set out {}
       foreach line [split [string trim $data] \n] {
          set curr {}
          set i 0
          foreach word [split [string trim $line]] {
             if {[incr i [string len $word]]>$len} {
                lappend out [join $curr]
                set curr [list $word]
                set i [string len $word]
             } {
                lappend curr $word
             }
             incr i
          }
          if {[llength $curr]} {
             lappend out [join $curr]
          }
       }
       set out
    }

putlog "fmylife-quote.tcl ver 0.3.1 by tomekk and username loaded"



I used this script.. but still i got some problems..
Br_BruTaL ¦ !fmylife
maxbot ¦ I agree, your life sucks (40999) - you totally deserved it (6084)</span></p><p style="margin-top:2px;">On 04/21/2009 at 6:51am - <a class="liencat" href="/health">health</a> - by Chip (<a href="/gender/woman" class="light">woman</a>) - <a href="/country/Australia" class="liencat">Australia</a> (<a href="/region/Victoria" class="light">Victoria</a>)</p></div></div><div class="more" id="more1186879"><a href="javascri
maxbot ¦ Today, I went to a cosmetic dentist and got a chip in my tooth filled in that Id had since I was 7. I went out later and my friend jokingly hit my head against the table a few times to make fun of me showing off my teeth. He slipped. I fell. I now have 2 chipped teeth and a broken nose. FML

idk how do i fix that..
hope i would get reply with some help
thanks in advance Very Happy
Back to top
View user's profile Send private message MSN Messenger
Trixar_za
Op


Joined: 18 Nov 2009
Posts: 143
Location: South Africa

PostPosted: Tue Apr 27, 2010 10:59 am    Post subject: Reply with quote

Not exactly a fix for this one, but I have a script that does a similar thing with all the clean up included. You can find it here
Back to top
View user's profile Send private message Visit poster's website
br_brutal
Voice


Joined: 20 Apr 2010
Posts: 6
Location: baluwatar-4, Nepal

PostPosted: Thu May 13, 2010 3:32 pm    Post subject: Reply with quote

oh
sorry that i was little bg with my own stuffs n could not get on the internet..
thanks for the script..
but still i want the script work automatically
like in some time interval .. working as advertisement..
automatically script should take the fml randomly n displays in the channel...
anyway thanks for the script Very Happy
Back to top
View user's profile Send private message MSN Messenger
MiNdErAsR
Voice


Joined: 27 Nov 2004
Posts: 17

PostPosted: Mon Jul 05, 2010 8:09 pm    Post subject: Reply with quote

Getting some weird results, something changed.

<MiNdErAsR> !fml
<Locutus> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml"><head><meta name="title" content="FML: Your random funny stories" /><meta name="description" content="Share your random unfortunate moments and funny love stories on Fmylife" /><link rel="image_src" href="http://betacie.cachefly.net/fmylife/im
Back to top
View user's profile Send private message
br_brutal
Voice


Joined: 20 Apr 2010
Posts: 6
Location: baluwatar-4, Nepal

PostPosted: Tue Jul 06, 2010 4:16 am    Post subject: Reply with quote

Code:

# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.3.1
#
# 16.07.09 - changed parsing code and added country and city to quote info.
#
# New html tag by username@forum.egghelp.org
# Wordwrap proc from this post by user http://forum.egghelp.org/viewtopic.php?p=81741#81741
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

# channels for !fmylife
set fmylife_channels {#channel1 #channel2}

# time between use !fmylife (seconds)
set fmylife_reuse_time 5

# auto query
# 0 - off, 1 - on
set fmylife_auto_query 1

# set auto query interval (minutes)
set fmylife_auto_interval 5

###########################################################
bind pub - !fml fm_main_proc

package require http

proc get_fmylife { } {
   set f_http_uagent "Opera/9.61 (Windows i686; U; en) Presto/2.1.1"
   set f_http_token [http::config -useragent $f_http_uagent]
   if {[catch {set f_http_token [::http::geturl "http://www.fmylife.com/random" -timeout 15000]}]} {
      return "error"
   } {
      return [http::data $f_http_token]
   }
}

set fmylife_reuse 1

proc fmylife_timer { } {
   global fmylife_auto_interval
   fm_auto_proc

   if {[string match *fmylife_timer* [timers]] != 1} {
      timer $fmylife_auto_interval fmylife_timer
   }
}

proc fm_auto_proc { } {
   global fmylife_channels

   set fm_quote ""
        set fm_quote [get_fmylife]

   if {($fm_quote == "error") || ($fm_quote == "")} {
      putlog "auto-quote-fmylife: problem with connection"
      return
   }

   foreach fm_each_chan [split $fmylife_channels] {
      if {$fm_each_chan != ""} {
         set fm_each_chan [string trim $fm_each_chan]

         if {[botonchan $fm_each_chan]} {
             fmylife_print $fm_quote $fm_each_chan
         }
      }
   }
}

proc fm_main_proc { nick uhost hand chan arg } {
   global fmylife_channels fmylife_reuse fmylife_reuse_time

   if {[expr [clock seconds] - $fmylife_reuse] <= $fmylife_reuse_time} {
      putquick "PRIVMSG $chan :$nick: to fast, sorry"
      return
   }

   if {[lsearch $fmylife_channels $chan] == -1} {
      return
   }

   set fm_quote ""
   set fm_quote [get_fmylife]

   if {($fm_quote == "error") || ($fm_quote == "")} {
      putquick "PRIVMSG $chan :problem with connection, try again later, sorry"
      return
        }

   fmylife_print $fm_quote $chan
}

proc fmylife_print { fm_data fm_chan } {
   global fmylife_reuse

   set fm_link ""

   regsub -all -nocase "\n" $fm_data "" fm_data
   regsub -all -nocase "\r" $fm_data "" fm_data
   regsub -all -nocase "\t" $fm_data "" fm_data

   # 1st quote
   regsub -nocase {.*<div\s+class=\"clear\"><\/div><\/div>(.+)<div\s+class=\"more\".*} $fm_data {\1} fm_data

   # 1st link
   regsub -nocase {.*<a\s+href=\"([a-z0-9\/ ]+)\"\s+class="fmllink">.*} $fm_data {\1} fm_link

   # del rest of links from quote
   regsub -all -nocase {<a\s+href=\"[a-z0-9\/ ]+\"\s+class=\"fmllink\">} $fm_data "" fm_data

   # voting result
   regsub -nocase {.*sucks<\/a>\s+(.+)<\/span>\s+-.*} $fm_data {\1} fm_fckd
   regsub -nocase {.*it<\/a>\s+(.+)<\/span>.*} $fm_data {\1} fm_dsrv

   # date and name
   regsub -nocase {.*<p\s+style=\"margin-top\:2px\;\">(.+)\s+-\s+<a\s+class=\"liencat\".*} $fm_data {\1} fm_date
   regsub -nocase {.*<a\s+class=\"liencat\"\s+href="/[a-z0-9\/ ]+\">[a-z0-9\/ ]+<\/a>\s+-\s+by\s+(.*?)\s+-\s+<a\s+href=\"\/country\/.*} $fm_data {\1} fm_name
   regsub -all -nocase {<a href="/gender/woman" class="light">} $fm_name "" fm_name
   regsub -all -nocase {<a href="/gender/man" class="light">} $fm_name "" fm_name
   regsub -all -nocase {</a>} $fm_name "" fm_name

   # country and city
   regsub -nocase {.*<a\s+href=\"\/country\/(.*?)\"\s+class=\"liencat\">.*} $fm_data {\1} fm_coun
   regsub -nocase {.*<a\s+href=\"\/region\/(.*?)"\s+class=\"light\">.*} $fm_data {\1} fm_city

   # fml text
   regsub -nocase {.*<div\s+class=\"post\"><p>(.*?)<div\s+class=\"date\">.*} $fm_data {\1} fm_data

   # the rest of useless tags
   regsub -all -nocase "<\/a>" $fm_data "" fm_data
   regsub -all -nocase "<\/p>" $fm_data "" fm_data
   regsub -all -nocase "<\/div>" $fm_data "" fm_data
   regsub -all -nocase "&quote;" $fm_data "\"" fm_data
   regsub -all -nocase "<div.*>" $fm_data "\"" fm_data
   regsub -all -nocase "&quot" $fm_data "\"" fm_data

   set fm_link "http://www.fmylife.com$fm_link"

   if {[regexp -nocase {http:\/\/www\.fmylife\.com[a-z0-9\/ ]+} $fm_link]} {
      fm_msg $fm_chan \00310$fm_data
      #putquick "PRIVMSG $fm_chan :\00314I agree, your life sucks \00303$fm_fckd \00314- you totally deserved it \00303$fm_dsrv\00314. Added \00303$fm_date \00314by \00303$fm_name\00314, \00303$fm_coun \00314(\00303$fm_city\00314)."
      #putquick "PRIVMSG $fm_chan :\00304--| \00312\037$fm_link\037\003"
      set fmylife_reuse [clock seconds]
   } {
      putquick "PRIVMSG $fm_chan :some problem with data, try again later, sorry"
   }
}

if {$fmylife_auto_query != 0} {
   if {[string match *fmylife_timer* [timers]] != 1} {
      timer $fmylife_auto_interval fmylife_timer
   }
}

    proc fm_msg {dest data} {
       set len [expr {512-[string len ":$::botname PRIVMSG $dest :\r\n"]}]
       foreach line [fm_wordwrap $data $len] {
          puthelp "PRIVMSG $dest :$line"
       }
    }

    proc fm_wordwrap {data len} {
       set out {}
       foreach line [split [string trim $data] \n] {
          set curr {}
          set i 0
          foreach word [split [string trim $line]] {
             if {[incr i [string len $word]]>$len} {
                lappend out [join $curr]
                set curr [list $word]
                set i [string len $word]
             } {
                lappend curr $word
             }
             incr i
          }
          if {[llength $curr]} {
             lappend out [join $curr]
          }
       }
       set out
    }

putlog "fmylife-quote.tcl ver 0.3.1 by tomekk and username loaded"
Back to top
View user's profile Send private message MSN Messenger
MiNdErAsR
Voice


Joined: 27 Nov 2004
Posts: 17

PostPosted: Tue Jul 06, 2010 5:34 pm    Post subject: Reply with quote

Did you change v0.3.1? Because I tried it, and it didn't work for me.
Back to top
View user's profile Send private message
Trixar_za
Op


Joined: 18 Nov 2009
Posts: 143
Location: South Africa

PostPosted: Wed Jul 07, 2010 2:16 pm    Post subject: Reply with quote

MiNdErAsR wrote:
Did you change v0.3.1? Because I tried it, and it didn't work for me.

This might be because fmylife.com changed their div format a bit. In my own script I had to change:
Code:
regexp -- {<div class="post"><p>(.+?)</p>} $html - fmlq
to
regexp -- {<div class="post".+?><p>(.+?)</p>} $html - fmlq

which fixed the problem for me.

I'm however unsure how to fix it in the above script though - it seems to use it's own kind of syntax in some instances. Hopefully somebody can help fix it.
_________________
http://www.trixarian.net/Projects
Back to top
View user's profile Send private message Visit poster's website
The_Hatta
Voice


Joined: 11 Jul 2010
Posts: 3

PostPosted: Sun Jul 11, 2010 11:23 pm    Post subject: . Reply with quote

If you change
Code:

regsub -nocase {.*<div\s+class=\"post\"><p>(.*?)<div\s+class=\"date\">.*} $fm_data {\1} fm_data

to
Code:

regsub -nocase {.*<div\s+class=\"post\".+?><p>(.*?)<div\s+class=\"date\">.*} $fm_data {\1} fm_data


everything should work out fine, mine does Razz
Back to top
View user's profile Send private message Visit poster's website
Andreoli
Voice


Joined: 12 Jul 2010
Posts: 4

PostPosted: Mon Jul 12, 2010 10:17 pm    Post subject: Reply with quote

It doesnt work for me. I get this when I tried to load up my bot with CMD
http://img413.imageshack.us/img413/9416/100712223040p.png
Back to top
View user's profile Send private message
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Tue Jul 13, 2010 12:22 am    Post subject: Reply with quote

Andreoli wrote:
It doesnt work for me. I get this when I tried to load up my bot with CMD
http://img413.imageshack.us/img413/9416/100712223040p.png

Change
Code:
bind public - !fml fml_main_proc
to
Code:
bind pub - !fml fml_main_proc

There is no public bind, only pub, pubm, msg, msgm and many others.
_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MiNdErAsR
Voice


Joined: 27 Nov 2004
Posts: 17

PostPosted: Tue Jul 13, 2010 7:06 pm    Post subject: Re: . Reply with quote

The_Hatta wrote:
If you change
Code:

regsub -nocase {.*<div\s+class=\"post\"><p>(.*?)<div\s+class=\"date\">.*} $fm_data {\1} fm_data

to
Code:

regsub -nocase {.*<div\s+class=\"post\".+?><p>(.*?)<div\s+class=\"date\">.*} $fm_data {\1} fm_data


everything should work out fine, mine does Razz


This worked, thank you very much!
Back to top
View user's profile Send private message
Andreoli
Voice


Joined: 12 Jul 2010
Posts: 4

PostPosted: Thu Jul 15, 2010 4:12 pm    Post subject: Reply with quote

Ok, awsome, now to be a noob, I know when you first open up Eggdrop you must edit the code carefully, I know I must save this file into the windrop folder that says scripts, how do I actually set the script to my bot to work? :s I am new to Tcl and I am still learning..or if you call fidling for hours to get 0 results learning. Thanks in advance.
Back to top
View user's profile Send private message
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Fri Jul 16, 2010 1:59 am    Post subject: Reply with quote

Andreoli wrote:
Ok, awsome, now to be a noob, I know when you first open up Eggdrop you must edit the code carefully, I know I must save this file into the windrop folder that says scripts, how do I actually set the script to my bot to work? :s I am new to Tcl and I am still learning..or if you call fidling for hours to get 0 results learning. Thanks in advance.

Read it: Using Tcl Scripts.
And in the head of the script insert your channel here:
Code:
# channels for !fmylife
set fmylife_channels {#your_channel_for_fmylife}

_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 4 of 7

 
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