I hawe a dialog with 2 responses. The character can say for instance no and the game ends. Or the character can say yes and the game continous. How do I make that? I know this has been asked before and I'm sory for posting again but I didn't understand anything in that topic. Could someone please help me.
I hope you know about dialog_request function and how to use it with the dialog script editor.
IF character tells "no", to dialog's script editor, after "no" option, type
run-script X (where X is a number, and should be over 100).
now to the global script:
function dialog_request(int param) {
if(param==100) {
QuitGame(0);
}
}
"QuitGame" is a command that tells game to exit. (0 means it exits without warning and 1 means it asks player if he wants to quit).
That's all.
Did i help a bit?
a little off-topic: why over 100? any integer should work, shouldnt it?
Well, it does work with any integer, and I really don't see why it shouldn't be under 100.
I agree, why shouldn't it be under 100?
Anyway, I may be able to help you, maybe with an easier way. Now from the manual there is a line that explains function dialog_request:
Quote
dialog_request (int parameter)
Called when a dialog script line "run-script" is processed. PARAMETER is the value of the number following the "run-script" on that line of the dialog script.
Now in the dialog script, lets say the first option is "yes" and the second option is "no". Just type in the dialog script:
// dialog script file
@S // dialog startup entry point
narrator: "Do you want to continue the game?"
@1 // option 1
stop
@2 // option 2
run-script 1
Now, in the global script, just type
function dialog_request (1){
if(param==1) {
QuitGame(0);
}
}
Quote from: Edwinxie on Mon 06/09/2004 01:57:54
I agree, why shouldn't it be under 100?
Anyway, I may be able to help you, maybe with an easier way. Now from the manual there is a line that explains function dialog_request:
Quote
dialog_request (int parameter)
Called when a dialog script line "run-script" is processed. PARAMETER is the value of the number following the "run-script" on that line of the dialog script.
Now in the dialog script, lets say the first option is "yes" and the second option is "no". Just type in the dialog script:
// dialog script file
@S // dialog startup entry point
narrator: "Do you want to continue the game?"
@1 // option 1
stop
@2 // option 2
run-script 1
Now, in the global script, just type
function dialog_request (1){
if(param==1) {
QuitGame(0);
}
}
where in the global script do I tipe that in?
Say, at the top of the main global script:// main global script file
function dialog_request (int parameter) {
Ã, Ã, if (parameter == 1)
Ã, Ã, {
Ã, Ã, Ã, Ã, QuitGame(0);
Ã, Ã, }
}
In the dialog script:// dialog script file
@SÃ, // dialog startup entry point
narrator: "Do you want to continue the game?"
return
@1Ã, // option 1
YESstop
@2Ã, // option 2
NOrun-script 1
stop
As for which number to use it doesn't really metter, you can use any within the range:
-2147483648....2147483647.
But...
If you're not sure whether you will be using a
parser input in dialog feature it is recommended to use greater values, since if you'll decide to have parser in dialog then to provide the necessary control AGS will be passing a topic number as parameter to the dialog_request function and there a conflict may happen. Better be safe than sorry :)
QuoteParser input
You'll notice in the dialog editor, a checkbox "Show text parser with this topic". If you check this, a text box is displayed below the predefined options, which allows the player to type in their own input.
If they type in something themselves, then the dialog_request global script function will be run, with its parameter being the dialog topic number that the player was in.
AGS automatically calls ParseText with the text they typed in before it calls dialog_request, so you can use Said() calls to respond. See the text parser section for more info.
Well, even a Wizard may be confused with something else, and give a muddy answer.
Yes, you have right, there is no reason to use a number over 100.
QuoteYes, you have right, there is no reason to use a number over 100.
There is, actually. See my previous post. ;)
[edit: to fix "these is" to "there is"]
thanks for the help. Now it works. :D
I knew that, that's why i had in my mind that i should use greater values on Run-script.
But i haven't used text parser for a long time, so i forgot that.
Thanks for your pointer, Scorpiorous.