I want my characters to run through a dialogue and then, once the dialog finishes, if the main character tries to talk to the other character again, I want to display the message 'I have nothing more to say to him' (or something similar) instead of having the dialog run again. I can't seem to figure out how to do this. Help?
Use variables (http://americangirlscouts.org/agswiki/Scripting%2C_Code_%26_Interaction#Working_with_variables:_the_basics).
(Adding a short paragraph about variables to the read me first-thread might be a good idea, btw.)
You could as well do this
messy code but whatevery
at the talk to character interaction put the following code
if (GetGlobalInt(1) != 1) {
dialog[0].Start()
SetGlobalInt(1,1);
return;
}
if (GetGlobalInt(1) == 1) {
Display("I have nothing more to say to him");
}
Make the second
if an
else if (or even just
else), and you can get rid if the
return;. Other than that, it's not messy code at all, and is pretty much the exact thing KhrisMUC suggested. I might use a named variable instead of the GlobalInt, however. If it's only going to be used for this interaction, it doesn't need to be global (Character interactions are handled in the Global script, so just declare your variable there).
The 'read me first' thread doesn't mention variables, but it doesn't link to the BFAQ which says on the front page:
Quote
NOTE: Please keep the following in mind. Most of our problems can be easily solved using variables. Need to change a hotspot's state in another room? Use variables! Need an object to be used only once? Use variables! You can either use Global Integers and Global Strings (look inside the AGS manual for these) or custom variables. Look at the solution to that problem HERE (http://americangirlscouts.org/agswiki/Scripting%2C_Code_%26_Interaction#GlobalInts.2C_your_friend:_what_they_are_and_how_to_use_them) under "Scripting, Code & Interaction".
Maybe it could be made clearer in the variables entry HOW exactly you'd do that, as it's mostly about creating them with just a few lines on use, but I don't think it belongs in the rules thread.