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.

help tcl script

Old posts that have not been replied to for several years.
Locked
t
tahu
Voice
Posts: 14
Joined: Fri Feb 11, 2005 10:45 pm
Location: bandung
Contact:

help tcl script

Post by tahu »

proc g_timer_ask {} {
global botnick quizconf
global Answers AllAnswered RoundOver NumAnswered AnswerCount QuestionTimer
set x_ask $botnick {} {} $quizconf(quizchannel) {}
set Timer [utimer 10 Question]

}

i want to random this but i dont know how to do
plz help me!
no limit to learn
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

Randomize what exactly? All this code ever does is adding a timer that is executing another proc (Question) 10sec later.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

in case you want to get a random element from a list you should read:
http://www.tcl.tk/man/tcl8.4/TclCmd/lindex.htm
and
DOC/TCL-COMMANDS section "rand"

I didn't say RTFM, did I?
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
t
tahu
Voice
Posts: 14
Joined: Fri Feb 11, 2005 10:45 pm
Location: bandung
Contact:

Post by tahu »

-set x_ask $botnick {} {} $quizconf(quizchannel) {}
-set Timer [utimer 10 Question]

i mean first round set x_ask
and the second round set timer
something like that.
thanks.
no limit to learn
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

I dunno bout you guys but I am still confused by their Question.. Tahu Please explain properly..
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

u mean the u timer should be random ??

try this

Code: Select all

utimer [rand 20] ...
XplaiN but think of me as stupid
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

maybe he wants to rotate like this?

Code: Select all

switch $qcounter {
  1 {set x_ask $botnick {} {} $quizconf(quizchannel) {} }
  2 {set Timer [utimer 10 Question] }
}
if { [incr qcounter] > 2 } { set qcounter 1 }
alternativly he can use [set qcounter [rand 2]] or something like this for randomize @_o.

PS: this is my last guess without detailed explainations ^^
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
t
tahu
Voice
Posts: 14
Joined: Fri Feb 11, 2005 10:45 pm
Location: bandung
Contact:

Post by tahu »

i write like what u say [De Kus} but the bot can executing another command. the bot stuck.
i wrote like this

proc mx_timer_ask {} {
global botnick quizconf
global Timer
switch $qcounter {
1 {set x_ask $botnick {} {} $quizconf(quizchannel) {} }
2 {set Timer [utimer 10 Question] }
}
if { [incr qcounter] > 2 } { set qcounter 1 }

please give me another way . cos i'm new in this n i want learn but i dont know how to do
for clue i want rotate this 2 script
n please write with the proc
cos i dunno what must i write.
thanks.
no limit to learn
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

http://www.tcl.tk/man/tcl8.4/TclCmd/global.htm
read and think about your code again.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Locked