Bonsoir à tous,
Dans le but d'ajouter de nouvelles fonctionnalités dans mon add-on Matrix, je voudrais afficher la userlist, lettre par lettre et nick par nick... Voici pour l'instant où j'en suis (ne vous fiez pas à la vitesse d'affichage, elle sera diminuée) :
/*
Thanks for having downloaded this script
Matrix v2.1 by moo
Contact : Tybalt15@hotmail.com or irc.epiknet.org (/query moo)
Use: HELP.txt
Special thanks to Elizio, CoolWave and Sorn_Drixer for helping and their remarks. :]
*/
menu * {
-
Matrix
.Red:matrix.choix red
.Green:matrix.choix green
.Blue:matrix.choix blue
}
alias matrix {
if (!$window(@Matrix)) {
if ($hget(users)) { hfree users }
hmake users 300 var %i 1, %nbuser $nick($chan,0)
while (%i <= %nbuser) {
hadd users $nick($chan,%i) $len($nick($chan,%i))
inc %i
}
hadd users selected $hget(users,$rand(1,$hget(users,0).item)).item
hadd users count 1
hadd users pos $calc((245 - ($hget(users,$hget(users,selected)) * 6.5)) / 2)
window -CkBpdho +tL @Matrix 0 0 245 300
drawrect -f @Matrix 1 0 0 0 245 300
if ($hget(tab0)) { hfree tab0 }
hmake tab0 1
hadd tab0 loop 0
var %i = 1
while (%i <= 20) {
if ($hget(tab $+ [ %i ])) { hfree tab $+ [ %i ] }
hmake tab $+ [ %i ] 20
hadd tab $+ [ %i ] %i $rand(a,z)
hadd tab $+ [ %i ] vc $rand(15,21)
hadd tab $+ [ %i ] y
inc %i
.timer -m 1 0 matrix.load
}
}
}
alias -l matrix.choix {
if ($hget(matrixcolor)) { hfree matrixcolor }
hmake matrixcolor 1
hadd matrixcolor color $1
hadd matrixcolor speed 4
hadd matrixcolor brightness 235
matrix
}
alias -l matrix.alias {
hadd $1 y $calc($hget($1,y) + $hget($1,vc))
if ($hget($1,y) > $rand(380,430)) {
hadd $1 y 0
var %i = 1
while (%i <= 20) {
hadd $1 %i $rand(A,Z)
inc %i
}
if ($hget(matrixcolor,speed) == 1) { hadd $1 vc $rand(3,6) }
elseif ($hget(matrixcolor,speed) == 2) { hadd $1 vc $rand(6,10) }
elseif ($hget(matrixcolor,speed) == 3) { hadd $1 vc $rand(10,15) }
elseif ($hget(matrixcolor,speed) == 4) { hadd $1 vc $rand(15,21) }
elseif ($hget(matrixcolor,speed) == 5) { hadd $1 vc $rand(21,28) }
elseif ($hget(matrixcolor,speed) == 6) { hadd $1 vc $rand(28,36) }
elseif ($hget(matrixcolor,speed) == 7) { hadd $1 vc $rand(36,45) }
elseif ($hget(matrixcolor,speed) == 8) { hadd $1 vc $rand(45,55) }
elseif ($hget(matrixcolor,speed) == 9) { hadd $1 vc $rand(55,66) }
elseif ($hget(matrixcolor,speed) == 10) { hadd $1 vc $rand(66,78) }
}
if ($hget(matrixcolor,color) == red) {
drawtext -ro @matrix $rgb(255,200,200) "Matrix Code NFI" 15 $2 $calc($hget($1,y) - (%j * 10)) $rand(a,z)
var %j = 2
while (%j <= 7) {
drawtext -ro @matrix $rgb($calc(255 - (%j * -($hget(matrixcolor,brightness)))),0,0) "Matrix Code NFI" 15 $2 $calc($hget($1,y) - (%j * 13)) $rand(a,z)
inc %j
}
}
elseif ($hget(matrixcolor,color) == green) {
drawtext -ro @matrix $rgb(200,255,200) "Matrix Code NFI" 15 $2 $calc($hget($1,y) - (%j * 10)) $rand(a,z)
var %j = 2
while (%j <= 7) {
drawtext -ro @matrix $rgb(0,$calc(255 - (%j * -($hget(matrixcolor,brightness)))),0) "Matrix Code NFI" 15 $2 $calc($hget($1,y) - (%j * 13)) $rand(a,z)
inc %j
}
}
else {
drawtext -ro @matrix $rgb(200,200,255) "Matrix Code NFI" 15 $2 $calc($hget($1,y) - (%j * 10)) $rand(a,z)
var %j = 2
while (%j <= 7) {
drawtext -ro @matrix $rgb(0,0,$calc(255 - (%j * -($hget(matrixcolor,brightness))))) "Matrix Code NFI" 15 $2 $calc($hget($1,y) - (%j * 13)) $rand(a,z)
inc %j
}
}
}
alias -l matrix.color {
drawtext -ro @matrix $rgb($1,$2,$3) "Matrix Code NFI" 15 $2 $calc($hget($1,y) - (%j * 10)) $rand(a,z)
var %j = 2
while (%j <= 7) {
drawtext -ro @matrix $rgb($4,$5,$6) "Matrix Code NFI" 15 $2 $calc($hget($1,y) - (%j * 13)) $rand(a,z)
inc %j
}
}
alias -l matrix.loop {
if ($window(@matrix)) {
drawrect -fn @Matrix 1 0 0 0 245 300
drawtext -ron @matrix $rgb(200,255,200) Miltown 40 20 100 MATRIX
if ($hget(matrixcolor,speed) = 1) { drawtext -ron @matrix $rgb(255,255,255) Verdana 10 2 2 MATRIX SPEED : $hget(matrixcolor,speed) (min) }
elseif ($hget(matrixcolor,speed) = 10) { drawtext -ron @matrix $rgb(255,255,255) Verdana 10 2 2 MATRIX SPEED : $hget(matrixcolor,speed) (max) }
else { drawtext -ron @matrix $rgb(255,255,255) Verdana 10 2 2 MATRIX SPEED : $hget(matrixcolor,speed) }
drawtext -ron @matrix $rgb(255,255,255) Verdana 10 2 12 MATRIX BRIGHTNESS : $hget(matrixcolor,brightness)
if ($hget(users,count) <= $hget(users,$hget(users,selected))) {
drawtext -ron @matrix $rgb(255,255,255) Verdana 12 $hget(users,pos) 150 $mid($hget(users,selected),$hget(users,count),1)
hinc users pos 6
hinc users count
}
else {
hadd users selected $hget(users,$rand(1,$hget(users,0).item)).item
hadd users count 1
hadd users pos $calc((245 - ($hget(users,$hget(users,selected)) * 6.5)) / 2)
echo -a $hget(users,selected)
}
var %i 1, %y -12
while (%i <= 20) {
%y = %y + 12
matrix.alias tab $+ [ %i ] %y
inc %i
}
%y = -12
.timer -m 1 0 matrix.loop
drawdot @matrix
%j = 1
}
}
alias -l matrix.load.c {
drawtext -ro @matrix $rgb($1,$2,$1) Miltown 30 20 75 matrix
drawtext -ro @matrix $rgb($1,$2,$1) Miltown 40 20 75 MATRIX
drawtext -ro @matrix $rgb($1,$2,$1) Miltown 12 85 125 BY MOO
drawtext -ro @matrix $rgb($1,$1,$2) "Matrix Code NFI" 15 25 200 WELCOME TO THE REAL WORLD
}
alias -l matrix.load {
if ($hget(tab0,loop) < 0) { var %r 0, %g 0
while (%g <= 255) { matrix.load.c 0 %g | inc %g .07 }
while (%r <= 200) { matrix.load.c %r 255 | inc %r .3 }
while (%r >= 0) { matrix.load.c %r 255 | dec %r .3 }
while (%g >= 0) { matrix.load.c 0 %g | dec %g .07 }
while (%g <= 255) { drawtext -ro @matrix $rgb(0,%g,0) Miltown 40 20 100 MATRIX | inc %g .07 }
while (%r <= 200) { drawtext -ro @matrix $rgb(%r,255,%r) Miltown 40 20 100 MATRIX | inc %r .1 }
.timer 1 1 matrix.load
hinc tab0 loop
}
.timer -m 1 0 matrix.loop
}
alias matrix.close {
window -c @matrix
hfree users
var %i = 0
while (%i <= 20) {
hfree tab $+ [ %i ]
inc %i
}
}
menu @matrix {
sclick { matrix.close }
}
on *:keydown:@matrix:*: {
if (($keyval == 38) && $hget(matrixcolor,speed) != 10) { hinc matrixcolor speed }
elseif (($keyval == 40) && $hget(matrixcolor,speed) != 1) { hdec matrixcolor speed }
elseif ($keyval == 39) { hinc matrixcolor brightness }
elseif ($keyval == 37) { hdec matrixcolor brightness }
elseif ($keyval == 82) { hadd matrixcolor color red }
elseif ($keyval == 71) { hadd matrixcolor color green }
elseif ($keyval == 66) { hadd matrixcolor color blue }
elseif ($keyval == 27) { matrix.close }
echo -a $keyval
}
Au bout d'un certain temps, j'obient dans le status (après un debug) "Selected", "Count" ou "Pos".
J'en conclus donc que j'ajoute ces items dans ma htable mais je ne sais pas du tout à quel moment...
Je suppose que je problème surgit à ce moment, mais tout me semble pourtant correct :
else {
hadd users selected $hget(users,$rand(1,$hget(users,0).item)).item
hadd users count 1
hadd users pos $calc((245 - ($hget(users,$hget(users,selected)) * 6.5)) / 2)
echo -a $hget(users,selected)
}
Si quelqu'un trouve la solution... :]
Afficher la suite