Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Jakerpot on Sun 03/05/2009 01:13:12

Title: Problems with dialogs :( needs urgent help!
Post by: Jakerpot on Sun 03/05/2009 01:13:12
Hey young and nice people, i'am having trouble with a dialog. Its something like this:
ATTENTION!  This spoiler below contain a important dialog of my game. Try not reading it all, just the commands parts  ;)

Spoiler

// Dialog script file
@S  // Dialog startup entry point
CHARACTER: "Ahhh, now i can rest a little..."
COMPUTER: "Hey! You locked Dr.Cliche on the Secret Room?"
COMPUTER: "Oh man, that's not good!"
CHARACTER: "Ohhh no! YOU again?"
COMPUTER: "You will not escape from dr.cliche! I will force the shelf to open now!"
CHARACTER: "NO! Please! Don't do it!"

@1
COMPUTER: "You won't die."
COMPUTER: "Not yet."
COMPUTER: "I think."
return

@2
goto-dialog dBasement2

@3
COMPUTER: "I don't hate you. I just love my orders."
return

@4
COMPUTER: "So ask for Dr. Clche to stay here."
return
[close]

Ok, this was the first dialog. Now the second (dBasement2):

Spoiler

// Dialog script file
@S  // Dialog startup entry point
COMPUTER: "What? You, you said, you, you LOVE me?"
CHARACTER: "Yeah i think so."
  PlaySound(18);
  Wait(60);
  PlaySound(18);
  Wait(60);
  PlaySound(18);
COMPUTER: "Ahhhhhnnnn... This dream was soooo nice."
CHARACTER: "What?"
COMPUTER: "Hey! Who are you? What are you doing here?"
CHARACTER: "Don't be stupid."
COMPUTER: "Stupid? I'm not stupid. Ok, let me introduce myself."
COMPUTER: "Hi! My name is Larry!"
CHARACTER: "What the????"
COMPUTER: "What's your name?"
CHARACTER: "Ahn, eh..."
COMPUTER: "Ahh, come on! Don't be shy!"
CHARACTER: "It's Clerk. Why are you so strange?"
COMPUTER: "Strange? I'm not strange. Hey, tell me a thing, what are you doing here?"
CHARACTER: "Running away from Dr.Cliche."
COMPUTER: "What? Why?"
CHARACTER: "He wants to kill me. Well, i think he wants to kill me. Well, he wants to make me a lab rat!"
COMPUTER: "A lab rat? Ahn, i understand..."
COMPUTER: "So i presume you want to quit the mansion ahn?"
CHARACTER: "Yeah, you are right."
COMPUTER: "But i can't let you go..."
return

@1
COMPUTER: "It's the rules. I can't break them. I'm a correct AI machine."
return

@2
COMPUTER: "SERIOUSLY???"
COMPUTER: "..."
COMPUTER: "Ok, i will try to help you, but i can't break the rules!"
CHARACTER: "Ok, ok. what can you do for me now?"
COMPUTER: "Hum... nothing. Just go away. But when you need some help, just ask for me, Larry."
CHARACTER: "Wasn't you the Central Computer?"
COMPUTER: "WHAT? No, no. I'm not this guy."
CHARACTER: "So you are another person?"
COMPUTER: "No, no. Another AI. Artificial Inteligence."
CHARACTER: "Hum, ok then. So you have a double AI?"
COMPUTER: "Yeah, i think. No, wait. I have a triple AI!"
CHARACTER: "What? ANOTHER AI?"
COMPUTER: "YEEEEEESSS! He's name is John. I don't like him. He makes me cry..."
CHARACTER: "Ok, can you just help me finding the way out? Or better, where is the exit?"
COMPUTER: "Well, first you have to deactivate all the security systems stations to turn off the security system."
COMPUTER: "Then the windows and the door will be released!"
CHARACTER: "Nice, now where can i find the stations?"
COMPUTER: "There is one on the Living Room, one in the attic, one in the Dr. Cliche's room and another on the Secret Lab."
CHARACTER: "Ok, there is another way out?"
COMPUTER: "Hum..."
COMPUTER: "..."
COMPUTER: "..."
COMPUTER: "..."
COMPUTER: "..."
COMPUTER: "no."
COMPUTER: "But i'm pretty sure you will be sucessfull!"
CHARACTER: "Thank you Larry."
CHARACTER: "Now let me go."
COMPUTER: "Ok! Bye friend!"
CHARACTER: "A computer with triple personality? I will die and not see everything!"
  ObjectiveNumber = 2;
stop

@3
COMPUTER: "But... But... I, I can't! Sorry!"
return
[close]

THE QUESTION IS: When i select the 2 option, when they finish talking, it returns to the 1 dialog, starting all again instead of stoping. Why this happens? Why stop doesn't works?
Thank you!
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Dualnames on Sun 03/05/2009 01:17:08
Unless I'm mistaken everything should work perfect if you put a stop on the first dialog right after go-to dialog basement



@2
goto-dialog dBasement2
stop


Because you haven't stopped the first dialog, it's still running so when the return function is run on the starting point of the 2nd dialog it returns to dialog one.
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Jakerpot on Sun 03/05/2009 01:34:05
hum, no it display's this error:

Dialog 12(18): The command 'stop' will be ignored since the script for this option has already finished

...

Another idea?
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Dualnames on Sun 03/05/2009 01:41:19
Btw shouldn't Starting point of dialog 1 have a return?
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Jakerpot on Sun 03/05/2009 01:45:12
yeeeeeeeeeeees, but it didn't solve the problem  :-X
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Dualnames on Sun 03/05/2009 01:48:11
Everything seems in order, apart from the fact that I'm not using go-to dialog and instead use dDialog1.Start() on my scripts they should work perfect..
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Jakerpot on Sun 03/05/2009 01:50:24
in the tutorial you can see that this works perfectly too.
http://www.adventuregamestudio.co.uk/acintro8.htm

meybe looking at the manual you can find somethingg i cant? :-\

BTW: thank you for your effort.
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Dualnames on Sun 03/05/2009 01:51:20
Quote from: Jakerpot on Sun 03/05/2009 01:50:24
in the tutorial you can see that this works perfectly too.
http://www.adventuregamestudio.co.uk/acintro8.htm

meybe looking at the manual you can find somethingg i cant? :-\

BTW: thank you for your effort.

I'm not aware of how go-to works never used it, but as from what I've seen your code should be working fine..

EDIT:
goto-dialog X
Switches the current topic to Topic X, and displays the current list of choices for that topic.

It works with integer variables, maybe that's the case? But wouldn't you get an error..?ah, man can't think straight.
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Jakerpot on Sun 03/05/2009 02:00:49
hum... ths sucks, i can't figure why this isnt working...

maybe the variable i putted in the script is blocking the script of end? (nevermind, just posting somethig  :P i now this cant be)

before i transform the script into 2 dialogues, i used one, i got the same problem i thought that where because if the turn off option x and turn on option x commands, but now i don't have any idea. Some dialogue expert (maybe CJ  :P ) can help there?
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Jakerpot on Sun 03/05/2009 02:26:46
Sorry for the double post, but hey, i figured something, can't the problem be on my start dialog command?? ?? ??

Well i've done something like that:


if (ClosedShelf == true){
if (DialogN == 1){
dComputerBasement.Start();
DialogN = 2;
}


in the attempt to making the dialog stop runing after stop the first time, because the ClosedShelf bool is still true, so can't it run more than 1 time? Well, just for prevent, i made this variable (DialogN) to do not start the dialog again. Result? FAIL  :( im getting angry with that  >:( if someone figure out, please post.

OBS: The start dialog comand is on repExec function.
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Dualnames on Sun 03/05/2009 02:30:15
The dialog start is a blocking command.

do
DialogN=2;
Dialog.Start();
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Jakerpot on Sun 03/05/2009 02:38:40
nothng  :'( sorry its the same problem ocurring...
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Dualnames on Sun 03/05/2009 02:43:17
I don;t think random suggestions from my part will get you anywhere, there's probably something else causing the problem that i can't see it but you probably can. I've lost my fitness, we need TrentR to save the day..
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Jakerpot on Sun 03/05/2009 03:01:24
yeah  :) or Ghost, or someone else with less reputation. Ok, i think i should post the entire repExec code there shouldn't i? Well, i will post it!


function room_RepExec()
{
SetBackgroundFrame(0);
if (GetBackgroundFrame() ==1){
   HotspotOn = 1;
}
if (GetBackgroundFrame() == 2){
   HotspotOn = 2;

}
int DialogN = 1;
if (ClosedShelf == true){
if (DialogN == 1){
DialogN = 2;
dComputerBasement.Start();
}}}



here we go. lets seek and destroy the problem.
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Dualnames on Sun 03/05/2009 03:05:20


int DialogN = 1;//place this here.
function room_RepExec()
{
SetBackgroundFrame(0);
if (GetBackgroundFrame() ==1){
   HotspotOn = 1;
}
if (GetBackgroundFrame() == 2){
   HotspotOn = 2;

}

if (ClosedShelf == true){
if (DialogN == 1){
DialogN = 2;
dComputerBasement.Start();
}
}
}

Title: Re: Problems with dialogs :( needs urgent help!
Post by: Jakerpot on Sun 03/05/2009 04:07:33
It's worked!!!  :D thanks man!

But why it doensnt worked when i used it inside the repExec?
thank you again, you are a life saver!
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Trent R on Sun 03/05/2009 04:56:19
Quote from: Dualnames on Sun 03/05/2009 02:43:17
I've lost my fitness, we need TrentR to save the day..
You're my best friend. :D

Unfortunately, I'm not that experienced with dialog scripts... Jakerpot, how come it didn't work in one dscript?

~Trent
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Khris on Sun 03/05/2009 14:49:21
You've been initializing the variable and setting it to one immediately before checking if it's one.
You need to declare it outside the function in order for it to retain its value.
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Jakerpot on Sun 03/05/2009 15:55:24
Quote from: KhrisMUC on Sun 03/05/2009 14:49:21
You've been initializing the variable and setting it to one immediately before checking if it's one.
You need to declare it outside the function in order for it to retain its value.

Ahhhhn, ok  ;D I declared the other variables all outside the functions, and not for this one  :P Thank you.
Title: Re: Problems with dialogs :( needs urgent help!
Post by: Dualnames on Tue 05/05/2009 11:35:42
Quote from: KhrisMUC on Sun 03/05/2009 14:49:21
You've been initializing the variable and setting it to one immediately before checking if it's one.
You need to declare it outside the function in order for it to retain its value.

That's what I thought. I once faced the same problem.

And TrentR, cheers.