[SELECT ALL] Code:
// bloop -- A backward loop -- by V-Man
alias bloop [loop $arg1 $arg2 [$arg1 = (- (+ (* (getalias $arg1) -1) $arg2) 1); arg3]]
// bloop i 11 [echo $i]
// 10 9 8 7 6 5 4 3 2 1 0
[SELECT ALL] Code:
alias concatlist [
tmp_cnclist = []
loop cncl (listlen $arg1) [tmp_cnclist = (concatword $tmp_cnclist (at $arg1 $cncl))]
result $tmp_cnclist
]
// echo (concatlist [V - M a n])
as seen in this little thang:
[SELECT ALL] Code:
alias convhex [
if (isnumber $arg1) [
if (|| (> $arg1 16777215) (< $arg1 0)) [echo (c 3)Valid range for convhex is 0..16777215] [
tmp_number = $arg1
tmp_number1 = $arg1
bloop hxd 7 [if (< $tmp_number (pow 16 $hxd)) [tmp_hxdgs = $hxd] []]
tmp_hex = [0x pl0 pl1 pl2 pl3 pl4 pl5]
loop hxd (- 6 $tmp_hxdgs) [tmp_hex = (replacestr $tmp_hex (concatword pl $hxd) 0)]
loop hx $tmp_hxdgs [
tmp_hex = (replacestr $tmp_hex (concatword pl (+ $hx (- 6 $tmp_hxdgs))) (if (< (div $tmp_number (pow 16 (+ (* (+ $hx (- 6 $tmp_hxdgs)) -1) 5))) 10) [
result (div $tmp_number (pow 16 (+ (* (+ $hx (- 6 $tmp_hxdgs)) -1) 5)))] [
result (at [A B C D E F] (- (div $tmp_number (pow 16 (+ (* (+ $hx (- 6 $tmp_hxdgs)) -1) 5))) 10))]))
tmphex = $tmp_hex
loop rpl 6 [tmphex = (replacestr $tmphex (concatword pl $rpl) 0)]
tmphex = (concatlist $tmphex)
tmp_number = (- $tmp_number1 $tmphex)]
tmp_hex = (concatlist $tmp_hex)
result $tmp_hex]] [result (+ $arg1)]]
// echo (convhex 1337)