@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2



Comments:

<0> How do I generate a random line from a file with TCL?
<0> For example, I have quotes.txt, I'd like to have a string to display a random line from that file.
<1> ;set list "3 6 7 1"
<2> anc-: #759 (169 clicks) Tcl: 3 6 7 1
<1> is there another way to multiply them without using for ?
<1> was thinking concat maybe could do it +
<1> ?
<1> ;[expr [concat $list] +]
<1> ;[expr [concat $list +]]
<3> yes
<3> ;expr [join $list *]
<2> Gotisch: #770 (282 clicks) Tcl: 126
<3> ;expr {[join $list *]}
<2> Gotisch: #771 (204 clicks) Tcl: 3*6*7*1
<3> ;expr [join $list *]
<2> Gotisch: #772 (275 clicks) Tcl: 126



<1> ok
<1> ;set list " "
<2> anc-: #774 (179 clicks) Tcl:
<1> ;if {$list != "" || ![info exists list] || $list == {}} { puts "?"} else { puts "empty" }
<2> anc-: #775 (stdout) ?
<1> ;if {$list != "" && ![info exists list] && $list == {}} { puts "?"} else { puts "empty" }
<2> anc-: #776 (stdout) empty
<1> ;set list "a b"
<2> anc-: #777 (143 clicks) Tcl: a b
<1> ;if {$list != "" && ![info exists list] && $list == {}} { puts "?"} else { puts "empty" }
<2> anc-: #778 (stdout) empty
<1> ;if {$list != ""} { puts "?"} else { puts "empty" }
<2> anc-: #779 (stdout) ?
<1> ;if {$list != {}} { puts "?"} else { puts "empty" }
<2> anc-: #780 (stdout) ?
<1> ;set list " ";if {$list != {}} { puts "?"} else { puts "empty" }
<2> anc-: #781 (stdout) ?
<1> ;set list " ";if {$list != {""}} { puts "?"} else { puts "empty" }
<2> anc-: #782 (stdout) ?
<1> ;set list " ";if {![info exists list]} { puts "?"} else { puts "empty" }
<2> anc-: #783 (stdout) empty
<1> ;set list "a b";if {![info exists list]} { puts "?"} else { puts "empty" }
<2> anc-: #784 (stdout) empty
<1> :I
<1> ;set list " ";if {$list == { }} { puts "?"} else { puts "empty" }
<2> anc-: #786 (stdout) empty
<1> ;set list "a b";if {$list == { }} { puts "?"} else { puts "empty" }
<2> anc-: #787 (stdout) empty
<1> ;set list " ";if {$list == " "} { puts "?"} else { puts "empty" }
<2> anc-: #788 (stdout) ?
<1> howcome i cant see if my list is empty
<3> you can?
<1> if there is spaces in the list it should be treated as empty
<1> only spaces
<4> ; llength ""
<2> [piLL]: #798 (127 clicks) Tcl: 0
<4> ; llength " "
<2> [piLL]: #799 (156 clicks) Tcl: 0
<1> ah
<3> ; llength [list " "]
<2> Gotisch: #801 (147 clicks) Tcl: 1
<1> ;set list " ";if {[llength $list == 0} { puts "?"} else { puts "empty" }
<2> anc-: #802 (319 clicks) Tcl error: missing close-bracket
<1> oh well i get it :)
<3> ;set list " ";if {[llength $list] == 0} { puts "?"} else { puts "empty" }
<2> Gotisch: #806 (stdout) ?
<3> ;set list " ";if {[llength $list] > 0} { puts "?"} else { puts "empty" }
<2> Gotisch: #807 (stdout) empty
<1> ;set list "^7test"
<2> anc-: #836 (145 clicks) Tcl: ^7test
<1> ;regsub $list "^[0-9]" list ""
<2> anc-: #837 (2264 clicks) Tcl error: invalid command name "0-9"
<1> ;regsub $list "\^{[0-9]}" list ""
<2> anc-: #838 (2296 clicks) Tcl error: invalid command name "0-9"
<1> ;regsub $list {\^[0-9]} list ""
<2> anc-: #839 (10491 clicks) Tcl: 0
<1> ;puts $list
<2> anc-: #840 (stdout) ^7test
<1> ;regsub $list {[0-9]} list ""
<2> anc-: #841 (202 clicks) Tcl: 0
<1> ;regsub $list [0-9] list ""



<2> anc-: #842 (2281 clicks) Tcl error: invalid command name "0-9"
<1> ;regsub $list {/^[0-9]{5}$/} list ""
<2> anc-: #843 (202 clicks) Tcl: 0
<1> ;regexp $list {/^[0-9]{5}$/} list ""
<2> anc-: #844 (224 clicks) Tcl: 0
<1> ;puts $list
<2> anc-: #845 (stdout) ^7test
<1> regsub -all {[0-9\[\]\^\{\}\`\-\_]} $list "" list
<2> anc-: #846 (21198 clicks) Tcl: 2
<1> ;puts $list
<2> anc-: #847 (stdout) test
<1> ;set list ^7test
<2> anc-: #848 (147 clicks) Tcl: ^7test
<1> regsub {[0-9\[\]\^\{\}\`\-\_]} $list "" list
<2> anc-: #849 (238 clicks) Tcl: 1
<1> ;puts $tet
<1> ;puts $test
<2> anc-: #850 (285 clicks) Tcl error: can't read "tet": no such variable
<2> anc-: #851 (249 clicks) Tcl error: can't read "test": no such variable
<1> ;puts $list
<2> anc-: #852 (stdout) 7test
<1> ;set list ^7test
<2> anc-: #853 (144 clicks) Tcl: ^7test
<1> regsub -all {[0-9\^]} $list "" list
<2> anc-: #854 (1308 clicks) Tcl: 2
<1> ;puts $list
<2> anc-: #855 (stdout) test
<1> ;set arg ancient
<2> anc-: #856 (148 clicks) Tcl: ancient
<1> ;lsearch *$nick* $arg
<2> anc-: #857 (275 clicks) Tcl error: can't read "nick": no such variable
<1> ;lsearch *anc* $arg
<2> anc-: #858 (169 clicks) Tcl: -1
<1> ;lsearch anc *$arg*
<2> anc-: #859 (181 clicks) Tcl: -1
<1> ;string match *anc* $arg
<2> anc-: #860 (264 clicks) Tcl: 1
<5> Hello guys
<5> i need a litle help
<5> i need a simple tcl for antispam
<5> when someone msg the bot to ban him for some min( what i set)
<6> noooo
<1> ;set test ^4a^7nkel
<2> anc-: #900 (176 clicks) Tcl: ^4a^7nkel
<1> regsub -all {[0-9\^]} $test "" test
<2> anc-: #901 (27809 clicks) Tcl: 4
<1> ;puts $test
<2> anc-: #902 (stdout) ankel
<1> ;set test {1on1({[anc]} vs .)}
<2> anc-: #903 (179 clicks) Tcl: 1on1({[anc]} vs .)
<1> ;join $test
<2> anc-: #904 (188 clicks) Tcl: 1on1({[anc]} vs .)
<7> someone here can help me with fixing tcl script for eggdrop? (not my script)
<8> no
<8> can you read?
<8> if yes, why didnt you read the topic?
<8> if no, how you planning to write a script?
<7> ops, sry
<9> is it possible to bind a string with wildcard?
<9> like bind *
<10> bind pubm ?
<9> any string in channel triggers a proc
<9> whats that
<10> bind pubm - "#chan *" proc
<9> ok thanx :))
<10> :)
<9> worx :D
<9> what if i want to trigger
<10> ofc it does
<9> all the strings
<9> on all the chans im on?
<10> just * then
<9> "#* *" ?


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #tcl
or
Go to some related logs:

ntltdr
objusers object variable
#visualbasic
#computers
#beginner
#beginner
polishbustyxxl.com/members/
#stocks
#beginner
#computers



Home  |  disclaimer  |  contact  |  submit quotes