Hello,
I hopoe everyone is doing well.
I am have problem trying to use a dialog counter
I'd like to have aother sentence said when i asked 2 times the same question to a PNJ.
Unfortunately it gives me an error and i don't manage to fix it so i need a little help here please.
I use a global variable
dialogCounter int 0
At the beginning of the dialog i have set the dialog couter to 0
// Dialog script file
@S // Dialog startup entry point
dialogCounter = 0;
return
then in the dialog i have this code
@5
if (dialogCounter <=2) {
cChar1.Say("I said no");
dialogCounter++;
}
else {
cChar1.Say("well ok if you insist");
}
return
That returns me the following error:
Dialog 2(79): Error (line 79): PE04: parse error at 'else'
Line 79 is:
else {
What i've i done wrong here ?
Thanks a lot in advance for your precious help.
You forgot to close the if block before the else, add a } there
Once again thank you so much and i am so sorry for such a stupid mistake how can i not see that after looking at my code for so long...
Thanks again eri0o
I am sorry it's me again
How do i use these values:
option-off
and
goto-dialog
inside the else bracket ?
I found:
RUN_DIALOG_GOTO_PREVIOUS;
RUN_DIALOG_RETURN
RUN_DIALOG_STOP_DIALOG
but nothing that can do option-off and goto-dialog
Is it possible ?
Thanks again :)
Quote from: actaria on Wed 19/10/2022 11:37:37How do i use these values:
option-off
and
goto-dialog
inside the else bracket ?
All the special dialog commands can be used in the middle of the regular script if you put them without indentation (no space before them).
Example:
@1
if (something) {
option-off 5
}
Overall, you may mix both kinds of script commands, so long as you keep the indentation rule (special dialog commands have no indent, regular script commands have at least 1 space indent).
Quote from: actaria on Wed 19/10/2022 11:05:09how can i not see that after looking at my code for so long...
In part because you are not indenting your code properly (though unfortunately the dialog script hack for mixing dialog commands and regular script commands means that it is not always possible to do so).
Hello and thank you Crimson Wizard,
// @1
else {
option-off 5
}
The indentation rule (special dialog commands with no indent) is working with:
option-off
But I also need to use
goto-dialog and to increment a variable "dialog_char1"
So i tried:
// @1
else {
option-off 5
goto-dialog 3
dialog_char1 += 1;
}
Unfortunately it return errors
Any idea ? thank you
Quote from: Snarky on Wed 19/10/2022 12:24:01In part because you are not indenting your code properly (though unfortunately the dialog script hack for mixing dialog commands and regular script commands means that it is not always possible to do so).
100% true :)
Quote from: actaria on Wed 19/10/2022 13:04:56But I also need to use
goto-dialog and to increment a variable "dialog_char1"
So i tried:
// @1
else {
option-off 5
goto-dialog 3
dialog_char1 += 1;
}
Unfortunately it return errors
"dialog_char1 += 1;" is a regular script command and needs to be indented.
I also suspect that "goto-dialog 3" will stop current function, so you need to increment before doing goto-dialog.
else {
option-off 5
dialog_char1 += 1;
goto-dialog 3
}
O yes i understand better now since dialog_char1 +=1 is a regular command it needs to be indented
option off and dialog_char1 +=1 are working but when i put the goto-dialog 3 i have the following errors:
Dialog 2(84): Script commands can only be used in the area between a
@ entry point and the closing return/stop statement
Dialog 2(85): The command 'return' will be ignored since the script for this option has already finished
Dialog 2(87): Error (line 87): PE04: parse error at 'else'
thanks again for you precious help
Quote from: actaria on Wed 19/10/2022 13:43:09when i put the goto-dialog 3 i have the following errors:
Dialog 2(84): Script commands can only be used in the area between a entry point and the closing return/stop statement
Dialog 2(85): The command 'return' will be ignored since the script for this option has already finished
Dialog 2(87): Error (line 87): PE04: parse error at 'else'
Please post the larger part of the dialog script, because it's impossible to understand what's going on judging only by the small excerpt.
looks like i can't post here anymore no idea why:
An error has occurred
CleanTalk:
Access has been denied. Please contact the site administrator at cleantalkadventuregamestudio.co.uk with your account's email address to have it whitelisted. If registration is blocked, try temporarily disabling your VPN first to register.
I will try agaon later maybe it will works
EDIT here comes the full dialog code:
dialog_char1 += 1; is dialogue_nairo
Purificateur_Nairo: is the PNJ
// Dialog script file
@S // Dialog startup entry point
dialogCounter = 0;
return
@1
Purificateur_Nairo: test
dialogue_nairo += 1;
option-off 1
if(dialogue_nairo == 5)
{
cpurificateur_nairo.Say("Il faut que je retourne");
cpurificateur_nairo.Say("Prier pour Shaena");
cpurificateur_nairo.LockView(58);
cpurificateur_nairo.Animate(1, 3, 0, eBlock, eForwards);
}
return
@2
Purificateur_Nairo: Je suis le purificateur de ce temple
Purificateur_Nairo: Je soigne les malades
Purificateur_Nairo: Et les personnes blessées
Purificateur_Nairo: Grâce à la puissance de nos statues
dialogue_nairo += 1;
option-off 2
if(dialogue_nairo == 5)
{
cpurificateur_nairo.Say("Il faut que je retourne");
cpurificateur_nairo.Say("Prier pour Shaena");
cpurificateur_nairo.LockView(58);
cpurificateur_nairo.Animate(1, 3, 0, eBlock, eForwards);
}
return
@3
Purificateur_Nairo: Il s'agit des divinitées de EREONEO
Purificateur_Nairo: Elles nous protègent de la magie noire
Purificateur_Nairo: Malheureusement elles ne sont pas
Purificateur_Nairo: Efficaces contre ces envahisseurs
Purificateur_Nairo: J'ai essayé de les invoquer
Purificateur_Nairo: Mais ça n'a pas fonctionné
dialogue_nairo += 1;
option-off 3
if(dialogue_nairo == 5)
{
cpurificateur_nairo.Say("Il faut que je retourne");
cpurificateur_nairo.Say("Prier pour Shaena");
cpurificateur_nairo.LockView(58);
cpurificateur_nairo.Animate(1, 3, 0, eBlock, eForwards);
}
return
@4
Purificateur_Nairo: Je suis en train de prier
Purificateur_Nairo: Pour que rien ne lui arrive
Purificateur_Nairo: Et qu'elle nous revienne au plus vite
dialogue_nairo += 1;
option-off 4
if(dialogue_nairo == 5)
{
cpurificateur_nairo.Say("Il faut que je retourne");
cpurificateur_nairo.Say("Prier pour Shaena");
cpurificateur_nairo.LockView(58);
cpurificateur_nairo.Animate(1, 3, 0, eBlock, eForwards);
}
return
@5
if (dialogCounter <=1) {
cpurificateur_nairo.Say("C'est impossible");
dialogCounter++;
}
else {
option-off 5
dialogue_nairo += 1;
goto-dialog 3
}
return
@6
stop
Thanks again i am still trying to go from 5 to another dialog
Hmm, so apparently AGS has a bug. It does not allow to use "goto-dialog" in the if/else block, or rather it does not allow to have any regular script commands after "goto-dialog".
This may be solved by using "return N" instead, where N is a dialog ID.
else {
option-off 5
dialogue_nairo += 1;
return 3; // goto-dialog 3
}
Hello,
Yes maybe its a bug because everything works fine except when i put the goto-dialog in the else block.
I will try your solution and let you know what happens :)
Thanks again for your kindness.
Update:
Genius move it was the solution
return + ID number of the dialog it works very well :)
Thanks you so much you saved me once again i really wanted to try most of the dialog possibilities