mIRC Home    About    Download    Register    News    Help

Print Thread
Alias 'return' #199339 12/05/08 07:54 PM
Joined: May 2008
Posts: 329
A
AWEstun Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: May 2008
Posts: 329
Does an alias need a return if the it's the 'end of the line'?


I registered; you should too.
Re: Alias 'return' [Re: AWEstun] #199346 12/05/08 08:36 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
What do you mean by the end of line?

If the script is at the end of it's function then no it doesn't need to return

alias test {
var %x = 1
if (%x == 1) { echo -a Point 1 | goto B }
A:
echo -a A point
B:
echo -a B Point | goto A
}

this checks to see if %x == 1 then moves to point B then moves to point A and since its the end... I don't need to return, if that's not what you mean't please describe.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: Alias 'return' [Re: AWEstun] #199357 12/05/08 10:44 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You use RETURN if you need it to return a value (for use if it's treated as a custom identifier). If it's treated as an alias, you don't need to return anything. The only reason you'd use return at that point is just to halt the alias for some reason (such as during error checking).

Example:
Code:
//echo -a Identifiers return values: $test

alias test {
  return This is my return value.
}


Code:
/test

alias test {
  echo -a Aliases just perform commands, such as this echo.  Nothing is returned.
}


Code:
/test

alias test {
  if ($1 = Error) { echo -a There was an error and the alias is halting. | return }
  else { echo -a There were no errors, so the alias has completed. }
}


Invision Support
#Invision on irc.irchighway.net