|
|
Joined: May 2003
Posts: 730
Hoopy frood
|
OP
Hoopy frood
Joined: May 2003
Posts: 730 |
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
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
/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.
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
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.
|
|
|
|
Joined: Jan 2003
Posts: 2,523
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,523 |
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.
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
|
|
|
|
Joined: May 2003
Posts: 730
Hoopy frood
|
OP
Hoopy frood
Joined: May 2003
Posts: 730 |
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
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.
|
|
|
|
Joined: May 2003
Posts: 161
Vogon poet
|
Vogon poet
Joined: May 2003
Posts: 161 |
You actually can't crash mIRC just by using recursion, it automatically halts when it gets 1000 levels deep.
|
|
|
|
Joined: May 2003
Posts: 730
Hoopy frood
|
OP
Hoopy frood
Joined: May 2003
Posts: 730 |
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
|
|
|
|
Joined: Dec 2002
Posts: 395
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 395 |
alias blah { echo text | scid $cid blah }
|
|
|
|
Joined: Feb 2003
Posts: 2,812
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 2,812 |
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
Well. At least I won lunch. Good philosophy, see good in bad, I like!
|
|
|
|
|
|