[Résolu] problème de points avec trivia
#4
Bien que j'avais avoir pensé trouvé la solution pour mon trivia il me reste quelques petits problèmes visible sur le screen suivant :

[Image: http://imagesup.org/miniatures10/1346605...12-09-.png]


voici donc le bouh de code que j'ai modifié :

Code :
#Mise en place des indices.
proc tghint {} {
    global tgmaxhint tghintnum tgcurrentanswer tghinttimer tgchan
    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 "09,01La réponse était [tgcolmisc2]13,01$tgcurrentanswer[tgcolmiss]."
        }
        if {$tgmaxmissed>0&&$tgmissed>=$tgmaxmissed} {
            append _msg " Cela fait $tgmissed questions sans réponse ! Le  quizz a ete automatiquement arreté. pour le relancer, tapez 04$tgcmdstart"
            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]
    }
    if {$tgalwaysshowq==1||$tghintnum==0} {
        tggamemsg "04,01 -07,01\[\Question n°[expr $tgquestionnumber+1]\]\04,01-[tgcolqbody] $tgcurrentquestion ? "
    }
    tggamemsg "04,01 € 07,01Indice : 08,01[join $_hint] "
    set tghinttimer [utimer $tgtimehint tghint]
}

comme indiqué sur le poste qui se trouve ici : http://forum.egghelp.org/viewtopic.php?t...art=15#top

j'ai commencé a avoir les problèmes après les passage à tcl 8.5 ( oui oui moi et les majs :p ) et mon trivia date encore du temps de lecyb.org après que ChonkoBN l'avait traduit en français donc que du vieux :p

Sinon je pense que mon bug arrive lorsque les joueurs répondent trop vite voir en même temps que l'indice.

Merci d'avance de votre patience Smile
Répondre Avertir


Messages dans ce sujet
RE: [Résolu] problème de points avec trivia - par kipof - 02/09/2012, 19:14

Atteindre :


Utilisateur(s) parcourant ce sujet : 5 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté