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 from .txt file...

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
D
DjBeNNeTT
Voice
Posts: 27
Joined: Sat Feb 18, 2006 6:40 pm
Location: Telford, Shropshire, UK
Contact:

Post by DjBeNNeTT »

OMFG! lol. I'm blind.

Works perfect. Thanks :D

Code: Select all

set sex "scripts/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 :[subst -nocommands $sexmsg]"
}

proc randomline f {
 set data [split [read [set file [open $f]]][close $file] \n]
 set position [rand [llength $data]]
 lindex $data $position
}
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Sir_Fz wrote:Try Notepad++.
Both Wordpad and Word add invisible controls at the end of each carriage return and therefore Tcl code generated with either are prone to error generation/mis-reading. Text editors that leave scripts in Unix format are error free.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
D
DjBeNNeTT
Voice
Posts: 27
Joined: Sat Feb 18, 2006 6:40 pm
Location: Telford, Shropshire, UK
Contact:

Post by DjBeNNeTT »

Weird, i've never experianced a problem with wordpad.
I know that Notepad shows the squares for the next line command thingy.. (lol). Where in wordpad it converts it so that it is a next line, but when i save it, it seems perfectly happy.
Post Reply