#sectionstart dialog_request // DO NOT EDIT OR REMOVE THIS LINE
function dialog_request(int parameter) {
if (parameter == 1)
{
SetGraphicalVariable("Intro", 1);
}
else
{
if (parameter == 2)
{
SetGraphicalVariable("Booze", 0);
}
else
{
if (parameter == 3)
SetDialogOption(2, 9, eOptionOn);
else
{
//The Big Script
character[EGO].Walk(140, 78);
character[WAIT].Say("Hey, Officer!");
character[OFF1].FaceCharacter(6, eBlock);
character[OFF1].Say(Yes, ma'am?);
character[WAIT].Say(I got some important evidence for ya.);
character[OFF1].Say(Re-really?);
character[OFF1].Walk(239, 84, eNoBlock);
SetDialogOption(2, 9, eOptionOffForever);
Overlay* character[OFF1].SayBackground(So, where's the evidence?);
character[EGO].Walk(69, 173);
Overlay* character[WAIT].SayBackground(Let me whisper it.);
character[BMAN].Say(Thanks, officer.);
Overlay* character[OFF1].SayBackground(It's WHERE?);
character[EGO].Say(Don't mention it.);
RunDialog(7);
}
}
}
#sectionend dialog_request // DO NOT EDIT OR REMOVE THIS LINE
You can (hopefully) ignore the top few and start reading from parameter == 3. I'm being told that the FaceCharacter line attempts to convert an int to a character, and it's causing a type mismatch. I'm using a lot of techniques for the first time, so I've been unable to diagnose it myself.
Need any more info?
Check the manual (http://www.adventuregamestudio.co.uk/manual/Character.FaceCharacter.htm). Character.FaceCharacter uses a Character pointer, you've supplied a number. It should be:
character[OFF1].FaceCharacter(character[6], eBlock);
You can use the script-o names for the characters, e.g. cOff1 instead of character[OFF1] or cEgo, cWait, etc, to make it easier on yourself. (The way you've got it will work, it just doesn't look as neat, and is longer to type.)
Also, might as well address this now:
What are you doing with the SayBackground lines? They're missing speechmarks (") - as are some of the Say commands - but more importantly, why have you included the Overlay* part? It's not needed to display the speech. If you need the overlay for some reason (as in, you're checking that it's valid somewhere) you'll need to name the pointer, e.g.:
Overlay* MyOver = cOff1.SayBackground("It's WHERE?");
However, as with ints (see your other thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=27567.0)) the pointer will need to be declared OUTSIDE the function, to be able to check it elsewhere. E.g. (pointless psuedocode):
//Global script
Overlay* MyOver;
function game_start() {
MyOver = cEgo.SayBackground("Hi!");
}
function repeatedly_execute() {
if (MyOver != null && MyOver.Valid) {
//Do stuff while overlay is valid
}
else {
//Do other stuff when it isn't
}
}
(I was typing while Ashen replied, still, here it is:)
If you read the manual, you'll see that the Character.FaceCharacter function expects a character pointer, not the character's number.
Use the character's script-o-name instead (i.e. cGeorge, cEnemy):
cOff1.FaceCharacter(cWait, eBlock);
If the character-to-face doesn't have a script name or you want to do advanced stuff like iterating through a list of characters, you can use the character's number with the character[] array:
cOff1.FaceCharacter(character[6]);
So, if a character has the number 6 and is called George, the following would all work:
player.FaceCharacter(character[6]); // Wait, what character is that?
player.FaceCharacter(character[GEORGE]); // Ah, George. Still a bit unwieldy.
player.FaceCharacter(cGeorge); // The modern way, very easy to read
Right, I misread the prompting given, I thought it took the integer alone. Many thanks. As for the overlay, it's not needed at all. The reason I didn't put the string in speechmarks was because I was unsure of its relationship to dialogue, where quotation marks aren't needed.
Many thanks for the clarification.