Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: GuyLaDouche on Sat 07/08/2004 06:30:40

Title: How to make Random Dialogs? (need help)
Post by: GuyLaDouche on Sat 07/08/2004 06:30:40
I'm trying to program random responces to when the player says a certain dialog option. So far I've tried adding an "if" "else" situation to the script but it won't accept it in the Dialog Topic script. If there is a tutorial on the subject, I haven't found it.
Title: Re: How to make Random Dialogs? (need help)
Post by: strazer on Sat 07/08/2004 09:43:39
I would probably do it like this:

Dialog script

@1
ego: Tell me something!
man: Ok. Here goes:
run-script 77
return

Global script

function dialog_request(int parameter) {
if (parameter == 77) { // run-script 77 used
  int ran=Random(3);
  if (ran == 0) DisplaySpeech(MAN, "This is random message 1");
  else if (ran == 1) DisplaySpeech(MAN, "This is random message 2");
  else if (ran == 2) DisplaySpeech(MAN, "This is random message 3");
}
//else if (parameter == 44) { // run-script 44 used
// //other stuff
//}
}
Title: Re: How to make Random Dialogs? (need help)
Post by: GuyLaDouche on Sun 08/08/2004 06:25:01
Now I'm getting an error saying,

"Error (line 9): incorrectly terminated character constant"

Here is line 9 in the script:

DisplaySpeech (TONY, Don't say it...);

I don't see the problem.
Title: Re: How to make Random Dialogs? (need help)
Post by: Barbarian on Sun 08/08/2004 06:35:06
Hmm, perhaps it needs the "quotes" in that to work, so should look like:

DisplaySpeech (TONY, "Don't say it...");

Title: Re: How to make Random Dialogs? (need help)
Post by: Jet Kobayashi Zala on Sun 08/08/2004 06:35:36
Darn you, Barbarian! I go to log in and you beat me to it! :P
Title: Re: How to make Random Dialogs? (need help)
Post by: GuyLaDouche on Sun 08/08/2004 18:48:13
Thanks. That really helped. But now I have another question...
Is there a script command that changes the talking view of a character?
Title: Re: How to make Random Dialogs? (need help)
Post by: Barbarian on Mon 09/08/2004 14:53:21
Yep, here's an example from the Help manual:

SetCharacterSpeechView(EGO, 10);

will change the character EGO's speech view to view 10.
Title: Re: How to make Random Dialogs? (need help)
Post by: GuyLaDouche on Tue 10/08/2004 08:47:25
Well, that worked. Thanks a lot guys, but now I have another problem.
I can't get my inventory screen to scoll down, I have the buttons but I don't know the specific code, I can't find a good example of what script command to implement.
Title: Re: How to make Random Dialogs? (need help)
Post by: Mr Jake on Tue 10/08/2004 09:16:42
take the one from the default Inventory GUI and just assign them to the buttons in your GUI.
Title: Re: How to make Random Dialogs? (need help)
Post by: GuyLaDouche on Wed 11/08/2004 02:36:46
Thanks. It works now. Has anyone made a high score board using AGS?
Title: Re: How to make Random Dialogs? (need help)
Post by: Radiant on Wed 11/08/2004 11:20:22
No but it wouldn't be very difficult, just create a struct with an int (for the score) and a string (for the name). Add a sorting function. Suppose you want five high scores, then create an array with six; overwrite the sixth with whatever the player's last score was, and sort. Load from disk (RawReadFile iirc) at game start, and write whenever it changes. Voila.
Title: Re: How to make Random Dialogs? (need help)
Post by: deadsuperhero on Wed 11/08/2004 16:03:43
Quote from: Jojoboy on Sun 08/08/2004 18:48:13
Thanks. That really helped. But now I have another question...
Is there a script command that changes the talking view of a character?
You could also have a character with a different talking view, and just use his name for expressions (Exmple: give a guy the script name ANGRY and give him a talking view similar to the main character's. Use his script name in parts of the dialog when he's angry.)