mIRC Home    About    Download    Register    News    Help

Print Thread
Recursion and errors with /scon #224164 05/08/10 10:17 PM
Joined: Jul 2010
Posts: 8
A
arthoz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Jul 2010
Posts: 8
I'm not sure if im to put this in the bug reports or in feature suggestion, but /scon can bring along recursion, which is not something you want (in mIRC) i suppose

example of recursion, and following error when used:
* Error allocating stack memory
alias away { scon -at1 away $iif($1,$1-,) }

With mIRC i feel that when using scon/scid there probably should be a simple check to see if there is recursion happening though i have no idea if this is an easy fix.


sidenote: If anyone is interested, fixed it doing this: alias away { scon -at1 .raw away $iif($1,$1-,) }


Re: Recursion and errors with /scon [Re: arthoz] #224165 05/08/10 10:28 PM
Joined: Dec 2002
Posts: 344
D
drum Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
A slightly more elegant solution is to use a ! prefix with the command, like so:

Code:
alias away { scon -at1 !away $1- }


If you aren't already familiar with this, /!away will execute the default built-in /away command, thus ignoring any custom /away alias you have created. You can use this prefix to bypass any custom alias.

Unfortunately, it's difficult for mIRC to consider every possible scenario where recursion could occur, and in some cases it may even be desired. There probably is not an easy fix for this.

Re: Recursion and errors with /scon [Re: drum] #224186 06/08/10 07:59 AM
Joined: Jul 2010
Posts: 8
A
arthoz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Jul 2010
Posts: 8
Good morning :>

I wasnt aware that using the ! prefix would also make mIRC use the built-in command as well, thanks =)

Anyhow, just thought i'd make a post since it does give that error, also i really wish the helpfile would be updated to have things like this included in it

Re: Recursion and errors with /scon [Re: arthoz] #224226 06/08/10 07:19 PM
Joined: Aug 2007
Posts: 12
E
eXonyte Offline
Pikka bird
Offline
Pikka bird
E
Joined: Aug 2007
Posts: 12
Quote:
If you want to perform a command without it being processed as an alias, you can prefix it with a ! exclamation mark.


It's in the helpfile under the Aliases topic, in the Command prefixes section. I learned it the hard way too smile

Re: Recursion and errors with /scon [Re: eXonyte] #224244 07/08/10 10:28 AM
Joined: Jul 2010
Posts: 8
A
arthoz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
A
Joined: Jul 2010
Posts: 8
Ah, very easy to miss to be a apart of the "/.alias" part of it. It needs to be separated more, and its not clearly written imo, i didn't read that as "uses the built-in alias instead", probably because using the ! prefix on $identifiers yields a different result :P

Ah well, thanks anyhow =)

Re: Recursion and errors with /scon [Re: arthoz] #224248 07/08/10 12:14 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
It's not part of "/.alias" it's part of "Aliases" - meaning custom aliases.. which is exactly where recursion usually applies!

It can also apply to signals:

Code:
alias test { signal test blah }
on *:signal:test:{ signal test blah }


Although for some reason, mIRC doesn't catch that and just runs that signal indefinitely and you have to ctrl+break to get out of it.

Anyhow, recursion is a very useful tool when used correctly and doesn't need to be "fixed" - the scripter just needs to be aware that it exists and how to get around it (by using !builtincommand)

Re: Recursion and errors with /scon [Re: hixxy] #224251 07/08/10 12:37 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
That code will only cause recursion if you use /signal -n.

Re: Recursion and errors with /scon [Re: Collective] #224260 07/08/10 04:50 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
If a signal is calling itself in its own event, regardless of whether there's a delay or not, it's recursion.

If you meant that you get the error allocating stack memory error by using /signal -n, then yes you're right.

Re: Recursion and errors with /scon [Re: hixxy] #224264 07/08/10 05:17 PM
Joined: Apr 2004
Posts: 865
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 865
Originally Posted By: hixxy
If a signal is calling itself in its own event, [..]

But without -n it's not. It is scheduling a signal for later, and the later invocation will not be from the context of the original event.


Saturn, QuakeNet staff
Re: Recursion and errors with /scon [Re: Sat] #224276 07/08/10 09:08 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Fair enough. I don't know much about the underlying code, thanks!

Re: Recursion and errors with /scon [Re: arthoz] #224578 14/08/10 04:54 AM
Joined: Apr 2003
Posts: 342
M
MeStinkBAD Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Apr 2003
Posts: 342
Originally Posted By: arthoz
I'm not sure if im to put this in the bug reports or in feature suggestion, but /scon can bring along recursion, which is not something you want (in mIRC) i suppose

example of recursion, and following error when used:
* Error allocating stack memory
alias away { scon -at1 away $iif($1,$1-,) }

With mIRC i feel that when using scon/scid there probably should be a simple check to see if there is recursion happening though i have no idea if this is an easy fix.


sidenote: If anyone is interested, fixed it doing this: alias away { scon -at1 .raw away $iif($1,$1-,) }



alias away { if (%t.away) break | set -eu0 %t.away 1 | scon -at1 $iif($show,away,.away) $iif($1,$1-,) }

That'll fix your recursion problem.

Last edited by MeStinkBAD; 14/08/10 04:56 AM.

Beware of MeStinkBAD! He knows more than he actually does!