This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Read .txt

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
c
cBuster
Voice
Posts: 5
Joined: Thu Sep 22, 2005 7:06 am

Read .txt

Post by cBuster »

Hi!

Anyone who can tell me how to make a .tcl-script that just announce everything that stands in a .txt?

Lets say that I want my bot to announce everything that stands in http://xxx.xxxx.com/test.txt when I type !test

Anyone want do to a script like that for me? :)

*EDIT*

Forgot to say that I want the bot to notice the "results" for the one who typed the command. Not to all in chan or private-msg.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

read the file into a list, bind to pub command and when that bind triggers, foreach element in your list putserv notice to the nick that issued command
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
c
cBuster
Voice
Posts: 5
Joined: Thu Sep 22, 2005 7:06 am

Post by cBuster »

demond wrote:read the file into a list, bind to pub command and when that bind triggers, foreach element in your list putserv notice to the nick that issued command
I don't know a [censored] about .tcl. So I don't understand anything about what you said, hehe.

I thought a script like that was so simple to do that you had time to make one for me. It will take me like one week before I can do it myself. Don't have that much time so I hope a kind soul in here can help me out... :)
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

hey this was in Script Help forum! wasn't it?
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
c
cBuster
Voice
Posts: 5
Joined: Thu Sep 22, 2005 7:06 am

Post by cBuster »

bind pub - !tmp pub:tmp

proc pub:tmp {nick uhost hand chan text} {
if ![channel get $chan tmp] return
set url "http://***.****/***.txt"
}

Something like that? :lol:
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Code: Select all

package require http
bind pub - !test foo
proc foo {n u h c t} {
   set x [::http::geturl http://bar.com/moo.txt]
   foreach e [split [::http::data $x] \n] {puthelp "privmsg $c :$e"}
   ::http::cleanup $x
}
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
N
NTHosts
Op
Posts: 100
Joined: Mon Oct 10, 2005 9:57 pm
Location: UK
Contact:

ermmmmm

Post by NTHosts »

Hello,

that script works fine if you are using just 1.

I tried 2 use a few of them 2 grab different txt files, however it just keeps on grabbing the same txt file and ignoring the rest... yes i am changing the !trigger and changing the url of the file..
Very confused... plz help :D:D:D:D
www.NT-Hosts.Net - More than just a host
User avatar
]Kami[
Owner
Posts: 590
Joined: Thu Jul 24, 2003 2:59 pm
Location: Slovenia
Contact:

Post by ]Kami[ »

You need to change proc names aswell.

Script should look like this then:

Code: Select all

package require http

bind pub - !triger1 foo
bind pub - !triger2 foo2

proc foo {n u h c t} {
   set x [::http::geturl http://bar.com/moo1.txt]
   foreach e [split [::http::data $x] \n] {puthelp "privmsg $c :$e"}
   ::http::cleanup $x
}

proc foo2 {n u h c t} {
   set x [::http::geturl http://bar.com/moo2.txt]
   foreach e [split [::http::data $x] \n] {puthelp "privmsg $c :$e"}
   ::http::cleanup $x
} 
// Thanks Sir_Fz
Last edited by ]Kami[ on Sun Nov 06, 2005 6:56 pm, edited 1 time in total.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

You forgot to close the open brace of the foo proc.
N
NTHosts
Op
Posts: 100
Joined: Mon Oct 10, 2005 9:57 pm
Location: UK
Contact:

yay

Post by NTHosts »

Thanks guys, works great now :)
www.NT-Hosts.Net - More than just a host
l
lebjustice
Voice
Posts: 5
Joined: Sun Jun 17, 2007 11:20 pm

Post by lebjustice »

How to make this auto check every 1 min the txt and if any 1line or 2 lines is been changed it will be auto posted in the chan. thanks

Code: Select all

package require http 
bind pub - !test foo 
proc foo {n u h c t} { 
   set x [::http::geturl http://bar.com/moo.txt] 
   foreach e [split [::http::data $x] \n] {puthelp "privmsg $c :$e"} 
   ::http::cleanup $x 
} 

Post Reply