The problem is that you need a small delay between selecting the ability and opening the dialogue window, otherwise it instantly CTDs. Here is a snippet of code from one of my pet projects.
Code:
function CommandConsole_1(x, y, z, ship, duration)
setglobal("x", x);
setglobal("y", y);
setglobal("z", z);
setglobal("ship", ship);
Timer_Seq(0.1, SummonConsole);
end;
function SummonConsole()
StartTradeDialog("DialogNC","SummonConsole_Init");
end;