Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Czar on Fri 01/02/2008 20:53:33

Title: Very Basic Question...
Post by: Czar on Fri 01/02/2008 20:53:33
Ok, so it took me five years from being introduced to AGS to actually start working on something we could call a game.
So I've been up all night and I seem to have problems with reading the manual.

What I have is the basic problem with script definitions... :

I seem to run into same the same problems, whenever i try to connect something with something I wrote I get parse errors, unexpected or already defined error messages.

The easiest thing for me to understand it would be on an example. (Btw I tried DLing the demo quest, and besides the fact that I'm currently on dial-up, it stops on 8%)

What I'm trying to do is after an option in dialog 1 is to run a script

i put run-script 1
and then try to call it with dialog_request (even tho' i don't know where or how should i write the script correctly).


To put things short.
How do i make after an option in dialog for both players (cEgo and cNeso) to go to room 2?
Where do i put what?
Where do i put variable definitions.

Why

function dialog_request(1) {
cEgo.ChangeRoom(2)
cNeso.ChangeRoom(2)
}

doesn't work?
Title: Re: Very Basic Question...
Post by: NiksterG on Fri 01/02/2008 21:53:13
Sorry that its not working for you, but it's great that you're persevering and at least trying.

The problem with that script is that you can't put the number right on the function declaration line. You need to put in a boolean statement to check if the dialog script is actually the one you want.


function dialog_request(int value) {
  if (value == 1) {
    cEgo.ChangeRoom(2);
    cNeso.ChangeRoom(2);
    // etc
  }
}


If you wanted to add more of the run-script x commands to the dialog, just add more if statements to the dialog_request function.


function dialog_request(int value) {
  if (value == 1) {
    cEgo.ChangeRoom(2);
    cNeso.ChangeRoom(2);
    // etc
  }
  else if (value == 2) {
    cEgo.Walk(123, 321, eBlocking, eAnywhere);
    cNesa.FaceCharacter(cEgo);
  }
  else if (value == 3) {
    // etc.
  }
}
Title: Re: Very Basic Question...
Post by: Czar on Fri 01/02/2008 23:56:15
I think I'm about to have an a-ha moment.

What I understood is that you CAN NOT just write (int value)
It seemed like it was only for display and you had to put the value yourself. ::)

Now I'll just have to try to implement it, but I think you helped me a million.
Thanks. :)