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 

Sending text from a file to a channel

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Thu Jul 14, 2011 9:19 am    Post subject: Sending text from a file to a channel Reply with quote

Hey

I wrote this some time back with a little help here on the forums i want to change it slightly

Currently I have to type !next line number in pm with the bot id like to get it so I only have to type !next and it will output the next line of text

Code:
set out_chan "#Trainingroom"
set txt_file "training.txt"
bind msg SA|SA !next next_proc
bind msg SA|SA !back back_proc

proc tr_proc { nick uhost hand arg } {
  global out_chan txt_file
  set line [lindex [split $arg] 0]
  if {$line == ""} {
    putserv "PRIVMSG $chan :Usage: !next <line number>"
    return
  }
  set take_me [open $txt_file r]
  set take_all [split [read $take_me] "\n"]
  close $take_me
  set data [lindex $take_all [expr $line - 1]]
  putquick "PRIVMSG $out_chan :$data"
}

proc back_proc { nick uhost hand arg } {
  global out_chan txt_file
  set line [lindex [split $arg] 0]
  if {$line == ""} {
    putserv "PRIVMSG $chan :Usage: !back <line number>"
    return
  }
  set take_me [open $txt_file r]
  set take_all [split [read $take_me] "\n"]
  close $take_me
  set data [lindex $take_all [expr $line - 1]]
  putquick "PRIVMSG $out_chan :$data"
}


Many Thanks
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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