Here's a fun script structure I use quite often.
The Cutscene Script!
The basic premise behind it is that for dialogs and cutscenes, there are multiple nodes where things are going on. Instead of creating a script for each one of these nodes, you can use the slots in the dialog to specify a script, and then input a script parameter to choose which section to use.
Code:
void main(){
//Declare all of your variables here. You can give them values in each separate case in the switch below
//Each dialog node allows you to put in 5 pieces of information to deliver to the script.
//5 integers, with which you can do whatever
int Param1 = GetScriptParameter(1);
int Param2 = GetScriptParameter(2);
int Param3 = GetScriptParameter(3);
int Param4 = GetScriptParameter(4);
//and one String parameter, useful for putting in item templates or waypoints or whatever else
string sParam = GetScriptStringParameter();
//For the generic Cutscene script structure though, I just use Param1 to build each case
switch(Param1){
case 0:
//Code goes here
break;
case 1:
//Code goes here
break;
case 2:
//Code goes here
break;
case 3:
//Code goes here
break;
} //Keep adding cases and breaks ad nauseum
}
That's the general structure of the Cutscene Script. Then in the dialogeditor where you want it to run, you type the script name and the case you want to run.
Example:
[a_905sleep] [1] [ ] [ ] [ ] [________]
This would run case 1 from the script above.
Hope that was helpful.