Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Bug reports
➜ Is it a bug?
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Unia
(10 posts) Bio
|
Date
| Wed 30 Apr 2003 06:38 AM (UTC) |
Message
| 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Wed 30 Apr 2003 08:14 AM (UTC) |
Message
| What is supposed to be the difference between OnRepeat and ReRepeat? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Unia
(10 posts) Bio
|
Date
| Reply #2 on Wed 30 Apr 2003 08:44 AM (UTC) |
Message
| 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #3 on Wed 30 Apr 2003 10:30 AM (UTC) |
Message
| 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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #4 on Wed 30 Apr 2003 10:40 AM (UTC) |
Message
| 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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Unia
(10 posts) Bio
|
Date
| Reply #5 on Wed 30 Apr 2003 09:34 PM (UTC) |
Message
| Thanks Nick! It works. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
15,625 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top