@# Quotes DB     useful, funny, interesting





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



Comments:

<0> Can somebody help me please. iam looking for a TCL that announce a chatlog.txt in a channel?
<1> any tcl editors out there with command completion?
<2> ;set list "red blue"
<3> anc: #1154 (326 clicks) Tcl: red blue
<2> ;puts [lindex [expr $list int(rand()*[llength $list])]
<2> ;puts "[lindex [expr $list int(rand()*[llength $list])]"
<2> is there an easier way ?=
<2> random select one of the words
<4> not really
<4> seems easy enough
<2> k
<4> just put it in a function ;)
<2> ok
<4> but
<4> you have to use [expr [llength $list] - 1]
<4> because length goes from 1 - x



<2> oh ok
<4> while index from 0 - x-1
<4> at least normally :)
<2> yea
<4> should be the same in tcl
<2> it is
<4> hm
<4> but then again...
<4> expr?
<5> expr -> http://www.tcl.tk/man/tcl8.4/TclCmd/expr.htm
<3> expr -> http://Tcl.Tk/man/tcl8.5/TclCmd/expr.htm
<2> ;puts "[lindex [expr $list int(rand()*[expr [llength $list] -1])]"
<4> rand produces number < 1
<4> so you should be fine
<4> even without -1
<2> ok
<2> howcome it doesnt work the line in here ?
<4> let's see
<4> ;puts $list
<3> Obeliks: #1180 (stdout) red blue
<4> ;puts $list [lindex [expr $list int(rand()*[llength $list])]
<4> ;puts [lindex $list [expr $list int(rand()*[llength $list])]
<4> ;puts $errorInfo
<3> Obeliks: #1181 (stdout) invalid command name "let's"
<3> Obeliks: #1181 (stdout) while executing
<3> Obeliks: #1181 (stdout) "let's see"
<3> Obeliks: There's 4 lines, but I'm not gonna show you the rest of them! =P
<4> lol
<2> :)
<2> ;puts [expr $list int(rand()*[expr [llength $list] -1])
<4> ;puts [lindex $list [expr int(rand()*[llength $list])]
<4> lol
<4> ;puts [lindex $list [expr {int(rand()*[llength $list])}]
<2> ;puts [expr $list int(rand()*2])
<3> anc: #1184 (934 clicks) Tcl error: syntax error in expression "red blue int(rand()*2": the word "red" requires a preceding $ if it's a variable or function arguments if it's a function
<4> hehe
<2> :)
<4> why should there be a $list in the expr?`
<4> oh
<4> my bad
<4> ;puts [lindex $list [expr {int(rand()*[llength $list])}]]
<3> Obeliks: #1190 (stdout) red
<4> well your bad...
<2> ah
<2> tnx
<4> but I overlooked it too :D
<2> hehe
<2> ;puts [lindex $list [expr {int(rand()*[llength $list])}]]
<3> anc: #1196 (stdout) red
<2> ;puts [lindex $list [expr {int(rand()*[llength $list])}]]
<4> ;puts [lindex $list [expr int(rand()*[llength $list])]]
<3> anc: #1197 (stdout) red
<3> Obeliks: #1198 (stdout) red
<2> ;puts [lindex $list [expr {int(rand()*[llength $list])}]]
<4> ;puts [lindex $list [expr int(rand()*[llength $list])]]
<3> anc: #1199 (stdout) red
<3> Obeliks: #1200 (stdout) red
<2> only choose red :)
<3> Obeliks: #1201 (stdout) blue
<3> Obeliks: #1202 (stdout) red



<4> ;puts [lindex $list [expr int(rand()*[llength $list])-1]]
<4> ;puts [lindex $list [expr int(rand()*[llength $list])]]
<3> Obeliks: #1205 (stdout) blue
<4> no, there was one blue ;)
<4> well
<4> of course
<4> blue only gets picked if rand()==0
<4> so chances are low
<4> hm...
<4> ;puts [lindex $list [expr round(rand()*([llength $list]-1))]]
<3> Obeliks: #1212 (stdout) red
<4> ;puts [lindex $list [expr round(rand()*([llength $list]-1))]]
<3> Obeliks: #1213 (stdout) blue
<3> Obeliks: #1214 (stdout) blue
<2> well works fine
<3> Obeliks: #1215 (stdout) red
<3> Obeliks: #1216 (stdout) blue
<4> take that one
<4> or no
<4> actually
<4> ;puts [lindex $list [expr int(rand()*([llength $list]-1))]]
<3> Obeliks: #1221 (stdout) red
<4> should be the best
<4> ;puts [lindex $list [expr int(rand()*([llength $list]-1))]]
<3> Obeliks: #1223 (stdout) red
<4> ;set i 10
<3> Obeliks: #1224 (292 clicks) Tcl: 10
<4> while (i > 0) { puts [lindex $list [expr int(rand()*([llength $list]-1))]]; incr i -1 }
<4> ;while (i > 0) { puts [lindex $list [expr int(rand()*([llength $list]-1))]]; incr i -1 }
<3> Obeliks: #1226 (1182 clicks) Tcl error: wrong # args: should be "::pubsafetcl::While interp condition body"
<4> ;while ($i > 0) { puts [lindex $list [expr int(rand()*([llength $list]-1))]]; incr i -1 }
<3> Obeliks: #1227 (1271 clicks) Tcl error: wrong # args: should be "::pubsafetcl::While interp condition body"
<4> whatever :D
<4> ;while {$i > 0} { puts [lindex $list [expr int(rand()*([llength $list]-1))]]; incr i -1 }
<3> Obeliks: #1229 (stdout) red
<3> Obeliks: There's 20 lines, but I'm not gonna show you the rest of them! =P
<4> ;set output {}; while {$i > 0} { lappend output [lindex $list [expr int(rand()*([llength $list]-1))]]; incr i -1 }; puts $output
<4> ;set output {}
<3> Obeliks: #1231 (284 clicks) Tcl:
<4> ; while {$i > 0} { lappend output [lindex $list [expr int(rand()*([llength $list]-1))]]; incr i -1 }; puts $output
<4> ;while {$i > 0} { lappend output [lindex $list [expr int(rand()*([llength $list]-1))]]; incr i -1 }
<3> Obeliks: #1233 (712 clicks) Tcl:
<4> ;puts $output
<4> oh whatever :)
<2> :)
<2> it really dont like to choose the last one in line
<2> ;set list "red blue orange"
<3> anc: #1238 (300 clicks) Tcl: red blue orange
<2> ;puts [lindex $list [expr int(rand()*([llength $list]-1))]]
<3> anc: #1239 (stdout) blue
<2> ;puts [lindex $list [expr int(rand()*([llength $list]-1))]]
<3> anc: #1240 (stdout) red
<2> ;puts [lindex $list [expr int(rand()*([llength $list]-1))]]
<3> anc: #1241 (stdout) red
<2> ;puts [lindex $list [expr int(rand()*([llength $list]-1))]]
<3> anc: #1242 (stdout) blue
<2> ;puts [lindex $list [expr int(rand()*([llength $list]-1))]]
<3> anc: #1243 (stdout) blue
<2> ;puts [lindex $list [expr int(rand()*([llength $list]-1))]]
<3> anc: #1244 (stdout) blue
<2> :)
<2> ;set list "1 2 3"
<3> anc: #1246 (325 clicks) Tcl: 1 2 3
<2> [expr int(rand()*3]
<3> anc: #1247 (752 clicks) Tcl error: syntax error in expression "int(rand()*3": missing close parenthesis at end of function call
<2> ;[expr int(rand()*3)]
<2> ;puts [expr int(rand()*3)]
<3> anc: #1248 (stdout) 1
<2> ;puts [expr int(rand()*3)]
<3> anc: #1249 (stdout) 0
<2> ;puts [expr int(rand()*3)]
<3> anc: #1250 (stdout) 2


Name:

Comments:

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






Return to #tcl
or
Go to some related logs:

#computers
#heroin
man swap solaris 10
#linux-noob
#goal
threesome01 jpg
athena combolist
word you up into my life
#debian
efnet 30+bar



Home  |  disclaimer  |  contact  |  submit quotes