Not sure what to add

Started by Candle, Mon 21/11/2005 02:28:21

Previous topic - Next topic

Candle

What would you add here or how would you name it?
function dialog_request (int xvalue) {
Ã,  Ã,  // your code here
Ã,  }

Gilbert

Whatever you like, as long as the function takes exactly one integer parameter by design.

eg.
function dialog_request(int a){
}

function dialog_request(int value){
}

function dialog_request(int blah){
}

are all acceptable.
Just bear in mind that you use a name that'll make the codes easier to read, since in the content of the function you need to refer to it, like:

if (a==1) {//do something
} else if (a==2) {//do some otehr thing
} //etcetc...

Candle

#2
Ok I think I have it but the video runs when I gfo to the room and not waiting for the dialog to be click on what one .
// main global script file
function dialog_request (int member) {
Ã,  Ã,  PlayVideo ("member.avi", 0, 0);
Ã,  }

Have that in the global scrpt and this in the dialog
// dialog script file
@S  // dialog startup entry point
return
@1  // option 1
run-script 1
return
@2  // option 2
run-script 2
return
@3  // option 3
run-script 3
return
@4  // option 4
stop
EDIT :::
Ok I can play the video by not sure how to name it so on the first dialog plays the one video right now they all play the video.

If I add anything but a 1 it gives some error ?
What do I have wrong can you see?
Ony one video yet to play just have the options there.

Candle

I found this in the demo game but can't find the 200 that it is calling?
@5  // option 5 - Suppose I don't have an Id card.
piratebob:   Suppose ya stop wastin ol Pirate Bob's time. Eh!
piratebob:   Rather be drinkin me ale than blaberin wtih the likes of ye.
piratebob:   The tiger's not hungry an ol Bob's thirsty, so off with ya.
option-off   5
run-script  200
return

Gilbert

The value in run-script is the value that dialog_request will receive, like I wrote before, you need something like:

function dialog_request(int a){
  if (a==1) {
    PlayVideo(blah bla bla);
  } else if (a==2) {
    //do something else
  }
}

if you want to use the name "member" for the parameter for some reasons, the codes would be:

function dialog_request(int member){
  if (member==1) {
    PlayVideo(blah bla bla);
  } else if (member==2) {
    //do something else
  }
}

Understand?

Candle

Yes I got that part , but I don't know what to name it in the dialog part? If I try to put run-script member it give the error .

---------------------------
Compile Error
---------------------------
There was an error compiling the script for dialog topic 0.
The error was:
Dialog (line 5): Invalid script parameter in 'run-script'

Do you want to edit your script to correct the error?
---------------------------
Yes   No   
---------------------------

Gilbert

#6
Just like what you had done, use:

run-script 1
run-script 2
run-script 3
... etc.

Use number, not some other word.
For example if you put "run-script 1" in your dialog script, it's equivalent to running "dialog_request(1)" in the text script.
So if your dialog_request function is like this:
function dialog_request(int a){
Ã,  if (a==1) {
Ã,  Ã,  blah bla
Ã,  } else if (a==2) {
Ã,  Ã,  ha ha
Ã,  }
}

then "run-script 1" will execute the part "blah bla" while "run-script 2" will execute "ha ha". I think this is well documented in the manual and/or the BFAQ.

Candle

Thats the part I didn't understand. I'm sorry about this . thank you for helping me with this.

SMF spam blocked by CleanTalk