Very Basic Question...

Started by Czar, Fri 01/02/2008 20:53:33

Previous topic - Next topic

Czar

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?
Roses are #FF0000
Violets are #0000FF
All my base
are belong to you

NiksterG

#1
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.

Code: ags

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.

Code: ags

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.
  }
}
Check out my games! (Not all made with AGS)

Czar

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. :)
Roses are #FF0000
Violets are #0000FF
All my base
are belong to you

SMF spam blocked by CleanTalk