Jump to content

Help with Dialog


La paix
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...