I think your gender selection window should indeed store the choice in some global variable, so that you can use it throughout the game.
So, the selection window would contain two buttons, named "male" and "female" and the window script would contain something like:
...
on "male"
{
global g_GenderMale = true;
}
on "female"
{
global g_GenderMale = false;
}
Now, your other window(s) would contain something like this in the beginning of their scripts:
global g_GenderMale;
var Portrait =
this.
GetControl("portrait");
// "portrait" being the name of a static control
if(g_GenderMale ==
true) Portrait.
SetImage("path\male.png");
else Portrait.
SetImage("path\female.png");
Similarly you'll be able to use the global variable in dialogues:
global g_GenderMale;
if(g_GenderMale ==
true) SomeNPC.
Talk("Helo there, sir.");
else SomeNPC.
Talk("Helo there, lady.");