Kyshakk Koan La paix Posted October 25, 2008 Share Posted October 25, 2008 So, I'm working on my first scenario I plan on releasing, and I've run into a slight problem. I know there's an obvious answer, I just don't know how to do it. Here's what I need to do: I've made a dialog box with two options. However, I don't know how to activate code when a certain option is chosen. I know that run_dialog() records it, I just don't know how to retrieve it. I already looked in the appedices, but I failed to find the answer. Maybe I just missed it? I'm clearly no script genius, and any help is appreciated. Quote Link to comment Share on other sites More sharing options...
Unflappable Drayk Lazarus. Posted October 25, 2008 Share Posted October 25, 2008 Use "choice = run_dialog(1);" to record the player's selection to the "choice" variable. Then you can use if statements to do whatever it is you want. For example: Code: choice = run_dialog(1);if(choice == 1){ //do stuff}if(choice == 2){ //do other stuff} I believe the BoA Cookbook goes over this in greater detail. Find it at Kel's page. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Nioca Posted October 26, 2008 Share Posted October 26, 2008 There's two ways to do this. The first is to have a variable record it, like so: Code: [variable] = run_dialog(x) Where [variable] is the variable you want to record it to (don't mind the x in run_dialog(); it's just there as a placeholder for whatever value you want in there). Basically, it's telling the code that [variable] is equal to whatever value run_dialog() returns. This should definitely be the way you learn to do it, since it works for dialog boxes that have either two or three options. The second way to do this is to use the if statement directly on the run_dialog command. Code: if (run_dialog(x) == y) { [do statement or set of statements] }else { [do another statement or set of statements } Note that this only works with dialog boxes that have two options. Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted October 26, 2008 Share Posted October 26, 2008 Originally Posted By: Nioca Note that this only works with dialog boxes that have two options. Or if for some reason two of the choices have the same effect... though I don't know why you'd want to do that... Quote Link to comment Share on other sites More sharing options...
Kyshakk Koan La paix Posted October 26, 2008 Author Share Posted October 26, 2008 Thanks guys! Back to work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.