jrc24, in your other thread (
http://www.lucasforums.com/showthread.php?s=&threadid=130413) you asked about how to fire a script only once -- well that same idea applies here.
The secret to opening/closing forks in the dialog is in a certain field of the StartingList, EntriesList, and RepliesList. In GFF editor this field is called 'Active'. In DLGEdit, I simply called it 'Script'. But unlike normal scripts that begin 'void main()' the scripts that you reference in this field begin 'int StartingConditional()' and return either TRUE or FALSE at the end of the script. Then, the dialog knows whether or not to provide that fork.
So in this way, we can use the SetLocalBoolean/GetLocalBoolean functions again to provide a way for latching/unlatching certain dialog forks.
Here's an example:
EntryList
-> 0
-> -> Text: What do you want to do?
-> -> RepliesList:
-> -> -> 0
-> -> -> -> Active: chk_vent
-> -> -> -> Index: 0
-> -> -> 1
-> -> -> -> Active:
-> -> -> -> Index: 1
ReplyList
-> 0
-> -> Text: Turn off vent
-> -> Script: turn_off_vent
-> 1
-> -> Text: Nothing. I should go now.
chk_vent.nss has this code:
int StartingConditional() {
return (!GetLocalBoolean(GetObjectByTag("vent",1)));
}
and turn_off_vent.nss has this code:
void main() {
// do the main part of the code
// and at the end do this:
SetLocalBoolean(GetObjectByTag("vent"),1,TRUE);
}
When the PC first arrives at the vent, the LocalBoolean in the 1st slot is FALSE. When the dialog begins, chk_vent is run and returns the opposite of FALSE, TRUE. This allows ReplyList 0 to be available to the player. If the player chooses to turn off the vent, turn_off_vent script fires and sets the LocalBoolean, slot 1 of the vent to TRUE. Thus the next time dialog is initiated chk_vent will return FALSE and the PC will not get to do it again.