| View previous topic :: View next topic |
| Author |
Message |
janii Halfop
Joined: 03 Aug 2011 Posts: 41
|
Posted: Wed Aug 03, 2011 8:31 am Post subject: I need help with my personalise tcl |
|
|
Hello i ve changed trivia.tcl by souperman to sum extend but having trouble in the showin manner of hint system like it starts frm 0 and i want it to start from 1/5 .. instead its giving 0/4
Thanks in advance
<Trivia> General knowledge, Which is the largest democracy? »» 8474 ««
<Trivia> 0/4: *****
<Trivia> 1/4: I****
<Trivia> 2/4: I***a
<Trivia> 3/4: I**ia
<Trivia> 4/4: In*ia
<Trivia> Am I alone here or what? The correct answer was India. Try and get the next one...
WANT IT TO BE LIKE THIS
<Trivia> General knowledge, Which is the largest democracy? »» 8474 ««
<Trivia> 1/5: *****
<Trivia> 2/5: I****
<Trivia> 3/5: I***a
<Trivia> 4/5: I**ia
<Trivia> 5/5: In*ia
<Trivia> Am I alone here or what? The correct answer was India. Try and get the next one...
Below is the code...
#shows timed hints.
proc tghint {} {
global tgmaxhint tghintnum tgcurrentanswer tghinttimer tgchan botnick tgrose1 tgrose2
global tgtimehint tghintchar tgquestionnumber tgquestionstotal
global tgcurrentquestion tghintcharsused tgnextqtimer tgtimenext tgstreak tgstreakmin
global tgnobodygotit tgtrythenextone tgmissed tgmaxmissed tgcmdstart tgshowanswer
global tgtimestart tgtimeanswer tgalwaysshowq tgmaxhintcurrent tgtempnohint tgcapshint
if {![info exists tghintnum]} {
set tghintnum 0
regsub -all -- "\[^A-Za-z0-9\]" $tgcurrentanswer "" _hintchars
set tgmaxhintcurrent [expr [strlen $_hintchars]<=$tgmaxhint?[expr [strlen $_hintchars]-1]:$tgmaxhint]
catch {tgunbindhintcmd}
if {$tgmaxhintcurrent>0} {
set tgrebindhinttimer [utimer $tgtempnohint tgbindhintcmd]
}
} else { incr tghintnum }
if {$tghintnum >= [expr $tgmaxhintcurrent+1]} {
incr tgmissed
set _msg ""
append _msg "[tgcolmiss][lindex $tgnobodygotit [rand [llength $tgnobodygotit]]]"
if {$tgshowanswer==1} {
append _msg " 6The correct answer was6 [tgcolmisc2]$tgcurrentanswer[tgcolmiss]."
}
if {$tgmaxmissed>0&&$tgmissed>=$tgmaxmissed} {
append _msg " \0034This was $tgmissed-a Unanswered question! Due to inactivity, the game was stopped automatically. \002To restart the game after screaming $botnick!!!\0034\002"
if {$::team(topic_change)} { utimer 20 [putserv "TOPIC $tgchan :$::offmode"] }
tgquietstop
} else {
append _msg " [lindex $tgtrythenextone [rand [llength $tgtrythenextone]]]"
}
tggamemsg "[tgcolmiss]$_msg"
if {$tgstreakmin>0&&[lindex [split $tgstreak ,] 1]>=$tgstreakmin} { tgstreakend }
set tgstreak 0
catch {unbind pubm -|- "$tgchan *" tgcheckanswer}
if {$tgmaxmissed==0||$tgmissed<$tgmaxmissed} {
set tgnextqtimer [utimer $tgtimenext tgnextq]
}
return
} elseif {$tghintnum == 0} {
set i 0
set _hint {}
set tghintcharsused {}
foreach word [split $tgcurrentanswer] {
regsub -all -- "\[A-Za-z0-9\]" $word $tghintchar _current
lappend _hint $_current
}
if {$tgtimeanswer==1} {
set tgtimestart [clock clicks -milliseconds]
}
} elseif {$tghintnum == 1} {
set i 0
set _hint {}
while {$i<[llength [split $tgcurrentanswer]]} {
set _word [lindex [split $tgcurrentanswer] $i]
set j 0
set _newword {}
while {$j<[strlen $_word]} {
if {$j==0} {
append _newword [stridx $_word $j]
lappend tghintcharsused $i,$j
} else {
if {[string is alnum [stridx $_word $j]]} {
append _newword "$tghintchar"
} else {
append _newword [stridx $_word $j]
lappend tghintcharsused $i,$j
}
}
incr j
}
lappend _hint $_newword
incr i
}
} else {
set i 0
set _hint {}
while {$i<[llength [split $tgcurrentanswer]]} {
set _word [lindex [split $tgcurrentanswer] $i]
set j 0
set _newword {}
set _selected [rand [strlen $_word]]
regsub -all -- "\[^A-Za-z0-9\]" $_word "" _wordalnum
if {[strlen $_wordalnum]>=$tghintnum} {
while {[lsearch $tghintcharsused $i,$_selected]!=-1||[string is alnum [stridx $_word $_selected]]==0} {
set _selected [rand [strlen $_word]]
}
}
lappend tghintcharsused $i,$_selected
while {$j<[strlen $_word]} {
if {[lsearch $tghintcharsused $i,$j]!=-1||[string is alnum [stridx $_word $j]]==0} {
append _newword [stridx $_word $j]
} else {
if {[string is alnum [stridx $_word $j]]} {
append _newword $tghintchar
}
}
incr j
}
lappend _hint $_newword
incr i
}
}
if {$tgcapshint==1} {
set _hint [strupr $_hint]
}
#tggamemsg ""
if {$tgalwaysshowq==1||$tghintnum==0} {
tggamemsg ""
tggamemsg "[tgcolqbody]$::hbonus[tgcolqbody] $tgcurrentquestion 4»» [expr $tgquestionnumber+1] 4««"
}
# [expr $tghintnum?"":""]
tggamemsg "[tgcolhint] $tghintnum/$tgmaxhintcurrent:[tgcolmisc2] [join $_hint]"
set tghinttimer [utimer $tgtimehint tghint]
}
Last edited by janii on Sun Aug 07, 2011 6:54 pm; edited 1 time in total |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Thu Aug 04, 2011 9:00 am Post subject: |
|
|
| Code: | | tggamemsg "[tgcolhint] $tghintnum/$tgmaxhintcurrent:[tgcolmisc2] [join $_hint]" |
Change that above, to look like it does below:
| Code: | | tggamemsg "[tgcolhint] [expr {$tghintnum + 1}]/[expr {$tgmaxhintcurrent + 1}]:[tgcolmisc2] [join $_hint]" |
_________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
janii Halfop
Joined: 03 Aug 2011 Posts: 41
|
Posted: Thu Aug 04, 2011 11:25 am Post subject: |
|
|
Thank you very much SpeechLess its working perfectly u people are great help
M just SpeechLess like ur account name ur Great i worked on it for almost 3 months and wasnt able to get it workin m nt tht gud at tcls but m tryin:)
once again thank you very much.... |
|
| Back to top |
|
 |
|