hi
for %sphere.a, and %sphere.a2
no need to set it 0 the "inc", and "set" command into alias sphere.frame will set it, and wen u close the windows, that will unset so u can remove it
for %sphere.t,%sphere.x, and %sphere.y set it local
var %sphere.t 1,%sphere.x 15,%sphere.y 15
for %sphere.tok u can do this
set %sphere.tok tokenize 32 $regsubex($str(.,225),/./g,\n $+ $chr(32))
and no need to set it, put it directly into the alias sphere.frame
if u want u can use one comand for not use 2 like "inc" "dec" u can use "var"
so
inc %sphere.t
dec %sphere.y
can be one commande also like this
var %sphere.t %sphere.t + 1,%sphere.y %sphere.y - 1
and finaly dont forget to remove hash tables hfree x/y
so your code can be like this
menu channel,status {
Sphere:sphere
}
alias sphere {
window -paoCzdk0 +tnbL @Sphere -1 -1 400 400
var %sphere.t 1,%sphere.x 15,%sphere.y 15
while %sphere.x {
while %sphere.y {
hadd -m X %sphere.t %sphere.x
hadd -m Y %sphere.t %sphere.y
var %sphere.t %sphere.t + 1,%sphere.y %sphere.y - 1
}
dec %sphere.x
}
sphere.frame
}
alias -l sphere.frame {
if ($window(@sphere)) {
clear -n @sphere
drawfill -n @sphere 1 1 1 1
tokenize 32 $regsubex($str(.,225),/./g,\n $+ $chr(32))
scon -r .!drawdot -nr @sphere $!rgb( $!calc( 143+( $* /2)), $!calc( 143+( $* /2)), $!calc(143+ ( $* /2))) 1 $!sphere.iso( $!calc( (7.5- $!hget(Y, $* ))*15* $!cos( $!calc( $!hget(X, $* )*24+ %sphere.a )).deg), $!calc( 75* $!sin( $!calc( $!hget(Y, $* )*24)).deg), $!calc( (7.5- $!hget(Y, $* ))*15* $!sin( $!calc( $!hget(X, $* )*24+ %sphere.a )).deg))
set %sphere.a $calc(100 * $sin(%sphere.a2).deg)
inc %sphere.a2 4
drawline @sphere
.timer 1 0 sphere.frame
}
else {
unset %sphere.a*
hfree x
hfree y
}
}
alias -l sphere.iso return $calc(($1 - $3)*0.866+200) $calc(($1 + $3)*0.5- $2 +200)