[Résolu] problème de points avec trivia
#1
Bonsoir,

J'ai eu des problèmes avec mon trivia que j'utilise depuis des années après le passage à tcl 8.5. j'ai donc pris le trivia.tcl proposé par crazycat dans un sujet retrouvé par la recherche mais le problème est qu'il retire les points des joueurs a la place de les ajouter :/ une petite idée pour faire la lumière sur mon petit problème ?

merci d'avance Smile

je pense avoir résolue le problème avec mon trivia ( même problème ici : http://forum.eggdrop.fr/triviatcl-resolu-t-419.html ) avec la réponse qui se trouve ici : http://forum.egghelp.org/viewtopic.php?t...art=15#top pour les personnes qui ont le même problème Smile
Répondre Avertir
#2
Je marque le sujet comme résolu, sauf si tu te rends compte que ça ne l'est pas Wink
Répondre
#3
La solution trouvé semble être ok pour le moment merci CrazyCat Smile
Répondre Avertir
#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
#5
Tu devrais p-e essayer d'utiliser cette version
Répondre
#6
Vue les modifications apporté a mon trivia j'ai légèrement la flemme de reprendre un autre version xD voilà pourquoi je voudrais juste corriger ma version Smile mais je vais regarder cette version pour voir si je trouve le problème.

Merci
Répondre Avertir
#7
Sinon, tu fais un diff entre ta version et la version d'origine, et tu essayes d'appliquer (à la main) le patch
Répondre
#8
Désolé pour le retard à répondre mais les déplacements avec le boulot :p. Donc oui le diff j'y avais pas pensé donc merci pour l'info je vais faire cela dans le week-end Smile
Répondre Avertir
#9
Suite pour un vrai résolu ( la solution kwa :p )

En gros j'avais un problème de points avec la version qui est en téléchargement car j'avais gardé ma bd de points qui date depuis outch... bref après avoir fait le diff j'ai remarqué les lignes commenté dans la proc tgincrscore ( alors que je suis passé devant 100 fois ) j'ai donc juste d commenté les ligne et commenté les modifications apporté car avec une vielle bd de scores ca délire un max Smile


tcl
#incrément les points de la personne points.
proc tgincrscore {who} {
    global tgscores tgscf tgpointsperanswer tgscorestotal tgscoresbyname tghintnum
    tggetscores
    if {$tgscorestotal>0} {
        set i 0
        if {![info exists tgscoresbyname([strlwr $who])]} {
	        append _newscores "[expr $tgpointsperanswer-$tghintnum],[expr 1000000000000.0/[unixtime]],$who,[strlwr $who] "
            #append _newscores "1,[expr 1000000000000.0/[unixtime]],$who,[strlwr $who] "
        }
        while {$i<[llength $tgscores]} {
            set _item [lindex $tgscores $i]
            set _nick [lindex [split $_item ,] 2]
            set _time [lindex [split $_item ,] 1]
            set _score [lindex [split $_item ,] 0]
            if {[strlwr $who]==[strlwr $_nick]} {
	            append _newscores "[expr $_score+$tgpointsperanswer-$tghintnum],[expr 1000000000000.0/[unixtime]],$who,[strlwr $who][expr [expr [llength $tgscores]-$i]==1?"":"\ "]"
                #append _newscores "[expr $_score+$tgpointsperanswer],[expr 1000000000000.0/[unixtime]],$who,[strlwr $who][expr [expr [llength $tgscores]-$i]==1?"":"\ "]"
            } else {
                append _newscores "$_score,$_time,$_nick,[strlwr $_nick][expr [expr [llength $tgscores]-$i]==1?"":"\ "]"
            }
            incr i
        }
    } else {
	    append _newscores "[expr $tgpointsperanswer-$tghintnum],[expr 1000000000000.0/[unixtime]],$who,[strlwr $who]"
        #append _newscores "1,[expr 1000000000000.0/[unixtime]],$who,[strlwr $who]"
    }
    set _sfile [open $tgscf w]
    puts $_sfile "$_newscores"
    close $_sfile
    return
}


Répondre Avertir


Atteindre :


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