| View previous topic :: View next topic |
| Author |
Message |
cBuster Voice
Joined: 22 Sep 2005 Posts: 5
|
Posted: Thu Sep 22, 2005 11:26 am Post subject: Read .txt |
|
|
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. |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Sep 22, 2005 11:35 am Post subject: |
|
|
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] tag when posting logs, code |
|
| Back to top |
|
 |
cBuster Voice
Joined: 22 Sep 2005 Posts: 5
|
Posted: Thu Sep 22, 2005 11:51 am Post subject: |
|
|
| 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...  |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Thu Sep 22, 2005 11:26 pm Post subject: |
|
|
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] tag when posting logs, code |
|
| Back to top |
|
 |
cBuster Voice
Joined: 22 Sep 2005 Posts: 5
|
Posted: Sun Sep 25, 2005 1:13 pm Post subject: |
|
|
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?  |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sun Sep 25, 2005 2:41 pm Post subject: |
|
|
| Code: |
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] tag when posting logs, code |
|
| Back to top |
|
 |
NTHosts Op
Joined: 10 Oct 2005 Posts: 100 Location: UK
|
Posted: Sun Oct 23, 2005 7:42 am Post subject: ermmmmm |
|
|
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     _________________ www.NT-Hosts.Net - More than just a host |
|
| Back to top |
|
 |
]Kami[ Owner

Joined: 24 Jul 2003 Posts: 590 Location: Slovenia
|
Posted: Sun Nov 06, 2005 6:42 pm Post subject: |
|
|
You need to change proc names aswell.
Script should look like this then:
| Code: | 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 _________________ Slovene Eggdrop Page
Last edited by ]Kami[ on Sun Nov 06, 2005 6:56 pm; edited 1 time in total |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Nov 06, 2005 6:55 pm Post subject: |
|
|
You forgot to close the open brace of the foo proc. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
NTHosts Op
Joined: 10 Oct 2005 Posts: 100 Location: UK
|
Posted: Sun Nov 06, 2005 7:38 pm Post subject: yay |
|
|
Thanks guys, works great now  _________________ www.NT-Hosts.Net - More than just a host |
|
| Back to top |
|
 |
lebjustice Voice
Joined: 17 Jun 2007 Posts: 5
|
Posted: Wed Dec 26, 2007 7:33 am Post subject: |
|
|
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: | 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
}
|
|
|
| Back to top |
|
 |
|