Is it a bug?

Posted by Unia on Wed 30 Apr 2003 06:38 AM — 6 posts, 19,741 views.

#0
I want to have repeat commands nested, pls. see my sript:
I have 2 aliases, Onrepeat & rerepeat
onrepeat: #(\d+)[ ](.*)---script Onrepeat
rerepeat: #(\d+){(.*)}$---script rerepeat
2 functions:
function OnRepeat (strAliasName, strOutput, wildcardsVB)
{
wildcards = VBArray(wildcardsVB).toArray();

for (i = 1; i <= wildcards [0]; i++)
// world.note(wildcards[1]);
world.execute (wildcards [1]);
} // end of OnRepeat

function rerepeat(rname, rstr, wildcardsVB)
{
_var_ = VBArray(wildcardsVB).toArray();
var tt1,tt2,tt3;
tt1=_var_[0];
tt2=_var_[1];
for(i=0;i<tt1;i++){
world.execute(tt2);
}
}
when I key in #3{#3 xixi}, it only execute 3 times.
Australia Forum Administrator #1
What is supposed to be the difference between OnRepeat and ReRepeat?
#2
OK, for example, I want to send "ok" 9 times, and I want to use #3 #3 ok, but not #9 ok, it didn't works.
Australia Forum Administrator #3
After a considerable amount of mucking around, I think I have found a possible problem.

There seems to be a clash between the instances of the script sessions.

What I suggest you do, is use a loop variable "j" in the second function. That seemed to work for me. What seems to be happening is that OnRepeat sets i to 1, then rerepeat goes from 1 to 3, then OnRepeat finds i is 3 and exits.
Australia Forum Administrator #4
I wouldn't really call this a MUSHclient bug - I think it is pushing it a bit to recursively call the script engine, using the same variable each time, and that is probably what is causing the problem.
#5
Thanks Nick! It works.