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 

Reading from .txt file

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Burke-1
Voice


Joined: 28 Mar 2012
Posts: 1

PostPosted: Wed Mar 28, 2012 2:25 pm    Post subject: Reading from .txt file Reply with quote

Code:

set sex "./sex.txt"

bind pub - !sex sex:msg

proc sex:msg {nick uhost hand chan arg} {
  global sex
  set sexmsg [string range [randomline $sex] 0 end]
  puthelp "privmsg $chan :$sexmsg"
}

proc randomline f {
 set data [split [read [set file [open $f]]][close $file] \n]
 set position [rand [llength $data]]
 lindex $data $position
}

is there a way this can be modified, so it will keep track of which lines from the sex.txt have been used, and not repeat those until all lines have been used ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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