Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Draco on Sat 10/09/2011 18:18:03

Title: Problem with semicolon and something more
Post by: Draco on Sat 10/09/2011 18:18:03
Hi,
I have a little problem.
I have started one game and I wanted to spare some time so I used the code from the Demo game (I hope it doesn't matter ???). Of course I changed the code a little bit, after the change the code is:
function room_c() {
   // script for room: Repeatedly execute
   if (FadeToBlack()==false) {
      SetScreenTransition(eTransitionDissolve);
      player.ChangeRoom(Menu.crm);
    }

So I have two problems; first one: in the original code it was it was like: player.ChangeRoom(crmMenu);
and when I copied it the AGS said its "unknown token:crmMenu" so I tried to change it a little bit and it has disapper. But I don't know if its right. The second problem is that the AGS say that in the last part of the problem code  (player.ChangeRoom(Menu.crm); ) is expected semicolon. But the semicolon is already there.
Could you help me?

Draco
Title: Re: Problem with semicolon and something more
Post by: Draco on Sat 10/09/2011 18:19:37
Oh, I forget to say I'm new here.
Title: Re: Problem with semicolon and something more
Post by: pcj on Sat 10/09/2011 18:54:38
You have to specify the room number in ChangeRoom(), not what you did.  So it would be like player.ChangeRoom(1); or something.
Title: Re: Problem with semicolon and something more
Post by: Lt. Smash on Sat 10/09/2011 19:00:28
Yep, pcj is right. You've passed the room's filename as argument for ChangeRoom instead of the right room number.

Possibly crmMenu was originally defined as a variable with the proper room number. Smth like int crmMenu = 2;

Btw welcome aboard on the AGS forums ;)
Title: Re: Problem with semicolon and something more
Post by: RickJ on Sun 11/09/2011 05:58:03
If you look at the demo game's header file you will find a line "#define crmMenu 1" (don't rememebr the exact number).  The compiler substitutes "1" (or whatever text comes after crmMenu) for "crmMenu" before compilation.   

The #define lines in the header demonstrate how to give names to the room numbers.  You will either have to use the room number or put your own #define lines in the header file.  It's your choice to work with numbers or names.