Quoting the helpfile:
Quote:
/alias [filename] <aliasname> <command>
Adds, removes, replaces aliases; it is limited to single line aliases and will not affect multiple line definitions.

Thus this will work:
Code:
alias Ftest {
  set -u %fkey F7
  alias %fkey if ($istok(channel query chat,$window($active).type,32)) <single line of commands to execute if the condition is true>
}


As you can create only single-lined aliases with the /alias command, you have to use pipes instead of newlines for more complex functions. And as the pipe-char is evaluated once (as part of the code of the "alias-setting" alias), you have to prevent the evaluation of the pipe, with either:
Code:
alias setaliastest1 {
  alias Testalias1 <command1> $chr(124) <command2> $chr(124) <command3>
}

Or:
Code:
alias setaliastest2 {
  alias Testalias2 <command1> $(|,0) <command2> $(|,0) <command3>
}

If curly brackets are unavoidably required, you have to escape them as well. Example:
Code:
alias setaliastest3 {
  alias Testalias3 if (%x < 3) $({,0) <some code> $(},0) $(|,0) else $({,0) <some other code> $(},0) 
}

But, if you only try to assign a "fixed" function to a variable F-Key, why not put the function in a fixed alias and have the fkey call this alias? It'll be more clear, therefore more easy to write and debug. The last example above is an alias with only two condition-command pairs, and it's already a mess laugh. Example:
Code:
alias AssignFkey {
  set -u %fkey F7
  alias %fkey myfixedfunction
}

alias myfixedfunction {
  ---- code as usual ---
}