How to make Random Dialogs? (need help)

Started by GuyLaDouche, Sat 07/08/2004 06:30:40

Previous topic - Next topic

GuyLaDouche

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.

strazer

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
 //}
}

GuyLaDouche

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.

Barbarian

Hmm, perhaps it needs the "quotes" in that to work, so should look like:

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

Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

Jet Kobayashi Zala

Darn you, Barbarian! I go to log in and you beat me to it! :P

GuyLaDouche

Thanks. That really helped. But now I have another question...
Is there a script command that changes the talking view of a character?

Barbarian

Yep, here's an example from the Help manual:

SetCharacterSpeechView(EGO, 10);

will change the character EGO's speech view to view 10.
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

GuyLaDouche

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.

Mr Jake

take the one from the default Inventory GUI and just assign them to the buttons in your GUI.

GuyLaDouche

Thanks. It works now. Has anyone made a high score board using AGS?

Radiant

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.

deadsuperhero

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.)
The fediverse needs great indie game developers! Find me there!

SMF spam blocked by CleanTalk