Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Tue 13/01/2004 23:53:06

Title: Scripts and dialogs
Post by: on Tue 13/01/2004 23:53:06
First of all: Ive read the manual.

So, my question is: In the dialogs things therea r topics and in the topics you edit the script. This script is a different one and easier one (thank god!) but there are functions that need to be done with a more complex script.

So ive added a run-script thing. Ive named it as run-script 1. So it is right til now?

Then ive called the global script thing. There ive added this (i want to change the characther view. the charachter script name is Q and the view is 7):

 function dialog_request (int 1) {
   // my code
   ChangeCharacterView (Q, 7)
 }

Then i save and close it. When i save the game, it says:

"Error in line #106. Nested functions not supported"  

Can anyone help me??
Title: Re:Scripts and dialogs
Post by: Wolfgang Abenteuer on Wed 14/01/2004 01:08:13
It should actually look like this:

function dialog_request (int dialog) {
 if (dialog == 1) {
   ChangeCharacterView(Q,7);
 }
}

The "run-script 1" from the dialogue script passes the number "1" into the dialog_request function.  Therefore, you need to tell AGS what to do when the value of that is 1 (hence the if (dialog == 1) { line).

~Wolfgang
Title: Re:Scripts and dialogs
Post by: on Wed 14/01/2004 18:29:05
Ok ill try it thanks.

2nd thing i want to know:

How do i know how much "{" and "}" ive got to put??
Title: Re:Scripts and dialogs
Post by: Scorpiorus on Wed 14/01/2004 18:43:55
Basically, each opening { brace has to be closed by }:
function dialog_request(int dialog) {

if (dialog == 1) {
ChangeCharacterView(Q,7);
}
}

~Cheers
Title: Re:Scripts and dialogs
Post by: TerranRich on Wed 14/01/2004 19:08:14
I thought I added this to the Beginners' FAQ. Didn't I?