Add Dialog Options

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

Previous topic - Next topic

Plog

Its not working arggh this is what I wrote is there anything wrong?

DIALOG 3:

// dialog script file
@S  // dialog startup entry point
return
@1  // option 1
JAKE: What the hell?
CIRCUM: Pretty please.
JAKE: No you must have a valid reason.
JAKE: Like starting a crew
JAKE: or running erands for the mayor.
run-script 1
stop
@2  // option 2
JAKE: Im not allowed to do that Mr. Stances.
stop
@3  // option 3
JAKE: Well maybe you should plan this better.
CIRCUM: Aww crap!
stop

GLOBAL SCRIPT:

function dialog_request (int x1) {
if (1 == 1)
SetGlobalInt (0, 1);
}

TALK TO CHAR SCRIPT:

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

I definalty got the right Dialog and Option. What could be the problem?

Proskrito

#21
QuoteGLOBAL SCRIPT:

function dialog_request (int x1) {
if (1 == 1)
SetGlobalInt (0, 1);

1 is ALWAYS equal to 1  ;)
you probably wanted to write:
if (x1==1)

Oh, sorry, it didnt help at all, i didnt read the whole code.

Plog

It still dosnt work!!
Naything else wrong or commom problems.

Wolfgang Abenteuer

change this:

function dialog_request (int x1) {
if (1 == 1)
SetGlobalInt (0, 1);
}

to this:

function dialog_request (int xvalue) {
if (value == 1)
SetGlobalInt (0, 1);
}

~Wolfgang

Plog

It wont accept the word value without the x

Wolfgang Abenteuer

It may need the "x" then.  I can't remember off the top of my head if it needs to be if (xvalue == 1) {, so try it with the "x" and if that works then it's ok.

~Wolfgang

Plog


Proskrito

#27
try this: (i suppose that the option you want to turn on is #4 and the topic is #1):

// dialog script file
@S // dialog startup entry point
return
@1 // option 1
JAKE: What the hell?
CIRCUM: Pretty please.
JAKE: No you must have a valid reason.
JAKE: Like starting a crew
JAKE: or running erands for the mayor.
run-script 1
stop
@2 // option 2
JAKE: Im not allowed to do that Mr. Stances.
stop
@3 // option 3
JAKE: Well maybe you should plan this better.
CIRCUM: Aww crap!
stop

GLOBAL SCRIPT:

function dialog_request(int parameter){
if (parameter==1) SetDialogOption(1,4,1);
}

And in the "talk to" interaction just the rundialog function.
PS: dont write the  x, you must refer to a varable with the same name you declared it, so if you wrote (int xvalue) you´ll have to write if (xvalue==...)
PS2: Read the manual!! everything is in there clearly explained!!

Plog

Thats brilliant thanks. ;D
But wht did it suddenly change to parameter just now?

Proskrito

#29
its just because i have it that way in my script, but you could replace "parameter" with anything and it would work. (as long as you replace it at the two places with the same word, you know  :))

Plog

I want to use this script again so do I put run-script 2 and what else do I change?

Plog

I tryed changing the 1 thats in it to 2 but it sais I ve allready used dialog-request what do I do. ???

Wolfgang Abenteuer

#32
It only allows you to use on function dialog_request(), which is why you typed in a parameter.  If you used Proskrito's script for your first one, your second one should look something like this:

function dialog_request(int parameter){
if (parameter==1) {
SetDialogOption(1,4,1);
}
if (parameter==2) {
//code here
}
}

And then you would use run-script 2 in the dialogue option for the second code.  If you need a third, then just add another if (parameter==#) statement, and so on.  Each parameter # represents the run-script #.

~Wolfgang

Plog

It comes up with a Parse erorr unexpected "if"

GLOBAL:

}
function dialog_request(int parameter){
if (parameter==1) SetDialogOption(4,2,1);
}
if (parameter==2) SetDialogOption(1,3,1);
}

Whats wrong this time?

Scorpiorus

look at Wolfgang's script attentively:

Quote from: Wolfgang Abenteuer on Sat 05/07/2003 05:51:03
function dialog_request(int parameter){
if (parameter==1) {
SetDialogOption(1,4,1);
}
if (parameter==2) {
//code here
}
}

function dialog_request(int parameter) {
if (parameter==1) {
SetDialogOption(4,2,1);
}
if (parameter==2) {
SetDialogOption(1,3,1);
}

} //end of dialog_request()

-Cheers

Plog

All these errors are annoying me it sais Nested functions not supported.

GLOBAL:
 }
function dialog_request(int parameter) {
if (parameter==1) {
SetDialogOption(4,2,1);
}
if (parameter==2) {
SetDialogOption(1,3,1);
}

} //end of dialog_request()

What now?

Scorpiorus

Check the braces...

Every function has to be enclosed by two braces:

function dialog_request() {

...code here...

}

It's not only for dialog_request but every function too.

Btw, what line does it break at?

Plog

The one where it sais request.

Wolfgang Abenteuer

#38
If it's giving you the "Nested Functions not supported" error, that means that you've inserted your function dialog_request () { inside the middle of another function.  Look to see if there is a } at the very end of your code (the whole global script, since usually the dialog_request functions are placed at the end of the global script).  If there is, delete that } and move it to the line directly above your function dialog_request () { line and see if that fixes it.

~Wolfgang

Plog

This one wont work its with the same as the original dialog.

 // script for character3: Talk to character
if (GetGlobalInt(0) == 1) {
SetDialogOption (4, 2, 1);
}
else {
SetDialogOption (4, 2, 0);
}  
if (GetGlobalInt(0) == 1) {
SetDialogOption (4, 3, 1);
}
else {
SetDialogOption (4, 3, 0);
}
Whats wrong this time?

SMF spam blocked by CleanTalk