mIRC Home    About    Download    Register    News    Help

Print Thread
I
I_like_pie
I_like_pie
I
help file says:

Quote:

You can also optionally specify a return value which will be stored in the $result identifier. The $result can then be used in the calling routine.

/return [value]


I try playing with it, by doing this:

Code:
test_one {
  $test_two($1,$2)
  echo -a $result
}
test_two {
  if ($1 isin $2) {
    return true
  }
  else {
    return false
  }
}
 


and typing /test_one i is

and i get:

TRUE Unknown command
-
* /echo: insufficient parameters (line 3, aliases3.ini)

what am i doing wrong here? i should be getting "true" echo'd into my active window, but i'm not. i'm just using it as the help file said, and it doesn't seem to be working

any idea what's going on?

D
DaveC
DaveC
D
Code:
test_one {
  test_two $1 $2
  echo -a Called as a command $result
  echo -a Called as an identifier $test_two($1,$2)
}
test_two {
  if ($1 isin $2) {
    return true
  }
  else {
    return false
  }
}


If you call it as a command then the return value is stored in $result

If you call the alias as an $identifier it is replaced with the return value
^ this is why you were seeing TRUE unknown command, since $test_two($1,$2) was replaced with "TRUE" and that was attempted as a command in itself.

Joined: Apr 2004
Posts: 755
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 755
correct me if im wrong on this as im just guessing here
$test_two($1,$2) will be identified into the command true
which doesnt excist.. try it with /test_two($1,$2)

D
DaveC
DaveC
D
Quote:
correct me if im wrong on this as im just guessing here
$test_two($1,$2) will be identified into the command true
which doesnt excist.. try it with /test_two($1,$2)


that well fail as well
TEST_TWO($1,$2) Unknown command

you cant bracket the parameters if issuing as a command. It sees "TEST_TWO($1,$2)" as one big command name.

But you are right about it being identified into the command true.

Joined: Apr 2004
Posts: 755
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Apr 2004
Posts: 755
LOL how did i miss that, tnxs for the correction.

I
I_like_pie
I_like_pie
I
ah, that explains it.

thank you very much, i can now get on with the script i needed that for laugh


Link Copied to Clipboard