Ok. Maybe i should have done more testing before postin while_,
the while command does not have sleep in it!
while_ has sleep 0, i think this was the only to do it,
i wrote this in so many ways that in the end i forgot to change a line,
this is the fixed one (no brackets for $arg2):
so in "test", while_ will be executed atleast 0 millis after,
"test" will return immideatly!
this would only work in this way:
while_ is anything but perfect, sleep delays everything, it is a FAIL.
Anyways, i have some use for it, just thought it could be usefull to somebody and decided to share.
the while command does not have sleep in it!
while_ has sleep 0, i think this was the only to do it,
i wrote this in so many ways that in the end i forgot to change a line,
this is the fixed one (no brackets for $arg2):
[SELECT ALL] Code:
//while_ by =SA=macm
//exmp: /while_ [= $x 1] [consoleline = $conline]
addcheck_msa while__
if (checkalias whl) [] [whl = []]
alias while_ [
if (= $numargs 2) [
(concatword "whl" (listlen $whl)) = (concat "(" $arg1 ")"); add2list whl (concatword "whl" (listlen $whl))
(concatword "whl" (listlen $whl)) = (concat $arg2); add2list whl (concatword "whl" (listlen $whl))
] []
]
alias while__ [
whlp = 0;
loop whloop (listlen $whl) [
tmp_whl = (concat "if" (getalias (at $whl $whlp)) "[ (at $whl (+ $whlp 1))] []");
tmp_whl;
whlp = (+ $whlp 2)
];
sleep 0 [while__]
]
// just in case...
alias reset_while_ [loop a (listlen $whl) [delalias (concatword "whl" $a)]; whl = []]
so in "test", while_ will be executed atleast 0 millis after,
"test" will return immideatly!
this would only work in this way:
[SELECT ALL] Code:
alias test [
whileresult = 0
tmp_while = 10
while_ [$tmp_while] [
+= whileresult 1
-= tmp_while 1]
sleep 200 [echo $whileresult]]
while_ is anything but perfect, sleep delays everything, it is a FAIL.
Anyways, i have some use for it, just thought it could be usefull to somebody and decided to share.