Add Dialog Options

Started by , Wed 02/07/2003 18:08:52

Previous topic - Next topic

Scorpiorus

If it's not too large maybe you could post the whole global script so we could look at?

Wolfgang Abenteuer

It might be easier to combine those two, since you're using the same GlobalInt and value to do two different things, as such:

if (GetGlobalInt(0) == 1) {
SetDialogOption (4, 2, 1);
SetDialogOption (4, 3, 1);
}
else {
SetDialogOption (4, 2, 0);
SetDialogOption (4, 3, 0);
}
RunDialog(4);

Also, be sure to add the RunDialog(); line I put at the end of the interact with character code or it'll just enable/disable the topics but won't actually bring up the topic.

Was your code giving you an error message or was it just not working (i.e. clicking TALK on the character wasn't producing anything)?

~Wolfgang

Plog

I fixed that problem I hadnt actaully created the option for the dialog yet.  :P
Oopsie.

Plog

Guests cant edit so I have to post again i messed this part up tell me what to do with the } & {s.

}
function character2_a() {
 // script for character2: Talk to character
if (GetGlobalInt(0) == 1) {
SetDialogOption (1, 3, 1);
}
 


function character3_a() {
 // script for character3: Talk to character
if (GetGlobalInt(0) == 1) {
SetDialogOption (4, 2, 1);
{
if (GetGlobalInt(0) == 1) {
SetDialogOption (4, 3, 1);



function character0_a() {
 // script for character0: Talk to character
if (GetGlobalInt(0) == 1) {
SetDialogOption (0, 3, 1);


}

Wolfgang Abenteuer

}
function character2_a() {
// script for character2: Talk to character
if (GetGlobalInt(0) == 1) {
SetDialogOption (1, 3, 1);
}
}


function character3_a() {
// script for character3: Talk to character
if (GetGlobalInt(0) == 1) {
SetDialogOption (4, 2, 1);
}
if (GetGlobalInt(0) == 1) {
SetDialogOption (4, 3, 1);
}
}


function character0_a() {
// script for character0: Talk to character
if (GetGlobalInt(0) == 1) {
SetDialogOption (0, 3, 1);
}
}

Each if statement needs to be enclosed in brackets, and so does each function.  Look at this:

function character0_a() { first bracket for function
if (GetGlobalInt(0) == 1) { first bracket for if statement
SetDialogOption (0, 3, 1);
} last bracket for if statement
} last bracket for function

As well, if you ever have one function to perform two different things using the exact same criteria, you can combine them into one if statement.  In your function character3_a() { script, you have two different things being done using the same criteria, that being if (GetGlobalInt(0) == 1).  Therefore, the script will do both of those things if GlobalInt 0 is set to 1.  So, you can combine them into one if statement instead of using two.  It would look like this:

if (GetGlobalInt(0) == 1) {
 SetDialogOption (4, 2, 1);
 SetDialogOption (4, 3, 1);
}

It makes the script more organised and easier to follow.  Both ways will work, though, so I guess just go with whatever you're most comfortable.

~Wolfgang

SMF spam blocked by CleanTalk