it would be nice if u add a recursion featore to the mirc so a function could run itself
i know that u can run two aliases and they will run each other but i think the first way is better
/help Aliases
Aliases can be called from the command line, from other aliases, and from popup and remote scripts. An alias cannot call itself recursively mainly because this seems to cause more problems for users than it solves.
Reading that, I wouldn't bet on seeing this feature in mirc, Khaled has decided against it (and I agree with him). Quite a few alternatives have been proposed, like a new alias switch:
alias -r somealias {
.....
}
I like the -r solution: it wouldn't break any scripts and the novice scripter wouldn't accidentally crash mirc, since he would probably not include the -r switch in the alias. The only problem I see with this is that there would be no way to make an alias written in Aliases section recursive (in the sense of calling itself), because there is no alias prefix there.
Would you ever want an alias in the alias section to be recursive? Me personally I have my /j /p, /ping aliases in the alias sections, but any complex algorithms that would require recursion I put in the remote section. I don't like having ~100 line aliases in the alias section, it seems much cleaner to have them in a seperate file.
I agree. I couldn't care less if I can't use it in Aliases (actually I wouldn't care if the entire Aliases section was gone), but technically, it's an issue: whether I care or not is a different question.
Well the syntax of the alias section could be expanded to a degree. If you use { } in the alias section it could be handled easily
aliasname [-r] { the stuff }
ie:
recurse -r { if (%a) recurse $calc(%a -1) }
That would easily handle one case in the alias section with no problems that I can forsee, and really I don't see it being a problem expanding that for all aliases:
aliasname [-r] the stuff
ie:
recurse -r if (%a) recurse $calc(%a -1)
That statement would be illegal if -r were not recognized as a flag, because it would need to be -r | if (%a) recurse $calc(%a -1), so what could be done is, if the first "word" is -r, and the next "word" is not | then interpret it as a flag, if the next "word" is | then interpret it as an alias named -r, and if the first "word" is -r, and there are no other "words", then interpret -r as an alias named -r. May not be the cleanest way, but it should work.
You actually can't crash mIRC just by using recursion, it automatically halts when it gets 1000 levels deep.
yeah i know, some1 told me that in the old version there was a command to set the limit of the recursions from 1-1000
alias blah { echo text | scid $cid blah }
Presently, I'm using mIRC 6.0 on this machine and it stops at 100 levels (callstack). That is, one alias calling another, each of a different name. When trying just back/forth using aliases named ONE and TWO, It only got to 99 levels.
//var %i = 0 | WHILE ( %i < 1005 ) { inc %i | alias ADEPTH $+ %i editbox -a %i $chr(124) ADEPTH $+ $calc(%i + 1) }
/ADEPTH1
This will generate 1005 aliases, each calling one-another in series. As they call one another, it will display the current level in the editbox. Please post your results here, accompanying your $version number.
Cleanup.
//var %i = 0 | WHILE ( %i < 1005 ) { inc %i | alias ADEPTH $+ %i }
- Raccoon